Subversion Repositories Games.Descent

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Portions of this file are copyright Rebirth contributors and licensed as
  3.  * described in COPYING.txt.
  4.  * Portions of this file are copyright Parallax Software and licensed
  5.  * according to the Parallax license below.
  6.  * See COPYING.txt for license details.
  7.  
  8. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  9. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  10. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  11. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  12. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  13. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  14. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  15. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  16. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
  17. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  18. */
  19.  
  20. /*
  21.  *
  22.  * Header for gamemine.c
  23.  *
  24.  */
  25.  
  26. #pragma once
  27.  
  28. #include <physfs.h>
  29. #include "fwd-segment.h"
  30. #include "maths.h"
  31.  
  32. #define TMAP_NUM_MASK 0x3FFF
  33.  
  34. #ifdef __cplusplus
  35.  
  36. #if defined(DXX_BUILD_DESCENT_I)
  37. #define MINE_VERSION                                    17      // Current version expected
  38. #elif defined(DXX_BUILD_DESCENT_II)
  39. #define MINE_VERSION        20  // Current version expected
  40. #include "vecmat.h"
  41. #endif
  42. #define COMPATIBLE_VERSION  16  // Oldest version that can safely be loaded.
  43.  
  44. #if DXX_USE_EDITOR
  45. struct mtfi {
  46.         ushort  fileinfo_signature;
  47.         ushort  fileinfo_version;
  48.         int     fileinfo_sizeof;
  49. };    // Should be same as first two fields below...
  50.  
  51. #if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
  52. struct mfi {
  53.         ushort  fileinfo_signature;
  54.         ushort  fileinfo_version;
  55.         int     fileinfo_sizeof;
  56.         int     header_offset;      // Stuff common to game & editor
  57.         int     header_size;
  58.         int     editor_offset;      // Editor specific stuff
  59.         int     editor_size;
  60.         int     segment_offset;
  61.         int     segment_howmany;
  62.         int     segment_sizeof;
  63.         int     newseg_verts_offset;
  64.         int     newseg_verts_howmany;
  65.         int     newseg_verts_sizeof;
  66.         int     group_offset;
  67.         int     group_howmany;
  68.         int     group_sizeof;
  69.         int     vertex_offset;
  70.         unsigned vertex_howmany;
  71.         int     vertex_sizeof;
  72.         int     texture_offset;
  73.         uint32_t texture_howmany;
  74.         int     texture_sizeof;
  75.         int     walls_offset;
  76.         int     walls_howmany;
  77.         int     walls_sizeof;
  78.         int     triggers_offset;
  79.         int     triggers_howmany;
  80.         int     triggers_sizeof;
  81.         int     links_offset;
  82.         int     links_howmany;
  83.         int     links_sizeof;
  84.         int     object_offset;      // Object info
  85.         int     object_howmany;
  86.         int     object_sizeof;
  87.         int     unused_offset;      // was: doors_offset
  88.         int     unused_howmamy;     // was: doors_howmany
  89.         int     unused_sizeof;      // was: doors_sizeof
  90. #if defined(DXX_BUILD_DESCENT_II)
  91.         short   level_shake_frequency, level_shake_duration;
  92.         // Shakes every level_shake_frequency seconds
  93.         // for level_shake_duration seconds (on average, random).  In 16ths second.
  94.         int     secret_return_segment;
  95.         vms_matrix secret_return_orient;
  96.  
  97.         int     dl_indices_offset;
  98.         int     dl_indices_howmany;
  99.         int     dl_indices_sizeof;
  100.  
  101.         int     delta_light_offset;
  102.         int     delta_light_howmany;
  103.         int     delta_light_sizeof;
  104.  
  105.         int     segment2_offset;
  106.         int     segment2_howmany;
  107.         int     segment2_sizeof;
  108. #endif
  109. };
  110. #endif
  111. #endif // EDITOR
  112.  
  113. struct mh {
  114.         int num_vertices;
  115.         int num_segments;
  116. };
  117.  
  118. struct me {
  119.         int current_seg;
  120.         int newsegment_offset;
  121.         int newsegment_size;
  122.         int Curside;
  123.         int Markedsegp;
  124.         int Markedside;
  125.         int Groupsegp[10];
  126.         int Groupside[10];
  127.         int num_groups;
  128.         int current_group;
  129.         //int num_objects;
  130. };
  131.  
  132. extern struct mtfi mine_top_fileinfo;   // Should be same as first two fields below...
  133. extern struct mfi mine_fileinfo;
  134. extern struct mh mine_header;
  135. extern struct me mine_editor;
  136.  
  137. // loads from an already-open file
  138. // returns 0=everything ok, 1=old version, -1=error
  139. #ifdef dsx
  140. namespace dsx {
  141. int load_mine_data(PHYSFS_File *LoadFile);
  142. int load_mine_data_compiled(PHYSFS_File *LoadFile, const char *Gamesave_current_filename);
  143.  
  144. }
  145. #endif
  146. #define TMAP_NUM_MASK 0x3FFF
  147.  
  148. #if defined(DXX_BUILD_DESCENT_II)
  149. namespace dsx {
  150. extern int d1_pig_present;
  151.  
  152. /* stuff for loading descent.pig of descent 1 */
  153. extern short convert_d1_tmap_num(short d1_tmap_num);
  154. extern int d1_tmap_num_unique(short d1_tmap_num); //is d1_tmap_num's texture only in d1?
  155. }
  156. #endif
  157.  
  158. #endif
  159.