diff --git a/PiraattiIntro.trse b/PiraattiIntro.trse index 744c063..af7529c 100644 --- a/PiraattiIntro.trse +++ b/PiraattiIntro.trse @@ -40,7 +40,7 @@ remove_unused_symbols = 1 ignore_initial_jump = 0 current_file = piraatti_intro.ras output_type = prg -exomizer_toggle = 1 +exomizer_toggle = 0 use_track_19 = 1 disable_compiler_comments = 0 charset_ = :resources/character.rom diff --git a/piraatti_intro.ras b/piraatti_intro.ras index 524103b..5251d6a 100644 --- a/piraatti_intro.ras +++ b/piraatti_intro.ras @@ -235,7 +235,7 @@ text : string = (@cmoveto, 6,10, "ARI-PEKKA PULKKIS - VAASA", @cpause, @cstop ); naamatNumbers : string = ( "123", "456", "789", " 10", "20 ", " 30", - " 40", "50 ", " 60", " 70", " 80", " 90", @cstop); + " 40", "50 ", " 60", " 70", " 80", " 90", @cstop); tab320 : array[25] of integer = buildtable("i*320"); @@ -337,6 +337,16 @@ text : string = (@cmoveto, 6,10, */ tempPtr1, tempPtr2 : pointer; tempInt : integer; + +/* + Workloads for main loop +*/ + @define notWorking 0 + @define mainText 1 + @define mainPicture 2 + + mainWorkState : byte = 0; + //=========================================================================================================== // Raster interrupt forward declarations @@ -377,6 +387,23 @@ begin RasterIrq(RasterMainPartScroller(), rasterLineMainScroller, @useKernal); end; +//=========================================================================================================== +// Main Work state functions +//=========================================================================================================== + +function isMainWorking() : boolean; +var result : boolean; +begin + if (mainWorkState = @notWorking) then result := false + else result := true; + isMainWorking := result; +end; + +procedure startMainWork(s : byte); +begin + mainWorkState := s; +end; + /** * Assembly setup for a character set copy in RAM */ @@ -1063,6 +1090,7 @@ begin begin purpleBounceOfs := 0; spriteBounceOfs := 0; + spriteWobbleOfs := 245; end; if (part = @partMain) then begin @@ -1122,53 +1150,19 @@ begin if (mainState = @mainShowText) then begin - //tempPtr1 := #screen_char_loc2 + 840; - Fill(^$4740, 0, 80); - //tempPtr1 := #screen_col_loc + 800; - FillFast(^$DB20, 0, 80); - - WriteMainText(); - if (tp[0] = @cstop) then tp := #mainText; // back to first page when done - - //tempPtr2 := #screen_col_loc + 960; // keep color for scroll text - fillfast(^$DBC0, $a, 40); + startMainWork(@mainText); end; if (mainState = @mainPicture) then begin - setmulticolormode(); - setbitmapmode(); - - //tempPtr1 := AddressTable(#colorAddressTable, 0, 21); - FillFast(^$4748, 0, 120); - - //tempPtr2 := #screen_col_loc + 960; // keep color for scroll text - fillfast(^$DBC0, $a, 40); - - // set current picture - currentNaamaX := naamatCoordinates[currentNaama * 4]; - currentNaamaY := naamatCoordinates[currentNaama * 4 + 1]; - currentNaamaWidth := naamatCoordinates[currentNaama * 4 + 2]; - currentNaamaHeight := naamatCoordinates[currentNaama * 4 + 3]; - - // todo write these in main loop instead of raster interrupt - PrintCharToSprite(numbersPtr[0], @mainPartSmallFontLoc, @numberSpriteCopies); - PrintCharToSprite(numbersPtr[1], @mainPartSmallFontLoc, @numberSpriteCopies + 64); - PrintCharToSprite(numbersPtr[2], @mainPartSmallFontLoc, @numberSpriteCopies + 128); - numbersPtr += 3; - if (numbersPtr[0] = @cstop) then numbersPtr := #naamatNumbers; - - // print the name - WriteMainName(); - if (namesPtr[0] = @cstop) then namesPtr := #naamatNames; - - plasmaHeight := 2; + startMainWork(@mainPicture); end; end; procedure UpdateMainPart(); begin - if (mainState = @mainShowText) then + + if (mainState = @mainShowText and not isMainWorking()) then begin textPlStartX := 0; i := lo(textFade); @@ -1181,6 +1175,7 @@ begin if (mod(textFade, 10) = 0) then inc(plasmaHeight); if (plasmaHeight > 9) then plasmaHeight := 9; end; + if (mainState = @mainFadeToPicture and textFade < 210) then begin i := lo(textFade); @@ -1200,7 +1195,18 @@ begin inc(textFade); end; + if (mainState = @mainPicture) then + if (isMainWorking()) then + begin + sprite_color[0]:=0; + sprite_color[1]:=0; + sprite_color[2]:=0; + sprite_color[3]:=0; + sprite_color[4]:=0; + sprite_color[5]:=0; + end + else begin // copy picture one row at a time if (pictureFade < currentNaamaHeight) then @@ -1245,6 +1251,7 @@ begin memcpyfast(#textFadeLumi, 0, tempPtr1, 20); end; end; + if (mainState = @mainFadeToText) then begin // blank out picture one row at a time @@ -1270,9 +1277,9 @@ begin sprite_color[0]:=0; sprite_color[1]:=0; sprite_color[2]:=0; - sprite_color[3]:=$0; - sprite_color[4]:=$0; - sprite_color[5]:=$0; + sprite_color[3]:=0; + sprite_color[4]:=0; + sprite_color[5]:=0; end; if (mainTime > 50 and nameFade < 150) then @@ -1315,6 +1322,7 @@ var lastSpriteWoblOfs : byte; wobblePause : boolean = false; wobblePauseTimer : integer = 0; cEqualsChangeFlag : boolean = false; + fillPart : byte = 0; begin if (part >= @partOpenBar) then Call(SIDFILE_1_PLAY); @@ -1359,16 +1367,25 @@ begin if (fadeStateCurrent = @fadeStateText) then begin fadeTemp := textFadeLumi[fadeOfsCurrent]; - Fill(screen_col_loc, fadeTemp, 255); - FillFast(screen_col_loc + 256, fadeTemp, 127); - Fill(screen_col_loc + 511, fadeTemp, 255); - Fill(screen_col_loc + 766, fadeTemp, 234); + if (fillPart = 0) then + begin + Fill(screen_col_loc, fadeTemp, 255); + FillFast(screen_col_loc + 256, fadeTemp, 127); + fadeOfsCurrent -= 1; + end; + if (fillPart = 1) then + begin + Fill(screen_col_loc + 511, fadeTemp, 255); + Fill(screen_col_loc + 766, fadeTemp, 234); + end; GoToPurpleBarRasterStart(); if (fadeOfsCurrent >= @textFadeLumiLast) then begin fadeStateCurrent := @fadeStateAll; fadeOfsCurrent := 0; end; + inc(fillPart); + if (fillPart = 2) then fillPart := 0; end; if (fadeStateCurrent = @fadeStateAll) then begin @@ -1522,6 +1539,50 @@ begin while (true) do begin // Main loop "work tasks" here + if (mainWorkState = @mainText) then + begin + + //tempPtr1 := #screen_char_loc2 + 840; + Fill(^$4740, 0, 80); + //tempPtr1 := #screen_col_loc + 800; + FillFast(^$DB20, 0, 80); + + WriteMainText(); + if (tp[0] = @cstop) then tp := #mainText; // back to first page when done + + //tempPtr2 := #screen_col_loc + 960; // keep color for scroll text + fillfast(^$DBC0, $a, 40); + + mainWorkState := @notWorking; + end; + if (mainWorkState = @mainPicture) then + begin + //tempPtr1 := AddressTable(#colorAddressTable, 0, 21); + FillFast(^$4748, 0, 120); + + //tempPtr2 := #screen_col_loc + 960; // keep color for scroll text + fillfast(^$DBC0, $a, 40); + + // set current picture + currentNaamaX := naamatCoordinates[currentNaama * 4]; + currentNaamaY := naamatCoordinates[currentNaama * 4 + 1]; + currentNaamaWidth := naamatCoordinates[currentNaama * 4 + 2]; + currentNaamaHeight := naamatCoordinates[currentNaama * 4 + 3]; + + PrintCharToSprite(numbersPtr[0], @mainPartSmallFontLoc, @numberSpriteCopies); + PrintCharToSprite(numbersPtr[1], @mainPartSmallFontLoc, @numberSpriteCopies + 64); + PrintCharToSprite(numbersPtr[2], @mainPartSmallFontLoc, @numberSpriteCopies + 128); + numbersPtr += 3; + if (numbersPtr[0] = @cstop) then numbersPtr := #naamatNumbers; + + // print the name + WriteMainName(); + if (namesPtr[0] = @cstop) then namesPtr := #naamatNames; + + plasmaHeight := 2; + + mainWorkState := @notWorking; + end; end; end. \ No newline at end of file