3DENG.H 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. /********************************************************/
  2. /* 3D ENGINE - Header File 17/01/95 */
  3. /********************************************************/
  4. #ifndef _3DENG_H_
  5. #define _3DENG_H_
  6. /**************/
  7. /* DATA TYPES */
  8. //Data size definitions
  9. //use these as often as possible
  10. typedef signed char byte;
  11. typedef signed short word;
  12. typedef signed int dword;
  13. #ifndef BYTE
  14. typedef unsigned char BYTE;
  15. #endif
  16. /*
  17. #ifndef WORD
  18. typedef unsigned short WORD;
  19. #endif
  20. #ifndef DWORD
  21. typedef unsigned int DWORD;
  22. #endif
  23. */
  24. typedef float floatpt;
  25. // Types used through 3D pipeline
  26. typedef floatpt datapt;
  27. typedef floatpt rotpt;
  28. typedef dword scrpt;
  29. // Word / Byte union
  30. typedef union
  31. {
  32. struct {byte low,hiw;} d;
  33. word c;
  34. }
  35. dchar_u;
  36. // DoubleWord / Word union
  37. typedef union
  38. {
  39. struct {word low,hiw;} d;
  40. dword dw;
  41. }
  42. dword_u;
  43. /**************/
  44. /* MATH TYPES */
  45. // General matrix type
  46. typedef floatpt mat[4][4];
  47. // Rotation matrix type (explicit for speed).
  48. typedef union
  49. {
  50. mat arr;
  51. struct
  52. {
  53. floatpt r00,r01,r02,r03;
  54. floatpt r10,r11,r12,r13;
  55. floatpt r20,r21,r22,r23;
  56. }e;
  57. }
  58. qmat;
  59. /*********************/
  60. /* 3D GEOMETRY TYPES */
  61. // 3D point & point-list types
  62. typedef datapt *pt;
  63. typedef datapt ptlist[];
  64. // Face & face-list types
  65. typedef word *face;
  66. typedef word facelist[];
  67. // Rotated point type
  68. typedef rotpt *rpt;
  69. /*********************/
  70. /* 2D GEOMETRY TYPES */
  71. // Screen point type
  72. typedef struct
  73. {
  74. scrpt x,y;
  75. }
  76. pnt;
  77. // Gourad screen point type
  78. typedef struct
  79. {
  80. scrpt x,y,col;
  81. }
  82. ppnt;
  83. // Screen point with z type (Bi-Quadratic mapping)
  84. typedef struct
  85. {
  86. scrpt z,x,y;
  87. }
  88. zpnt;
  89. // Screen polygon type (with average z for sort)
  90. typedef struct
  91. {
  92. rotpt z;
  93. scrpt *pts;
  94. }
  95. pols;
  96. /****************/
  97. /* OBJECT TYPES */
  98. // Object type
  99. typedef struct
  100. {
  101. pt points;
  102. face faces;
  103. datapt x,y,z;
  104. floatpt crot,srot;
  105. }
  106. obj;
  107. // Object list type
  108. typedef struct
  109. {
  110. rotpt z;
  111. pols *polys;
  112. short nopols;
  113. }
  114. objs;
  115. // Object detail level type
  116. typedef struct
  117. {
  118. rotpt zscale; // min z/q for this detail level
  119. pt dpoints;
  120. face dfaces;
  121. }
  122. det;
  123. // Object detail level list
  124. typedef det detlist[];
  125. /*****************/
  126. /* SURFACE TYPES */
  127. // Texture type
  128. typedef dword texture[8]; // Assumes 4 pt textures, other nos of pts are padded out
  129. // Polygon filter type
  130. typedef BYTE filter[256];
  131. /************************/
  132. /* MOTION CAPTURE TYPES */
  133. // Specific for players only
  134. #define PLYRPTS 28
  135. typedef datapt capfrm[PLYRPTS*3+1];
  136. typedef struct
  137. {
  138. word cappts,capfrms;
  139. } mcap;
  140. /*********************/
  141. /* PLAYER INFO TYPES */
  142. typedef struct
  143. {
  144. floatpt x,y,z,crot,srot,frame,fstep;
  145. short type,number,anim,sprite;
  146. BYTE htype,hcol;
  147. } plyrdat;
  148. typedef struct
  149. {
  150. datapt *twnfrm;
  151. capfrm twnpts1,twnpts2;
  152. floatpt tween,tstep;
  153. short anim,animto;
  154. } plyrtwdat;
  155. /**************/
  156. /* MISC TYPES */
  157. typedef struct
  158. {
  159. short sky;
  160. short stadia;
  161. short pitch;
  162. short players;
  163. short lines;
  164. short shadows;
  165. }
  166. detail_info;
  167. // Setup data type
  168. typedef struct
  169. {
  170. short M8;
  171. short team_a,team_b;
  172. short team_b_kit;
  173. short stadium;
  174. short vidi_type;
  175. short start_res;
  176. short screen_size;
  177. short verbose;
  178. detail_info detail;
  179. }
  180. setup_info;
  181. // Screen buffer info type
  182. typedef struct
  183. {
  184. BYTE *buff_start;
  185. scrpt buff_wid,buff_hgt;
  186. scrpt clip_wid,clip_hgt;
  187. float scale_x,scale_y;
  188. void (*dump)(scrpt dispx,scrpt dispy);
  189. }
  190. buff_info;
  191. // Extended screen buffer info type
  192. typedef struct
  193. {
  194. BYTE *buff_start;
  195. BYTE *clip_end,*clip_endl;
  196. scrpt buff_wid,buff_hgt;
  197. scrpt clip_wid,clip_hgt,clip_widl,clip_hgtl;
  198. scrpt clip_xmid,clip_ymid;
  199. float scale_x,scale_y;
  200. void (*dump)(scrpt dispx,scrpt dispy);
  201. }
  202. buff_info_ext;
  203. typedef struct {
  204. int pitchfile,pitchpfile;
  205. char skytypes[2];
  206. int tmdfile;
  207. int sb1file,sb2file;
  208. datapt s1x,s1y,s1z;
  209. int s1pfile,s1ffile;
  210. datapt s2x,s2y,s2z;
  211. int s2pfile,s2ffile;
  212. datapt s3x,s3y,s3z;
  213. int s3pfile,s3ffile;
  214. datapt s4x,s4y,s4z;
  215. int s4pfile,s4ffile;
  216. int st_w,st_l,st_h;
  217. short noloop;
  218. int loop[20];
  219. int vid1x,vid1y,vid1z;
  220. int vid2x,vid2y,vid2z;
  221. int tunlx,tunly,tunlz;
  222. int vmap;
  223. }
  224. stad_info;
  225. typedef struct {
  226. int headfile;
  227. int torsofile;
  228. int limbsfile;
  229. int nosfile;
  230. int palfile;
  231. int skinfile;
  232. int homepfile;
  233. int awaypfile;
  234. }
  235. teamk_info;
  236. /***********************/
  237. /* FUNCTION PROTOTYPES */
  238. int init3d();
  239. void setscreen();
  240. void end3d();
  241. void render3d(buff_info *buffer,datapt viewx,datapt viewy,datapt viewz,datapt targx,datapt targy,
  242. datapt targz,datapt vdist,plyrdat *plyrtb,datapt *xyz_ptr,word *ref_ptr);
  243. #endif
  244.