aboutsummaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/base')
-rw-r--r--src/base/UGraphicClasses.pas83
-rw-r--r--src/base/UNote.pas51
2 files changed, 100 insertions, 34 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');