aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2016-01-01 22:53:55 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2016-01-01 22:53:55 +0000
commit9f1d6ca324242597369ac41c6f9fb29cb4aace1b (patch)
treeeb48d99b35888e3a0d043a5878280d42f34f512c
parent3544189cdf2cb38a3446ae968d9024406fcabe2a (diff)
downloadusdx-9f1d6ca324242597369ac41c6f9fb29cb4aace1b.tar.gz
usdx-9f1d6ca324242597369ac41c6f9fb29cb4aace1b.tar.xz
usdx-9f1d6ca324242597369ac41c6f9fb29cb4aace1b.zip
mainly change sentence-related stuff
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3161 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--src/base/UGraphicClasses.pas83
-rw-r--r--src/base/UNote.pas51
-rw-r--r--src/screens/UScreenJukebox.pas8
-rw-r--r--src/screens/UScreenSing.pas14
4 files changed, 112 insertions, 44 deletions
diff --git a/src/base/UGraphicClasses.pas b/src/base/UGraphicClasses.pas
index 3e2ed642..9d19a214 100644
--- a/src/base/UGraphicClasses.pas
+++ b/src/base/UGraphicClasses.pas
@@ -65,12 +65,12 @@ type
SurviveSentenceChange : Boolean;
constructor Create(cX, cY : real;
- cScreen : integer;
- cLive : byte;
- cFrame : integer;
- cRecArrayIndex : integer;
- cStarType : TParticleType;
- Player : cardinal);
+ cScreen : integer;
+ cLive : byte;
+ cFrame : integer;
+ cRecArrayIndex : integer;
+ cStarType : TParticleType;
+ Player : cardinal);
destructor Destroy(); override;
procedure Draw;
procedure LiveOn;
@@ -111,7 +111,7 @@ type
procedure SpawnRec();
procedure Kill(index: cardinal);
procedure KillAll();
- procedure SentenceChange();
+ procedure SentenceChange(CP: integer);
procedure SaveGoldenStarsRec(Xtop, Ytop, Xbottom, Ybottom: real);
procedure SavePerfectNotePos(Xtop, Ytop: real);
procedure GoldenNoteTwinkle(Top, Bottom, Right: real; Player: integer);
@@ -356,6 +356,11 @@ procedure TParticle.Draw;
var
L: cardinal;
begin
+ { if screens = 2 and playerplay <= 3 the 2nd screen shows the
+ textures of screen 1 }
+ if (Screens = 2) and (PlayersPlay <= 3) then
+ ScreenAct := 1;
+
if (ScreenAct = Screen) then
begin
glEnable(GL_TEXTURE_2D);
@@ -511,9 +516,10 @@ begin
end;
end;
-procedure TEffectManager.SentenceChange();
+procedure TEffectManager.SentenceChange(CP: integer);
var
c: cardinal;
+ p: integer;
begin
c := 0;
while c <= High(Particle) do
@@ -527,7 +533,8 @@ begin
SetLength(PerfNoteArray,0); // remove PerfectNote positions
for c := 0 to 5 do
begin
- TwinkleArray[c] := 0; // reset GoldenNoteHit memory
+ if ((c mod 2) = CP) then
+ TwinkleArray[c] := 0; // reset GoldenNoteHit memory
end;
end;
@@ -651,7 +658,7 @@ procedure TEffectManager.SpawnPerfectLineTwinkle();
var
P, I, Life: cardinal;
Left, Right, Top, Bottom: cardinal;
- cScreen: integer;
+ cScreen, Nstars: integer;
begin
// calculation of coordinates done with hardcoded values like in UDraw.pas
// might need to be adjusted if drawing of SingScreen is modified
@@ -665,10 +672,43 @@ begin
Left := 30;
end;
Right := 770;
+
// spawn effect for every player with a perfect line
for P := 0 to PlayersPlay-1 do
if Player[P].LastSentencePerfect then
begin
+ // 3 and 6 players in 1 screen
+ if (Ini.Screens = 0) then
+ begin
+ if (PlayersPlay = 4) then
+ begin
+ if (P <= 1) then
+ begin
+ Left := 30;
+ Right := 385;
+ end
+ else
+ begin
+ Left := 415;
+ Right := 770;
+ end;
+ end;
+
+ if (PlayersPlay = 6) then
+ begin
+ if (P <= 2) then
+ begin
+ Left := 30;
+ Right := 385;
+ end
+ else
+ begin
+ Left := 415;
+ Right := 770;
+ end;
+ end;
+ end;
+
// calculate area where notes of this player are drawn
case PlayersPlay of
1: begin
@@ -689,7 +729,13 @@ begin
end;
case P of
0,1: cScreen := 1;
- else cScreen := 2;
+ else
+ begin
+ if (Ini.Screens = 1) then
+ cScreen := 2
+ else
+ cScreen := 1;
+ end;
end;
end;
3,6: begin
@@ -709,12 +755,23 @@ begin
end;
case P of
0,1,2: cScreen := 1;
- else cScreen := 2;
+ else
+ begin
+ if (Ini.Screens = 1) then
+ cScreen := 2
+ else
+ cScreen := 1;
+ end;
end;
end;
end;
+
// spawn Sparkling Stars inside calculated coordinates
- for I := 0 to 80 do
+ Nstars := 80;
+ if (Ini.Screens = 0) and (PlayersPlay > 3) then
+ Nstars := 40;
+
+ for I := 0 to Nstars do
begin
Life := RandomRange(8,16);
Spawn(RandomRange(Left,Right), RandomRange(Top,Bottom), cScreen, Life, 16-Life, -1, PerfectLineTwinkle, P);
diff --git a/src/base/UNote.pas b/src/base/UNote.pas
index dc2c6922..ae915115 100644
--- a/src/base/UNote.pas
+++ b/src/base/UNote.pas
@@ -129,10 +129,10 @@ const
MAX_SONG_LINE_BONUS = 1000; // max. achievable line bonus per song
procedure Sing(Screen: TScreenSing);
-procedure NewSentence(Screen: TScreenSing);
+procedure NewSentence(CP: integer; Screen: TScreenSing);
procedure NewBeatClick(Screen: TScreenSing); // executed when on then new beat for click
procedure NewBeatDetect(Screen: TScreenSing); // executed when on then new beat for detection
-procedure NewNote(Screen: TScreenSing); // detect note
+procedure NewNote(CP: integer; Screen: TScreenSing); // detect note
function GetMidBeat(Time: real): real;
function GetTimeFromBeat(Beat: integer; SelfSong: TSong = nil): real;
@@ -315,7 +315,7 @@ begin
// clean player note if there is a new line
// (optimization on halfbeat time)
if Lines[CP].Current <> LyricsState.OldLine then
- NewSentence(Screen);
+ NewSentence(CP, Screen);
end; // for CountGr
@@ -352,23 +352,26 @@ begin
end; // for CountGr
// on sentence change...
- Screen.onSentenceChange(Lines[0].Current);
+ Screen.onSentenceChange(CP, Lines[CP].Current);
end;
-procedure NewSentence(Screen: TScreenSing);
+procedure NewSentence(CP: integer; Screen: TScreenSing);
var
i: integer;
begin
// clean note of player
for i := 0 to High(Player) do
begin
+ if (i mod 2 = CP) then
+ begin
Player[i].LengthNote := 0;
Player[i].HighNote := -1;
SetLength(Player[i].Note, 0);
+ end;
end;
// on sentence change...
- Screen.onSentenceChange(Lines[0].Current);
+ Screen.onSentenceChange(CP, Lines[CP].Current);
end;
procedure NewBeatClick;
@@ -404,11 +407,9 @@ end;
procedure NewBeatDetect(Screen: TScreenSing);
var
- SentenceEnd: integer;
+ CP, SentenceEnd: integer;
I: cardinal;
begin
- NewNote(Screen);
-
// check for sentence end
// we check all lines here because a new sentence may
// have been started even before the old one finishes
@@ -420,25 +421,30 @@ begin
// do it for most corrupt txt and for lines in
// non-corrupt txts that start immediatly after the prev.
// line ends
+
if (assigned(Screen)) then
begin
- for I := 0 to Lines[0].High do
+ CP := 0;
+
+ NewNote(CP, Screen);
+
+ for I := 0 to Lines[CP].High do
begin
- with Lines[0].Line[I] do
+ with Lines[CP].Line[I] do
begin
if (HighNote >= 0) then
begin
SentenceEnd := Note[HighNote].Start + Note[HighNote].Length;
if (LyricsState.OldBeatD < SentenceEnd) and (LyricsState.CurrentBeatD >= SentenceEnd) then
- Screen.OnSentenceEnd(I);
+ Screen.OnSentenceEnd(CP, I);
end;
end;
end;
end;
end;
-procedure NewNote(Screen: TScreenSing);
+procedure NewNote(CP: integer; Screen: TScreenSing);
var
LineFragmentIndex: integer;
CurrentLineFragment: PLineFragment;
@@ -462,28 +468,30 @@ var
begin
ActualTone := 0;
NoteHit := false;
-
+
// TODO: add duet mode support
// use Lines[LineSetIndex] with LineSetIndex depending on the current player
- // count min and max sentence range for checking
+ // count min and max sentence range for checking
// (detection is delayed to the notes we see on the screen)
- SentenceMin := Lines[0].Current-1;
+ SentenceMin := Lines[CP].Current-1;
if (SentenceMin < 0) then
SentenceMin := 0;
- SentenceMax := Lines[0].Current;
+ SentenceMax := Lines[CP].Current;
for ActualBeat := LyricsState.OldBeatD+1 to LyricsState.CurrentBeatD do
begin
// analyze player signals
for PlayerIndex := 0 to PlayersPlay-1 do
begin
+ if (PlayerIndex mod 2 = CP) then
+ begin
// check for an active note at the current time defined in the lyrics
NoteAvailable := false;
SentenceDetected := SentenceMin;
for SentenceIndex := SentenceMin to SentenceMax do
begin
- Line := @Lines[0].Line[SentenceIndex];
+ Line := @Lines[CP].Line[SentenceIndex];
for LineFragmentIndex := 0 to Line.HighNote do
begin
CurrentLineFragment := @Line.Note[LineFragmentIndex];
@@ -524,7 +532,7 @@ begin
// add note if possible
if (CurrentSound.ToneValid and NoteAvailable) then
begin
- Line := @Lines[0].Line[SentenceDetected];
+ Line := @Lines[CP].Line[SentenceDetected];
// process until last note
for LineFragmentIndex := 0 to Line.HighNote do
begin
@@ -569,8 +577,8 @@ begin
// gets for a hit of one beat of a normal note
// CurNotePoints is the amount of points that is meassured
// for a hit of the note per full beat
- CurNotePoints := (MaxSongPoints / Lines[0].ScoreValue) * ScoreFactor[CurrentLineFragment.NoteType];
-
+ CurNotePoints := (MaxSongPoints / Lines[CP].ScoreValue) * ScoreFactor[CurrentLineFragment.NoteType];
+
case CurrentLineFragment.NoteType of
ntNormal: CurrentPlayer.Score := CurrentPlayer.Score + CurNotePoints;
ntGolden: CurrentPlayer.ScoreGolden := CurrentPlayer.ScoreGolden + CurNotePoints;
@@ -665,6 +673,7 @@ begin
end; // if SentenceDetected = SentenceMax
end; // if Detected
+ end;
end; // for PlayerIndex
end; // for ActualBeat
//Log.LogStatus('EndBeat', 'NewBeat');
diff --git a/src/screens/UScreenJukebox.pas b/src/screens/UScreenJukebox.pas
index 36a65720..6296b4eb 100644
--- a/src/screens/UScreenJukebox.pas
+++ b/src/screens/UScreenJukebox.pas
@@ -198,8 +198,8 @@ type
procedure Finish;
procedure Pause; // toggle pause
- procedure OnSentenceEnd(SentenceIndex: cardinal); // for linebonus + singbar
- procedure OnSentenceChange(SentenceIndex: cardinal); // for golden notes
+ procedure OnSentenceEnd(CP: integer; SentenceIndex: cardinal); // for linebonus + singbar
+ procedure OnSentenceChange(CP: integer; SentenceIndex: cardinal); // for golden notes
//procedure DeleteSong(Id: integer);
procedure FilterSongList(Filter: UTF8String);
@@ -1391,7 +1391,7 @@ begin
end;
end;
-procedure TScreenJukebox.OnSentenceEnd(SentenceIndex: cardinal);
+procedure TScreenJukebox.OnSentenceEnd(CP: integer; SentenceIndex: cardinal);
var
PlayerIndex: byte;
CurrentPlayer: PPLayer;
@@ -1425,7 +1425,7 @@ end;
// Called on sentence change
// SentenceIndex: index of the new active sentence
-procedure TScreenJukebox.OnSentenceChange(SentenceIndex: cardinal);
+procedure TScreenJukebox.OnSentenceChange(CP: integer; SentenceIndex: cardinal);
begin
// fill lyrics queue and set upper line to the current sentence
while (Lyrics.GetUpperLineIndex() < SentenceIndex) or
diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas
index 38c4762d..b339199b 100644
--- a/src/screens/UScreenSing.pas
+++ b/src/screens/UScreenSing.pas
@@ -163,8 +163,8 @@ type
procedure Finish; virtual;
procedure Pause; // toggle pause
- procedure OnSentenceEnd(SentenceIndex: cardinal); // for linebonus + singbar
- procedure OnSentenceChange(SentenceIndex: cardinal); // for golden notes
+ procedure OnSentenceEnd(CP: integer; SentenceIndex: cardinal); // for linebonus + singbar
+ procedure OnSentenceChange(CP: integer; SentenceIndex: cardinal); // for golden notes
end;
implementation
@@ -949,7 +949,9 @@ begin
end;
// kill all stars not killed yet (goldenstarstwinkle mod)
- GoldenRec.SentenceChange;
+ GoldenRec.SentenceChange(0);
+ if (PlayersPlay <> 1) then
+ GoldenRec.SentenceChange(1);
// set position of line bonus - line bonus end
// set number of empty sentences for line bonus
@@ -1324,7 +1326,7 @@ begin
end;
end;
-procedure TScreenSing.OnSentenceEnd(SentenceIndex: cardinal);
+procedure TScreenSing.OnSentenceEnd(CP: integer; SentenceIndex: cardinal);
var
PlayerIndex: byte;
CurrentPlayer: PPLayer;
@@ -1420,10 +1422,10 @@ end;
// Called on sentence change
// SentenceIndex: index of the new active sentence
-procedure TScreenSing.OnSentenceChange(SentenceIndex: cardinal);
+procedure TScreenSing.OnSentenceChange(CP: integer; SentenceIndex: cardinal);
begin
// goldenstarstwinkle
- GoldenRec.SentenceChange;
+ GoldenRec.SentenceChange(CP);
// fill lyrics queue and set upper line to the current sentence
while (Lyrics.GetUpperLineIndex() < SentenceIndex) or