Advertisement
TheFastFish

SLK_SATAN/PRG:PROGRAM

Nov 27th, 2015
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. OPTION STRICT
  2. ACLS
  3. XSCREEN 0
  4.  
  5. '-Variables-
  6. VAR I% 'Generic loop counter
  7. VAR T% 'Past MAINCNT
  8. VAR CHFLAG% 'Text change flag
  9. VAR ST% 'Current text string
  10. VAR ANG# 'Sine/rotate angle
  11. VAR TCY%=179 'Text y-alignment
  12. VAR VCX%=199 'Vector x-alignment
  13. VAR VCY%=59 'Vector y-alignment
  14. VAR VSC#=50 'Vector scale factor
  15. VAR VCL%=&HFFFFFFFF 'Vector color
  16. VAR SDP#=25 'Sine depth
  17. VAR STM%=0 'String pointer max
  18.  
  19. '-Arrays-
  20. DIM ARR#[10,2] 'Vector data LOAD
  21. DIM VTX#[5,2] 'Vector vertex data
  22. DIM ROT#[5,2] 'Rotated vertices
  23. DIM LIN%[5,2] 'Vector line data
  24.  
  25. '-DEFs-
  26. 'Callback for text control
  27. DEF TEXTCALL
  28. IF CHFLAG% THEN
  29. SPCHR CALLIDX,CALLIDX,24*ST%,1,24
  30. ENDIF
  31. SPOFS CALLIDX,199,TCY%+ROUND(SDP#*SIN(RAD(ANG#+(CALLIDX/399)*360)))
  32. SPROT CALLIDX,ANG#
  33. SPCOLOR CALLIDX,RGB(255,0,0)
  34. END
  35. 'Callback for vector control
  36. DEF VECTORCALL
  37. VAR OY%
  38. SPOFS CALLIDX OUT ,OY%
  39. SPOFS CALLIDX,VCX%+ROUND(SDP#*COS(RAD(ANG#*2+((CALLIDX-400)/(VSC#*2))*360))),OY%
  40. END
  41. 'Draws vector shape
  42. DEF DRAWVEC VTX#,LIN%,CTX%,CTY%,SCF#,COL%
  43. VAR LINC%=(LEN(LIN%)>>1)-1
  44. VAR I%
  45. VAR DX0%,DY0%,DX1%,DY1%
  46. FOR I%=0 TO LINC%
  47. DX0%=ROUND(VTX#[LIN%[I%,0],0]*SCF#)+CTX%
  48. DY0%=ROUND(-VTX#[LIN%[I%,0],1]*SCF#)+CTY%
  49. DX1%=ROUND(VTX#[LIN%[I%,1],0]*SCF#)+CTX%
  50. DY1%=ROUND(-VTX#[LIN%[I%,1],1]*SCF#)+CTY%
  51. GLINE DX0%,DY0%,DX1%,DY1%,COL%
  52. NEXT
  53. END
  54. 'Rotates vertices in array
  55. DEF ROTVTX VTXI#,VTXO#,RAD#
  56. VAR VTXC%=(LEN(LIN%)>>1)-1
  57. VAR I%
  58. VAR C#=COS(RAD#)
  59. VAR S#=SIN(RAD#)
  60. FOR I%=0 TO VTXC%
  61. VTXO#[I%,0]=VTXI#[I%,0]*C#-VTXI#[I%,1]*S#
  62. VTXO#[I%,1]=VTXI#[I%,0]*S#+VTXI#[I%,1]*C#
  63. NEXT
  64. END
  65.  
  66. '-Text setup-
  67. FOR I%=0 TO 399
  68. SPSET I%,I%,0,1,24,0
  69. SPHOME I%,199-I%,11
  70. SPOFS I%,199,TCY%
  71. SPCOLOR I%,RGB(255,0,0)
  72. SPFUNC I%,"TEXTCALL"
  73. SPSHOW I%
  74. NEXT
  75. LOAD"GRP4:TEXT",0
  76.  
  77. '-Vector setup-
  78. FOR I%=0 TO VSC#*2
  79. SPSET I%+400,VCX%-VSC#,VCY%+(400-VSC#)+I%,VSC#*2+1,1,0
  80. SPHOME I%+400,VSC#-1,0
  81. SPOFS I%+400,VCX%,VCY%-VSC#+I%
  82. SPFUNC I%+400,"VECTORCALL"
  83. SPSHOW I%+400
  84. NEXT
  85. LOAD"DAT:VECTOR",ARR#,0
  86. COPY VTX#,ARR#,10
  87. COPY LIN%,ARR#,10,10
  88. GCOLOR VCL%
  89.  
  90. 'Main loop
  91. T%=MAINCNT
  92. WHILE 1
  93. VSYNC
  94. 'Text change timer
  95. IF MAINCNT-T%>=180 THEN
  96. T%=MAINCNT
  97. INC ST%
  98. IF ST%>STM% THEN ST%=0
  99. CHFLAG%=1
  100. ENDIF
  101. 'Update vector graphic
  102. ROTVTX VTX#,ROT#,RAD(ANG#)
  103. GPAGE 0,2
  104. GCLS
  105. DRAWVEC ROT#,LIN%,VCX%,VCY%,VSC#,VCL%
  106. GCIRCLE VCX%,VCY%,VSC#
  107. GPAGE 0,4
  108. GCOPY 2,VCX%-VSC#,VCY%-VSC#,VCX%+VSC#,VCY%+VSC#,VCX%-VSC#,VCY%+(400-VSC#),1
  109. 'Manage sprites
  110. CALL SPRITE
  111. IF CHFLAG% THEN CHFLAG%=0
  112. INC ANG#,2.5
  113. WEND
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement