GDV.CPP 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. /**********************************************************************
  2. *
  3. * GDV.CPP
  4. *
  5. *
  6. * Summary: Play a GDV file
  7. *
  8. * Author: Kevin Dudley / Tony Crowther / Graeme Ing
  9. *
  10. * Project: Normality Inc PC
  11. *
  12. * Dated: 1527995 Wednesday 27-9-1995 15:59.
  13. *
  14. **********************************************************************/
  15. #include <iostream.h>
  16. #include <stdlib.h>
  17. #include <stdio.h>
  18. #include <graph.h>
  19. #include <i86.h>
  20. #include <dos.h>
  21. #include <conio.h>
  22. #include <float.h>
  23. #include <time.h>
  24. #include <math.h>
  25. #include <string.h>
  26. #include "defines.h"
  27. #include "data.equ"
  28. #include "3deng.h"
  29. #include "menudisp.h"
  30. #include "menu.h"
  31. #include "video.h"
  32. #include "vesa.h"
  33. #include "unmangle.h"
  34. #include "actua.h"
  35. #include "memory.h"
  36. #include "gamedata.h"
  37. #include "menudata.h"
  38. #include "config.h"
  39. #include "sos.h"
  40. #include "timer.h"
  41. #include "digi.h"
  42. #include "midi.h"
  43. #include "playdam.h" // Structure Definitions for Digital Video
  44. #include "playcall.h" // Call Defininitions for Digital Video
  45. #include "animlink.h"
  46. #include "calldef.h"
  47. #include "memstruc.h"
  48. #include "rothlink.h"
  49. #include "mallocx.h"
  50. #include "euro.equ"
  51. #include "euro_def.h"
  52. #include "euro_var.h"
  53. #include "euro_grf.h"
  54. #include "euro_dsk.h"
  55. #include "euro_fix.h"
  56. #include "euro_sel.h"
  57. #include "euro_inf.h"
  58. #include "euro_cnt.h"
  59. #include "euro_usr.h"
  60. #include "euro_net.h"
  61. #define GDV_MEM 512*1024
  62. #define GDV_ABORT 0x01
  63. #define GDV_LOOP 0x08
  64. #define DEFAULT_FADEIN 0
  65. #define DEFAULT_FADEOUT 0
  66. #define DEFAULT_DELAYEXIT 25
  67. extern "C" volatile int count;
  68. extern int testVESA;
  69. extern int VESAmode(int *);
  70. extern int gdv_gran;
  71. extern "C" volatile char keys[256];
  72. extern char return_doskey;
  73. extern BYTE palette_buffer[];
  74. extern BYTE work_buffer[768];
  75. extern ModeInfoBlock *vmode_inf;
  76. char out;
  77. BYTE presents[]={
  78. 0x3F,0x33,0x00,0x3F,0x33,0x0C,0x3F,0x33,0x19,0x3F,0x3F,0x26,
  79. };
  80. //---------------------------------------------------
  81. long int GDVCallbackRoutine(long int mode,void *header,void *data,short int frame)
  82. //---------------------------------------------------
  83. //
  84. // Callback generated by GDV player.
  85. // Test for abort GDV.
  86. //---------------------------------------------------
  87. {
  88. out = NULL;
  89. if (mode == CBM_LookForAbort)
  90. {
  91. ReadMouseData(0);
  92. for (int i=1; i<255; i++)
  93. {
  94. if (keys[i])
  95. out = 1;
  96. }
  97. if (MouseBUTTONS & 3)
  98. out = 1;
  99. if (out!=NULL)
  100. return(CBX_Abort);
  101. }
  102. return(CBX_Normal);
  103. }
  104. //---------------------------------------------------
  105. void PlayGDV()
  106. //---------------------------------------------------
  107. //
  108. // Play a GDV using an Anim structure
  109. //---------------------------------------------------
  110. {
  111. char file[128];
  112. unsigned char *mem;
  113. unsigned long int Error;
  114. _PlayAnimBlock PlayBlock = { 0 };
  115. mem=(unsigned char *)mallocx(GDV_MEM); // allocate mem for player
  116. if (mem == 0)
  117. return;
  118. memset( mem, 0, GDV_MEM );
  119. strcpy (file, EuroGDVfile);
  120. PlayBlock.FileName = &file[0];
  121. PlayBlock.Flags = NULL;
  122. PlayBlock.Screen = 0x110;
  123. PlayBlock.ScreenXSize = 640;
  124. PlayBlock.ScreenYSize = 480;
  125. PlayBlock.ScreenGran = 0;
  126. if (SoundCard==0)
  127. PlayBlock.Flags|= PAF_NoAudio;
  128. PlayBlock.CallBack = &GDVCallbackRoutine;
  129. PlayBlock.DrvPath="DIGI\\";
  130. PlayBlock.MemBlock=mem;
  131. PlayBlock.MemBlockSize=GDV_MEM;
  132. if (SoundCard==0)
  133. PlayBlock.Flags|= PAF_NoAudio;
  134. else
  135. PlayBlock.DIGIHandle_SOS=DIGIDriverHandle;
  136. PlayBlock.DriveCap_SOS=&DIGICapabilities;
  137. PlayBlock.SNDID=SoundCard;
  138. PlayBlock.SNDPort=SoundPort;
  139. PlayBlock.SNDIRQ=SoundIRQ;
  140. PlayBlock.SNDDMA=SoundDMA;
  141. PlayBlock.SNDPara=0;
  142. if(!(Error=InitAnim(&PlayBlock)))
  143. {
  144. Error=StartAnim(&PlayBlock);
  145. CloseAnim(&PlayBlock);
  146. }
  147. freex(mem);
  148. }
  149. //------------------------------------------------------
  150. // PlaySample routines to link with Tony's ROTH sample stuff!
  151. //------------------------------------------------------
  152. extern WORD PlaySample (_SOS_START_SAMPLE *mysample, void (far cdecl*callback)(WORD,WORD,WORD))
  153. {
  154. mysample->lpCallback=(void cdecl (far*)(WORD,WORD,WORD))callback;
  155. return (sosDIGIStartSample( DIGIDriverHandle, mysample));
  156. } /* PlaySample */
  157. extern WORD StopPlaySample (WORD handle)
  158. {
  159. return (sosDIGIStopSample( DIGIDriverHandle, handle));
  160. }
  161. extern WORD ChangeSampleVol (WORD handle,int vol)
  162. {
  163. return (sosDIGISetSampleVolume( DIGIDriverHandle, handle,vol));
  164. }
  165. extern WORD ChangeSamplePan (WORD handle,int pan)
  166. {
  167. return (sosDIGISetPanLocation( DIGIDriverHandle, handle,pan));
  168. }