Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. 'Floating text
  3. '*************
  4.  
  5.  
  6. dim FloatingScores
  7. FloatingScores = Table1.ShowDT 'Enable/Disable floating text scores  (Default: Table1.ShowDT)
  8. 'Does NOT play nicely with B2S at the moment.
  9. '(In a multiplayer game, floating text will only appear for player 1)
  10. ScoreBox.TimerEnabled = FloatingScores
  11.  
  12.  
  13. dim FTlow, FTmed, FThigh
  14. InitFloatingText
  15. Sub InitFloatingText()
  16.     Set FTlow = New FloatingText
  17.     with FTlow
  18.         .Sprites(0) = Array(FtLow1_1, FtLow1_2, FtLow1_3, FtLow1_4, FtLow1_5, FTlow1_6)
  19.         .Sprites(1) = Array(FtLow2_1, FtLow2_2, FtLow2_3, FtLow2_4, FtLow2_5, FtLow2_6)
  20.         .Sprites(2) = Array(FtLow3_1, FtLow3_2, FtLow3_3, FtLow3_4, FtLow3_5, FtLow3_6)
  21.         .Sprites(3) = Array(FtLow4_1, FtLow4_2, FtLow4_3, FtLow4_4, FtLow4_5, FtLow4_6)
  22.         .Sprites(4) = Array(FtLow5_1, FtLow5_2, FtLow5_3, FtLow5_4, FtLow5_5, FtLow5_6)
  23.        
  24.         .Prefix = "Font_"
  25.         .Size = 29/2
  26.         .FadeSpeedUp = 1/800
  27.         .RotX = -37
  28.  
  29.     end With
  30.  
  31.     Set FTmed = New FloatingText
  32.     With FTmed
  33.         .Sprites(0) = Array(FtMed1_1, FtMed1_2, FtMed1_3, FtMed1_4, FtMed1_5, FtMed1_6)
  34.         .Sprites(1) = Array(FtMed2_1, FtMed2_2, FtMed2_3, FtMed2_4, FtMed2_5, FtMed2_6)
  35.         .Sprites(2) = Array(FtMed3_1, FtMed3_2, FtMed3_3, FtMed3_4, FtMed3_5, FtMed3_6)
  36.         .Sprites(3) = Array(FtMed4_1, FtMed4_2, FtMed4_3, FtMed4_4, FtMed4_5, FtMed4_6)
  37.         .Sprites(4) = Array(FtMed5_1, FtMed5_2, FtMed5_3, FtMed5_4, FtMed5_5, FtMed5_6)
  38.         .Prefix = "Font_"
  39.         .Size = 29
  40.         .FadeSpeedUp = 1/1500
  41.         .RotX = -37
  42.     End With
  43.  
  44.     Set FThigh = New FloatingText
  45.     With FThigh
  46.         .Sprites(0) = Array(FtHi1_1, FtHi1_2, FtHi1_3, FtHi1_4, FtHi1_5, FtHi1_6)
  47.         .Sprites(1) = Array(FtHi2_1, FtHi2_2, FtHi2_3, FtHi2_4, FtHi2_5, FtHi2_6)
  48.         .Sprites(2) = Array(FtHi3_1, FtHi3_2, FtHi3_3, FtHi3_4, FtHi3_5, FtHi3_6)
  49.         .Prefix = "Font_"
  50.         .Size = 29*4
  51.         .FadeSpeedUp = 1/3500
  52.         .RotX = -37
  53.     End With
  54.  
  55. End Sub
  56.  
  57. 'A special keyframe animation called with big scores
  58. dim aLutBurst : Set aLutBurst = New cAnimation
  59. with aLutBurst
  60.     .AddPoint 0, 0, 0
  61.     .AddPoint 1, 130, 20 'up
  62.     .AddPoint 2, 150, 14 'hold
  63.     .AddPoint 3, 180, 20 'hold
  64.     .AddPoint 4, 210, 14 'hold
  65.     .AddPoint 5, 240, 20 'hold
  66.     .AddPoint 6, 270, 14 'hold
  67.     .AddPoint 7, 290, 20 'hold
  68.     .AddPoint 8, 320, 14 'hold
  69.     .AddPoint 9, 350, 20 'hold
  70.     .AddPoint 10,350+130, 0 'down
  71.     .Callback = "animLutBurst"
  72. End With
  73. Sub animLutBurst(aLVL)
  74.     table1.ColorGradeImage = "RedLut_" & Round(aLVL)
  75. ENd Sub
  76. animlutburst 0
  77.  
  78. Const UseVPMNVRAM = true
  79. dim LastSwitch : Set LastSwitch = Sw10
  80. dim LastScore : LastScore = 0
  81.  
  82. Sub ScoreBox_Timer()
  83.     Dim NVRAM : NVRAM = Controller.NVRAM
  84.     dim str : str = _
  85.     ConvertBCD(NVRAM(CInt("&h200"))) & _
  86.     ConvertBCD(NVRAM(CInt("&h201"))) & _
  87.     ConvertBCD(NVRAM(CInt("&h202"))) & _
  88.     ConvertBCD(NVRAM(CInt("&h203")))        'sys 11 current score
  89.     str = round(str)
  90.  
  91.     dim PointGain
  92.     PointGain = Str - LastScore
  93.     LastScore = str
  94.  
  95.     if PointGain >= 90000 Then  'hi point scores
  96.         PlaceFloatingTextHi PointGain, LastSwitch.x, LastSwitch.y  
  97.         aLutBurst.Play
  98.     elseif pointgain >= 2500 then 'medium point scores 
  99.         ftmed.TextAt PointGain, Lastswitch.x, Lastswitch.Y
  100.     elseif pointgain > 0 then   'low point scores
  101.         ftlow.TextAt PointGain, Lastswitch.x, Lastswitch.Y
  102.     end if
  103.     'if debugstr <> "" then
  104.     '   if tb.text <> debugstr then tb.text = debugstr
  105.     'end if
  106.  
  107.     FTlow.Update2
  108.     FTmed.Update2
  109.  
  110.     FThigh.Update2
  111.     aLutBurst.Update2
  112. End Sub
  113.  
  114. Function ConvertBCD(v)
  115.     ConvertBCD = "" & ((v AND &hF0) / 16) & (v AND &hF)
  116. End Function
  117.  
  118. 'Helper placer sub
  119. Sub PlaceFloatingTextHi(aPointGain, ByVal aX, ByVal aY) 'center text a bit for the big scores
  120.     aX = (aX + (table1.width/2))/2
  121.     aY = (aY + (table1.Height/2))/2
  122.     FThigh.TextAt aPointGain, aX, aY
  123. End Sub
  124.  
  125. 'Switch location handling, or at least the method I use
  126. Sub aSwitches_Hit(aIDX)
  127.     Set LastSwitch = aSwitches(aIDX)
  128. End Sub
  129.  
  130. 'Walls don't have x/y coords so a spoof object is used for slingshots.
  131. 'Set LastSwitch = LeftSlingPos under 'Sub LeftSlingShot_SlingShot'
  132. Dim LeftSlingPos : Set LeftSlingPos = New WallSwitchPos
  133. Dim RightSlingPos : Set RightSlingPos = New WallSwitchPos
  134. Dim LeftLockPos : Set LeftLockPos = New WallSwitchPos
  135.  
  136. Class WallSwitchPos : Public x,y,name : End Class
  137. '
  138. LeftLockPos.Name = "LeftLock"
  139. LeftLockPos.x = leftlock.x + 180
  140. LeftLockPos.y = LeftLock.y
  141.  
  142.  
  143. LeftSlingPos.Name = "LeftSlingShot"
  144. LeftSlingPos.X = 160+25
  145. LeftSlingPos.Y = 1480
  146.  
  147. RightSlingPos.Name = "RightSlingShot"
  148. RightSlingPos.X = 700-25
  149. RightSlingPos.Y = 1480
  150.  
  151. 'Some debug boxes
  152. 'tb.timerinterval = 2200
  153. 'tb.Timerenabled = 1
  154. 'Sub tb_timer()
  155. '   FTlow.TextAt "1234567", 600, 1000
  156. 'End Sub
  157.  
  158. 'Sub tbDB_Timer()
  159. '   dim str,x
  160. '   for x = 0 to ftlow.count
  161. '       str = str & "L&L " & x & ": " & abs(Ftlow.Lock(x)) & "" & abs(Ftlow.loaded(x)) & vbnewline '& " " & FtLow.Text(x)
  162. '   Next
  163. '   if me.text <> str then me.text = str end if
  164. 'End Sub
  165.  
  166.  
  167.  
  168.  
  169. 'End Floating text
  170. '*************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement