home *** CD-ROM | disk | FTP | other *** search
/ Millennium Time Capsule / AC2000.BIN / disks / hbasic_1 / source / multi.bas < prev    next >
Encoding:
BASIC Source File  |  1997-07-29  |  2.8 KB  |  140 lines

  1.  
  2. REM Multi - converted from old MODLIB routines to incorporate the NEW
  3. REM routines by yours truely. 30/7/1997
  4.  
  5. DEFINT a-z
  6. REM $option y+,v+,u+,#,[
  7. REM $option j10
  8. REM $option fC:\MULTI.ACC
  9.  
  10. LIBRARY "GEMAES","MODPLAY","GEMDOS"
  11.  
  12. REM $include gemaes.bh
  13. REM $include filesel3.bas
  14.  
  15. CONST va_start=&H4711
  16. COMMON SHARED junk
  17.  
  18. SUB Play
  19. STATIC mess&,id,addr&,addr2&,a,file$,b,a%(1),l&,ad&,b$,moder
  20. SHARED mess(1),file$,moder
  21.  
  22. OPEN file$ FOR INPUT AS #1
  23. l&=LOF(1)
  24. CLOSE #1
  25.  
  26. IF moder>0 THEN
  27.     moder=0
  28.     StopMod a%()
  29.     IF ad&>0 THEN a=mfree (ad&)
  30. END IF
  31.  
  32. 'ERASE a%
  33. 'DIM a%(l&+40000)
  34.  
  35. 'ad&=VARPTR(a%(0))
  36.  
  37. ad&=malloc& (l&)
  38. IF ad&=0 THEN
  39.     a=form_alert (1,"[1][ Not enough memory to load: | "+file$+"! ][ OK ]")
  40.     EXIT SUB
  41. END IF
  42. BLOAD file$,ad&
  43.  
  44. PlayMod ad&
  45. INCR moder
  46.  
  47. GetModName ad&,b$
  48.  
  49. ' b=form_alert (1,"[1][ Mod name: "+b$+" ][ Ok ]")
  50.  
  51. END SUB
  52.  
  53. SUB opts
  54. STATIC b,moder,a%(),fsmessage$,fsname$,fspath$,file$
  55. SHARED fsmessage$,fsname$,fspath$,file$,moder
  56.  
  57. b=form_alert (1,"[1][ Stop playing, Play new MOD | or infomation ][ Stop | Play | Info ]")
  58. IF b=1 AND moder>0 THEN StopMod a%() : moder=0
  59. IF b=2 THEN
  60.     fsmessage$="File to play..."
  61.     file$=fileselect$
  62.     b=form_alert (1,"[1][ Are you sure? Play: | "+file$+" ? ][ Yes | No ]")
  63.     IF b=1 AND moder>0 THEN
  64.         StopMod a%()
  65.         moder=0
  66.     END IF
  67.     IF b=1 THEN CALL Play
  68. END IF
  69. IF b=3 THEN b=form_alert (1,"[1][ MultiPhile v1 by Paul Jones | Plays MODs (for now) | © 1997 to PJCO ][ Ok ]")
  70.  
  71. END SUB
  72.  
  73. SUB Getcommand
  74. STATIC mess&,id,addr&,addr2&,a,file$,b,a%(1),l&,ad&,b$,moder
  75. SHARED mess(1),file$
  76.  
  77. REM mess0+1=&H4711
  78. REM mess2+3=sent from (id)
  79. REM mess4+5+6+7=address of string of mod file
  80. REM mess9-16=blank
  81.  
  82. file$=""
  83.  
  84. mess&=VARPTR(mess(0))
  85. id=SPEEKW(mess&+2)
  86. addr&=SPEEKL(mess&+6)
  87. addr2&=addr&
  88.  
  89. 'OPEN "vastart.dat" FOR OUTPUT AS #1
  90.  
  91.  
  92. DO
  93. a=PEEKB (addr&)
  94. IF a<>0 THEN file$=file$+CHR$(a)
  95. 'b=form_alert (1,"[1][ Number "+STR$(a)+" Char: "+CHR$(a)+" ][ Ok ]")
  96. INCR addr&
  97. 'PRINT #1,a
  98. LOOP UNTIL a=0
  99.  
  100. 'CLOSE #1
  101.  
  102. 'b=form_alert (1,"[1][ From:"+STR$(id)+" file name: | "+file$+" ][ Ok ]")
  103. 'b=form_alert (1,"[1][ Address: "+STR$(addr&)+" ][ Ok ]")
  104.  
  105. CALL Play
  106.  
  107.  
  108. END SUB
  109.  
  110. SUB do_message
  111. STATIC cur_front,MessageType,title,item,b
  112. SHARED exit_item,Finished_Flag,Mess(1),AlreadyOpen
  113.     MessageType=Mess(0)
  114.     junk=wind_get(Mess(3),WF_TOP,cur_front,junk,junk,junk)
  115.      SELECT CASE MessageType
  116.     CASE AC_OPEN:
  117.         CALL opts
  118.     CASE va_start
  119.         CALL Getcommand
  120.     END SELECT
  121. END SUB
  122.  
  123. SUB StartAccessory(daname$)
  124. SHARED WindX,WindY,WindW,WindH
  125. SHARED Mess(1)
  126. STATIC id,mpos
  127. DIM Mess(7)
  128. id=PEEKW(PEEKL(GB+4)+4)
  129. mpos=menu_register(id,daname$)
  130. junk=wind_get(0,WF_WORKXYWH,WindX,WindY,WindW,WindH)
  131.  
  132. DO
  133.     evnt_mesag VARPTR(mess(0))
  134.     do_message
  135. LOOP
  136. END SUB
  137.  
  138. DIM a%(1)
  139. InitMod a%()
  140. StartAccessory ("  MultiPhile v1.1")