Debian Codegraph @

common/main/piggy.h

raw
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 * Interface to piggy functions.
23 *
24 */
25
26 #pragma once
27
28 #include <ranges>
29 #include "dsx-ns.h"
30 #include "fwd-inferno.h"
31 #include "fwd-piggy.h"
32 #include "fwd-robot.h"
33 #include "gr.h"
34 #include "physfsx.h"
35
36 #ifdef DXX_BUILD_DESCENT
37 #if DXX_BUILD_DESCENT == 2
38 namespace dsx {
39 struct alias
40 {
41 std::array<char, FILENAME_LEN> alias_name;
42 std::array<char, FILENAME_LEN> file_name;
43 };
44 }
45 #endif
46 #endif
47
48 // an index into the bitmap collection of the piggy file
49 enum class bitmap_index : uint16_t
50 {
51 None = UINT16_MAX
52 };
53
54 namespace dcx {
55 struct BitmapFile
56 {
57 std::array<char, 13> name;
58 };
59
60 /* Both engines need this type. Descent 1 needs it directly. Descent 2 needs
61 * it for the functionality that tries to load Descent 1 data.
62 */
63 enum class descent1_pig_size : PHYSFS_sint64
64 {
65 d1_share_big_pigsize = 5092871, // v1.0 - 1.4 before RLE compression
66 d1_share_10_pigsize = 2529454, // v1.0 - 1.2
67 d1_share_pigsize = 2509799, // v1.4
68 d1_10_big_pigsize = 7640220, // v1.0 before RLE compression
69 d1_10_pigsize = 4520145, // v1.0
70 d1_pigsize = 4920305, // v1.4 - 1.5 (Incl. OEM v1.4a)
71 d1_oem_pigsize = 5039735, // v1.0
72 d1_mac_pigsize = 3975533,
73 d1_mac_share_pigsize = 2714487,
74 };
75
76 }
77
78 #ifdef DXX_BUILD_DESCENT
79 namespace dsx {
80
81 # define PIGGY_PAGE_IN(bmp) _piggy_page_in(GameBitmaps, bmp)
82 static inline void _piggy_page_in(GameBitmaps_array &GameBitmaps, bitmap_index bmp)
83 {
84 if (GameBitmaps[bmp].get_flag_mask(BM_FLAG_PAGED_OUT))
85 piggy_bitmap_page_in(GameBitmaps, bmp);
86 }
87
88 #if DXX_BUILD_DESCENT == 1
89 enum class properties_init_result : int8_t
90 {
91 skip_gamedata_read_tbl,
92 use_gamedata_read_tbl,
93 shareware,
94 };
95 #elif DXX_BUILD_DESCENT == 2
96 enum class properties_init_result : bool
97 {
98 failure,
99 success,
100 };
101 #endif
102
103 properties_init_result properties_init(d_level_shared_robot_info_state &LevelSharedRobotInfoState);
104
105 #if DXX_BUILD_DESCENT == 2
106 enum class pig_hamfile_version : uint8_t
107 {
108 _0,
109 _3 = 3,
110 };
111
112 int read_hamfile(d_level_shared_robot_info_state &LevelSharedRobotInfoState);
113 #endif
114 }
115
116 #endif