Rev 5010 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5010 | Rev 5056 | ||
---|---|---|---|
1 | // "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
1 | // "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
2 | // Ken Silverman's official web site: "http://www.advsys.net/ken"
|
2 | // Ken Silverman's official web site: "http://www.advsys.net/ken"
|
3 | // See the included license file "BUILDLIC.TXT" for license info.
|
3 | // See the included license file "BUILDLIC.TXT" for license info.
|
4 | //
|
4 | //
|
5 | // This file has been modified from Ken Silverman's original release
|
5 | // This file has been modified from Ken Silverman's original release
|
6 | // by Jonathon Fowler (jf@jonof.id.au)
|
6 | // by Jonathon Fowler (jf@jonof.id.au)
|
7 | 7 | ||
8 | 8 | ||
9 | #ifndef build_h_
|
9 | #ifndef build_h_
|
10 | #define build_h_
|
10 | #define build_h_
|
11 | 11 | ||
12 | #include "compat.h"
|
12 | #include "compat.h"
|
13 | #include "pragmas.h"
|
13 | #include "pragmas.h"
|
14 | #include "glbuild.h"
|
14 | #include "glbuild.h"
|
15 | 15 | ||
16 | #ifdef __cplusplus
|
16 | #ifdef __cplusplus
|
17 | extern "C" { |
17 | extern "C" { |
18 | #endif
|
18 | #endif
|
19 | 19 | ||
20 | enum rendmode_t { |
20 | enum rendmode_t { |
21 | REND_CLASSIC, |
21 | REND_CLASSIC, |
22 | REND_POLYMOST = 3, |
22 | REND_POLYMOST = 3, |
23 | REND_POLYMER |
23 | REND_POLYMER |
24 | }; |
24 | }; |
25 | 25 | ||
26 | #define PI 3.14159265358979323846
|
26 | #define PI 3.14159265358979323846
|
27 | 27 | ||
28 | #define MAXSECTORSV8 4096
|
28 | #define MAXSECTORSV8 4096
|
29 | #define MAXWALLSV8 16384
|
29 | #define MAXWALLSV8 16384
|
30 | #define MAXSPRITESV8 16384
|
30 | #define MAXSPRITESV8 16384
|
31 | 31 | ||
32 | #define MAXSECTORSV7 1024
|
32 | #define MAXSECTORSV7 1024
|
33 | #define MAXWALLSV7 8192
|
33 | #define MAXWALLSV7 8192
|
34 | #define MAXSPRITESV7 4096
|
34 | #define MAXSPRITESV7 4096
|
35 | 35 | ||
36 | #ifndef GEKKO
|
36 | #ifndef GEKKO
|
37 | # define MAXSECTORS MAXSECTORSV8
|
37 | # define MAXSECTORS MAXSECTORSV8
|
38 | # define MAXWALLS MAXWALLSV8
|
38 | # define MAXWALLS MAXWALLSV8
|
39 | # define MAXSPRITES MAXSPRITESV8
|
39 | # define MAXSPRITES MAXSPRITESV8
|
40 | 40 | ||
41 | # define MAXXDIM 7680
|
41 | # define MAXXDIM 7680
|
42 | # define MAXYDIM 3200
|
42 | # define MAXYDIM 3200
|
43 | 43 | ||
44 | // additional space beyond wall, in walltypes:
|
44 | // additional space beyond wall, in walltypes:
|
45 | # define M32_FIXME_WALLS 512
|
45 | # define M32_FIXME_WALLS 512
|
46 | # define M32_FIXME_SECTORS 2
|
46 | # define M32_FIXME_SECTORS 2
|
47 | #else
|
47 | #else
|
48 | # define MAXSECTORS MAXSECTORSV7
|
48 | # define MAXSECTORS MAXSECTORSV7
|
49 | # define MAXWALLS MAXWALLSV7
|
49 | # define MAXWALLS MAXWALLSV7
|
50 | # define MAXSPRITES MAXSPRITESV7
|
50 | # define MAXSPRITES MAXSPRITESV7
|
51 | 51 | ||
52 | # define MAXXDIM 860
|
52 | # define MAXXDIM 860
|
53 | # define MAXYDIM 490
|
53 | # define MAXYDIM 490
|
54 | 54 | ||
55 | # define M32_FIXME_WALLS 0
|
55 | # define M32_FIXME_WALLS 0
|
56 | # define M32_FIXME_SECTORS 0
|
56 | # define M32_FIXME_SECTORS 0
|
57 | #endif
|
57 | #endif
|
58 | 58 | ||
59 | #ifdef LUNATIC
|
59 | #ifdef LUNATIC
|
60 | # define NEW_MAP_FORMAT
|
60 | # define NEW_MAP_FORMAT
|
61 | // A marker for LuaJIT C function callbacks, but not merely:
|
61 | // A marker for LuaJIT C function callbacks, but not merely:
|
62 | # define LUNATIC_CB ATTRIBUTE((used))
|
62 | # define LUNATIC_CB ATTRIBUTE((used))
|
63 | // Used for variables and functions referenced from Lua:
|
63 | // Used for variables and functions referenced from Lua:
|
64 | # define LUNATIC_EXTERN ATTRIBUTE((used))
|
64 | # define LUNATIC_EXTERN ATTRIBUTE((used))
|
65 | #else
|
65 | #else
|
66 | # ifdef NEW_MAP_FORMAT
|
66 | # ifdef NEW_MAP_FORMAT
|
67 | # error "New map format can only be used with Lunatic"
|
67 | # error "New map format can only be used with Lunatic"
|
68 | # endif
|
68 | # endif
|
69 | # define LUNATIC_EXTERN static
|
69 | # define LUNATIC_EXTERN static
|
70 | #endif
|
70 | #endif
|
71 | 71 | ||
72 | #define MAXWALLSB ((MAXWALLS>>2)+(MAXWALLS>>3))
|
72 | #define MAXWALLSB ((MAXWALLS>>2)+(MAXWALLS>>3))
|
73 | 73 | ||
74 | #define MAXTILES 30720
|
74 | #define MAXTILES 30720
|
75 | #define MAXUSERTILES (MAXTILES-16) // reserve 16 tiles at the end
|
75 | #define MAXUSERTILES (MAXTILES-16) // reserve 16 tiles at the end
|
76 | 76 | ||
77 | #define MAXVOXELS 4096
|
77 | #define MAXVOXELS 4096
|
78 | #define MAXSTATUS 1024
|
78 | #define MAXSTATUS 1024
|
79 | #define MAXPLAYERS 16
|
79 | #define MAXPLAYERS 16
|
80 | #define MAXBASEPALS 8
|
80 | #define MAXBASEPALS 8
|
81 | #define MAXPALOOKUPS 256
|
81 | #define MAXPALOOKUPS 256
|
82 | #define MAXBLENDTABS 256
|
82 | #define MAXBLENDTABS 256
|
83 | // Maximum number of defined multi-pskies:
|
83 | // Maximum number of defined multi-pskies:
|
84 | #define MAXPSKYMULTIS 8
|
84 | #define MAXPSKYMULTIS 8
|
85 | // Maximum number of component tiles in a multi-psky:
|
85 | // Maximum number of component tiles in a multi-psky:
|
86 | #define MAXPSKYTILES 8
|
86 | #define MAXPSKYTILES 8
|
87 | #define MAXSPRITESONSCREEN 4096
|
87 | #define MAXSPRITESONSCREEN 4096
|
88 | #define MAXUNIQHUDID 256 //Extra slots so HUD models can store animation state without messing game sprites
|
88 | #define MAXUNIQHUDID 256 //Extra slots so HUD models can store animation state without messing game sprites
|
89 | 89 | ||
90 | #define RESERVEDPALS 4 // don't forget to increment this when adding reserved pals
|
90 | #define RESERVEDPALS 4 // don't forget to increment this when adding reserved pals
|
91 | #define DETAILPAL (MAXPALOOKUPS - 1)
|
91 | #define DETAILPAL (MAXPALOOKUPS - 1)
|
92 | #define GLOWPAL (MAXPALOOKUPS - 2)
|
92 | #define GLOWPAL (MAXPALOOKUPS - 2)
|
93 | #define SPECULARPAL (MAXPALOOKUPS - 3)
|
93 | #define SPECULARPAL (MAXPALOOKUPS - 3)
|
94 | #define NORMALPAL (MAXPALOOKUPS - 4)
|
94 | #define NORMALPAL (MAXPALOOKUPS - 4)
|
95 | 95 | ||
96 | #define TSPR_TEMP 99
|
96 | #define TSPR_TEMP 99
|
97 | 97 | ||
98 | #define PR_LIGHT_PRIO_MAX 0
|
98 | #define PR_LIGHT_PRIO_MAX 0
|
99 | #define PR_LIGHT_PRIO_MAX_GAME 1
|
99 | #define PR_LIGHT_PRIO_MAX_GAME 1
|
100 | #define PR_LIGHT_PRIO_HIGH 2
|
100 | #define PR_LIGHT_PRIO_HIGH 2
|
101 | #define PR_LIGHT_PRIO_HIGH_GAME 3
|
101 | #define PR_LIGHT_PRIO_HIGH_GAME 3
|
102 | #define PR_LIGHT_PRIO_LOW 4
|
102 | #define PR_LIGHT_PRIO_LOW 4
|
103 | #define PR_LIGHT_PRIO_LOW_GAME 5
|
103 | #define PR_LIGHT_PRIO_LOW_GAME 5
|
104 | 104 | ||
105 | // Convenient sprite iterators, must not be used if any sprites inside the loop
|
105 | // Convenient sprite iterators, must not be used if any sprites inside the loop
|
106 | // are potentially deleted or their sector changed...
|
106 | // are potentially deleted or their sector changed...
|
107 | #define SPRITES_OF(Statnum, Iter) Iter=headspritestat[Statnum]; Iter>=0; Iter=nextspritestat[Iter]
|
107 | #define SPRITES_OF(Statnum, Iter) Iter=headspritestat[Statnum]; Iter>=0; Iter=nextspritestat[Iter]
|
108 | #define SPRITES_OF_SECT(Sectnum, Iter) Iter=headspritesect[Sectnum]; Iter>=0; Iter=nextspritesect[Iter]
|
108 | #define SPRITES_OF_SECT(Sectnum, Iter) Iter=headspritesect[Sectnum]; Iter>=0; Iter=nextspritesect[Iter]
|
109 | // ... in which case this iterator may be used:
|
109 | // ... in which case this iterator may be used:
|
110 | #define SPRITES_OF_SECT_SAFE(Sectnum, Iter, Next) Iter=headspritesect[Sectnum]; \
|
110 | #define SPRITES_OF_SECT_SAFE(Sectnum, Iter, Next) Iter=headspritesect[Sectnum]; \
|
111 | Iter>=0 && (Next=nextspritesect[Iter], 1); Iter=Next
|
111 | Iter>=0 && (Next=nextspritesect[Iter], 1); Iter=Next
|
112 | #define SPRITES_OF_STAT_SAFE(Statnum, Iter, Next) Iter=headspritestat[Statnum]; \
|
112 | #define SPRITES_OF_STAT_SAFE(Statnum, Iter, Next) Iter=headspritestat[Statnum]; \
|
113 | Iter>=0 && (Next=nextspritestat[Iter], 1); Iter=Next
|
113 | Iter>=0 && (Next=nextspritestat[Iter], 1); Iter=Next
|
114 | 114 | ||
115 | #define CLEARLINES2D(Startline, Numlines, Color) \
|
115 | #define CLEARLINES2D(Startline, Numlines, Color) \
|
116 | clearbuf((char *)(frameplace + ((Startline)*bytesperline)), (bytesperline*(Numlines))>>2, (Color))
|
116 | clearbuf((char *)(frameplace + ((Startline)*bytesperline)), (bytesperline*(Numlines))>>2, (Color))
|
117 | 117 | ||
118 | 118 | ||
119 | ////////// True Room over Room (YAX == rot -17 of "PRO") //////////
|
119 | ////////// True Room over Room (YAX == rot -17 of "PRO") //////////
|
120 | #define YAX_ENABLE
|
120 | #define YAX_ENABLE
|
121 | //#define YAX_DEBUG
|
121 | //#define YAX_DEBUG
|
122 | //#define ENGINE_SCREENSHOT_DEBUG
|
122 | //#define ENGINE_SCREENSHOT_DEBUG
|
123 | 123 | ||
124 | #ifdef YAX_ENABLE
|
124 | #ifdef YAX_ENABLE
|
125 | # if !defined NEW_MAP_FORMAT
|
125 | # if !defined NEW_MAP_FORMAT
|
126 | # define YAX_ENABLE__COMPAT
|
126 | # define YAX_ENABLE__COMPAT
|
127 | # endif
|
127 | # endif
|
128 | #endif
|
128 | #endif
|
129 | 129 | ||
130 | ////////// yax defs //////////
|
130 | ////////// yax defs //////////
|
131 | #define SECTORFLD(Sect,Fld, Cf) (*((Cf) ? (§or[Sect].floor##Fld) : (§or[Sect].ceiling##Fld)))
|
131 | #define SECTORFLD(Sect,Fld, Cf) (*((Cf) ? (§or[Sect].floor##Fld) : (§or[Sect].ceiling##Fld)))
|
132 | 132 | ||
133 | #define YAX_CEILING 0 // don't change!
|
133 | #define YAX_CEILING 0 // don't change!
|
134 | #define YAX_FLOOR 1 // don't change!
|
134 | #define YAX_FLOOR 1 // don't change!
|
135 | 135 | ||
136 | # ifdef NEW_MAP_FORMAT
|
136 | # ifdef NEW_MAP_FORMAT
|
137 | # define YAX_MAXBUNCHES 512
|
137 | # define YAX_MAXBUNCHES 512
|
138 | # define YAX_BIT__COMPAT 1024
|
138 | # define YAX_BIT__COMPAT 1024
|
139 | # define YAX_NEXTWALLBIT__COMPAT(Cf) (1<<(10+Cf))
|
139 | # define YAX_NEXTWALLBIT__COMPAT(Cf) (1<<(10+Cf))
|
140 | # define YAX_NEXTWALLBITS__COMPAT (YAX_NEXTWALLBIT__COMPAT(0)|YAX_NEXTWALLBIT__COMPAT(1))
|
140 | # define YAX_NEXTWALLBITS__COMPAT (YAX_NEXTWALLBIT__COMPAT(0)|YAX_NEXTWALLBIT__COMPAT(1))
|
141 | # else
|
141 | # else
|
142 | # define YAX_MAXBUNCHES 256
|
142 | # define YAX_MAXBUNCHES 256
|
143 | # define YAX_BIT 1024
|
143 | # define YAX_BIT 1024
|
144 | // "has next wall when constrained"-bit (1<<10: ceiling, 1<<11: floor)
|
144 | // "has next wall when constrained"-bit (1<<10: ceiling, 1<<11: floor)
|
145 | # define YAX_NEXTWALLBIT(Cf) (1<<(10+Cf))
|
145 | # define YAX_NEXTWALLBIT(Cf) (1<<(10+Cf))
|
146 | # define YAX_NEXTWALLBITS (YAX_NEXTWALLBIT(0)|YAX_NEXTWALLBIT(1))
|
146 | # define YAX_NEXTWALLBITS (YAX_NEXTWALLBIT(0)|YAX_NEXTWALLBIT(1))
|
147 | # endif
|
147 | # endif
|
148 | 148 | ||
149 | int32_t get_alwaysshowgray(void); // editor only |
149 | int32_t get_alwaysshowgray(void); // editor only |
150 | void yax_updategrays(int32_t posze); |
150 | void yax_updategrays(int32_t posze); |
151 | 151 | ||
152 | #ifdef YAX_ENABLE
|
152 | #ifdef YAX_ENABLE
|
153 | # ifdef NEW_MAP_FORMAT
|
153 | # ifdef NEW_MAP_FORMAT
|
154 | // New map format -- no hijacking of otherwise used members.
|
154 | // New map format -- no hijacking of otherwise used members.
|
155 | # define YAX_PTRNEXTWALL(Ptr, Wall, Cf) (*(&Ptr[Wall].upwall + Cf))
|
155 | # define YAX_PTRNEXTWALL(Ptr, Wall, Cf) (*(&Ptr[Wall].upwall + Cf))
|
156 | # define YAX_NEXTWALLDEFAULT(Cf) (-1)
|
156 | # define YAX_NEXTWALLDEFAULT(Cf) (-1)
|
157 | # else
|
157 | # else
|
158 | // More user tag hijacking: lotag/extra. :/
|
158 | // More user tag hijacking: lotag/extra. :/
|
159 | # define YAX_PTRNEXTWALL(Ptr, Wall, Cf) (*(int16_t *)(&Ptr[Wall].lotag + 2*Cf))
|
159 | # define YAX_PTRNEXTWALL(Ptr, Wall, Cf) (*(int16_t *)(&Ptr[Wall].lotag + 2*Cf))
|
160 | # define YAX_NEXTWALLDEFAULT(Cf) (((Cf)==YAX_CEILING) ? 0 : -1)
|
160 | # define YAX_NEXTWALLDEFAULT(Cf) (((Cf)==YAX_CEILING) ? 0 : -1)
|
161 | extern int16_t yax_bunchnum[MAXSECTORS][2]; |
161 | extern int16_t yax_bunchnum[MAXSECTORS][2]; |
162 | extern int16_t yax_nextwall[MAXWALLS][2]; |
162 | extern int16_t yax_nextwall[MAXWALLS][2]; |
163 | # endif
|
163 | # endif
|
164 | 164 | ||
165 | # define YAX_NEXTWALL(Wall, Cf) YAX_PTRNEXTWALL(wall, Wall, Cf)
|
165 | # define YAX_NEXTWALL(Wall, Cf) YAX_PTRNEXTWALL(wall, Wall, Cf)
|
166 | 166 | ||
167 | # define YAX_ITER_WALLS(Wal, Itervar, Cfvar) Cfvar=0, Itervar=(Wal); Itervar!=-1; \
|
167 | # define YAX_ITER_WALLS(Wal, Itervar, Cfvar) Cfvar=0, Itervar=(Wal); Itervar!=-1; \
|
168 | Itervar=yax_getnextwall(Itervar, Cfvar), \
|
168 | Itervar=yax_getnextwall(Itervar, Cfvar), \
|
169 | (void)(Itervar==-1 && Cfvar==0 && (Cfvar=1) && (Itervar=yax_getnextwall((Wal), Cfvar)))
|
169 | (void)(Itervar==-1 && Cfvar==0 && (Cfvar=1) && (Itervar=yax_getnextwall((Wal), Cfvar)))
|
170 | 170 | ||
171 | # define SECTORS_OF_BUNCH(Bunchnum, Cf, Itervar) Itervar = headsectbunch[Cf][Bunchnum]; \
|
171 | # define SECTORS_OF_BUNCH(Bunchnum, Cf, Itervar) Itervar = headsectbunch[Cf][Bunchnum]; \
|
172 | Itervar != -1; Itervar = nextsectbunch[Cf][Itervar]
|
172 | Itervar != -1; Itervar = nextsectbunch[Cf][Itervar]
|
173 | 173 | ||
174 | extern int32_t r_tror_nomaskpass; |
174 | extern int32_t r_tror_nomaskpass; |
175 | 175 | ||
176 | # ifdef NEW_MAP_FORMAT
|
176 | # ifdef NEW_MAP_FORMAT
|
177 | // Moved below declarations of sector, wall, sprite.
|
177 | // Moved below declarations of sector, wall, sprite.
|
178 | # else
|
178 | # else
|
179 | int16_t yax_getbunch(int16_t i, int16_t cf); |
179 | int16_t yax_getbunch(int16_t i, int16_t cf); |
180 | FORCE_INLINE void yax_getbunches(int16_t i, int16_t *cb, int16_t *fb) |
180 | FORCE_INLINE void yax_getbunches(int16_t i, int16_t *cb, int16_t *fb) |
181 | {
|
181 | {
|
182 | *cb = yax_getbunch(i, YAX_CEILING); |
182 | *cb = yax_getbunch(i, YAX_CEILING); |
183 | *fb = yax_getbunch(i, YAX_FLOOR); |
183 | *fb = yax_getbunch(i, YAX_FLOOR); |
184 | }
|
184 | }
|
185 | int16_t yax_getnextwall(int16_t wal, int16_t cf); |
185 | int16_t yax_getnextwall(int16_t wal, int16_t cf); |
186 | void yax_setnextwall(int16_t wal, int16_t cf, int16_t thenextwall); |
186 | void yax_setnextwall(int16_t wal, int16_t cf, int16_t thenextwall); |
187 | # endif
|
187 | # endif
|
188 | 188 | ||
189 | void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum); |
189 | void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum); |
190 | void yax_setbunches(int16_t i, int16_t cb, int16_t fb); |
190 | void yax_setbunches(int16_t i, int16_t cb, int16_t fb); |
191 | int16_t yax_vnextsec(int16_t line, int16_t cf); |
191 | int16_t yax_vnextsec(int16_t line, int16_t cf); |
192 | void yax_update(int32_t resetstat); |
192 | void yax_update(int32_t resetstat); |
193 | int32_t yax_getneighborsect(int32_t x, int32_t y, int32_t sectnum, int32_t cf); |
193 | int32_t yax_getneighborsect(int32_t x, int32_t y, int32_t sectnum, int32_t cf); |
194 | 194 | ||
195 | FORCE_INLINE int32_t yax_waltosecmask(int32_t walclipmask) |
195 | FORCE_INLINE int32_t yax_waltosecmask(int32_t walclipmask) |
196 | {
|
196 | {
|
197 | // blocking: walstat&1 --> secstat&512
|
197 | // blocking: walstat&1 --> secstat&512
|
198 | // hitscan: walstat&64 --> secstat&2048
|
198 | // hitscan: walstat&64 --> secstat&2048
|
199 | return ((walclipmask&1)<<9) | ((walclipmask&64)<<5); |
199 | return ((walclipmask&1)<<9) | ((walclipmask&64)<<5); |
200 | }
|
200 | }
|
201 | void yax_preparedrawrooms(void); |
201 | void yax_preparedrawrooms(void); |
202 | void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), |
202 | void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), |
203 | int16_t sectnum, int32_t didmirror, int32_t smoothr); |
203 | int16_t sectnum, int32_t didmirror, int32_t smoothr); |
204 | # define YAX_SKIPSECTOR(i) if (graysectbitmap[(i)>>3]&(1<<((i)&7))) continue
|
204 | # define YAX_SKIPSECTOR(i) if (graysectbitmap[(i)>>3]&(1<<((i)&7))) continue
|
205 | # define YAX_SKIPWALL(i) if (graywallbitmap[(i)>>3]&(1<<((i)&7))) continue
|
205 | # define YAX_SKIPWALL(i) if (graywallbitmap[(i)>>3]&(1<<((i)&7))) continue
|
206 | #else
|
206 | #else
|
207 | # define yax_preparedrawrooms()
|
207 | # define yax_preparedrawrooms()
|
208 | # define yax_drawrooms(SpriteAnimFunc, sectnum, didmirror, smoothr)
|
208 | # define yax_drawrooms(SpriteAnimFunc, sectnum, didmirror, smoothr)
|
209 | # define YAX_SKIPSECTOR(i) (i)=(i)
|
209 | # define YAX_SKIPSECTOR(i) (i)=(i)
|
210 | # define YAX_SKIPWALL(i) (i)=(i)
|
210 | # define YAX_SKIPWALL(i) (i)=(i)
|
211 | #endif
|
211 | #endif
|
212 | 212 | ||
213 | #define CLIPMASK0 (((1L)<<16)+1L)
|
213 | #define CLIPMASK0 (((1L)<<16)+1L)
|
214 | #define CLIPMASK1 (((256L)<<16)+64L)
|
214 | #define CLIPMASK1 (((256L)<<16)+64L)
|
215 | 215 | ||
216 | // max x/y val (= max editorgridextent in Mapster32)
|
216 | // max x/y val (= max editorgridextent in Mapster32)
|
217 | #define BXY_MAX 524288
|
217 | #define BXY_MAX 524288
|
218 | 218 | ||
219 | // rotatesprite 'orientation' (actually much more) bits
|
219 | // rotatesprite 'orientation' (actually much more) bits
|
220 | enum { |
220 | enum { |
221 | RS_TRANS1 = 1, |
221 | RS_TRANS1 = 1, |
222 | RS_AUTO = 2, |
222 | RS_AUTO = 2, |
223 | RS_YFLIP = 4, |
223 | RS_YFLIP = 4, |
224 | RS_NOCLIP = 8, |
224 | RS_NOCLIP = 8, |
225 | RS_TOPLEFT = 16, |
225 | RS_TOPLEFT = 16, |
226 | RS_TRANS2 = 32, |
226 | RS_TRANS2 = 32, |
227 | RS_NOMASK = 64, |
227 | RS_NOMASK = 64, |
228 | RS_PERM = 128, |
228 | RS_PERM = 128, |
229 | 229 | ||
230 | RS_ALIGN_L = 256, |
230 | RS_ALIGN_L = 256, |
231 | RS_ALIGN_R = 512, |
231 | RS_ALIGN_R = 512, |
232 | RS_ALIGN_MASK = 768, |
232 | RS_ALIGN_MASK = 768, |
233 | RS_STRETCH = 1024, |
233 | RS_STRETCH = 1024, |
234 | 234 | ||
235 | ROTATESPRITE_FULL16 = 2048, |
235 | ROTATESPRITE_FULL16 = 2048, |
236 | // ROTATESPRITE_MAX-1 is the mask of all externally available orientation bits
|
236 | // ROTATESPRITE_MAX-1 is the mask of all externally available orientation bits
|
237 | ROTATESPRITE_MAX = 4096, |
237 | ROTATESPRITE_MAX = 4096, |
238 | 238 | ||
239 | RS_CENTERORIGIN = (1<<30), |
239 | RS_CENTERORIGIN = (1<<30), |
240 | }; |
240 | }; |
241 | 241 | ||
242 | //Make all variables in BUILD.H defined in the ENGINE,
|
242 | //Make all variables in BUILD.H defined in the ENGINE,
|
243 | //and externed in GAME
|
243 | //and externed in GAME
|
244 | #ifdef ENGINE
|
244 | #ifdef ENGINE
|
245 | # define EXTERN
|
245 | # define EXTERN
|
246 | #else
|
246 | #else
|
247 | # define EXTERN extern
|
247 | # define EXTERN extern
|
248 | #endif
|
248 | #endif
|
249 | 249 | ||
250 | #ifdef __cplusplus
|
250 | #ifdef __cplusplus
|
251 | 251 | ||
252 | FORCE_INLINE void sector_tracker_hook(uintptr_t address); |
252 | FORCE_INLINE void sector_tracker_hook(uintptr_t address); |
253 | FORCE_INLINE void wall_tracker_hook(uintptr_t address); |
253 | FORCE_INLINE void wall_tracker_hook(uintptr_t address); |
254 | FORCE_INLINE void sprite_tracker_hook(uintptr_t address); |
254 | FORCE_INLINE void sprite_tracker_hook(uintptr_t address); |
255 | 255 | ||
256 | }
|
256 | }
|
257 | 257 | ||
258 | #define TRACKER_NAME_ SectorTracker
|
258 | #define TRACKER_NAME_ SectorTracker
|
259 | #define TRACKER_GLOBAL_HOOK_ sector_tracker_hook
|
259 | #define TRACKER_GLOBAL_HOOK_ sector_tracker_hook
|
260 | #include "tracker.hpp"
|
260 | #include "tracker.hpp"
|
261 | #undef TRACKER_NAME_
|
261 | #undef TRACKER_NAME_
|
262 | #undef TRACKER_GLOBAL_HOOK_
|
262 | #undef TRACKER_GLOBAL_HOOK_
|
263 | 263 | ||
264 | #define TRACKER_NAME_ WallTracker
|
264 | #define TRACKER_NAME_ WallTracker
|
265 | #define TRACKER_GLOBAL_HOOK_ wall_tracker_hook
|
265 | #define TRACKER_GLOBAL_HOOK_ wall_tracker_hook
|
266 | #include "tracker.hpp"
|
266 | #include "tracker.hpp"
|
267 | #undef TRACKER_NAME_
|
267 | #undef TRACKER_NAME_
|
268 | #undef TRACKER_GLOBAL_HOOK_
|
268 | #undef TRACKER_GLOBAL_HOOK_
|
269 | 269 | ||
270 | #define TRACKER_NAME_ SpriteTracker
|
270 | #define TRACKER_NAME_ SpriteTracker
|
271 | #define TRACKER_GLOBAL_HOOK_ sprite_tracker_hook
|
271 | #define TRACKER_GLOBAL_HOOK_ sprite_tracker_hook
|
272 | #include "tracker.hpp"
|
272 | #include "tracker.hpp"
|
273 | #undef TRACKER_NAME_
|
273 | #undef TRACKER_NAME_
|
274 | #undef TRACKER_GLOBAL_HOOK_
|
274 | #undef TRACKER_GLOBAL_HOOK_
|
275 | 275 | ||
276 | #define Tracker(Container, Type) Container##Tracker<Type>
|
276 | #define Tracker(Container, Type) Container##Tracker<Type>
|
277 | #define TrackerCast(x) x.cast()
|
277 | #define TrackerCast(x) x.cast()
|
278 | 278 | ||
279 | extern "C" { |
279 | extern "C" { |
280 | 280 | ||
281 | #else
|
281 | #else
|
282 | 282 | ||
283 | #define Tracker(Container, Type) Type
|
283 | #define Tracker(Container, Type) Type
|
284 | #define TrackerCast(x) x
|
284 | #define TrackerCast(x) x
|
285 | 285 | ||
286 | #endif // __cplusplus
|
286 | #endif // __cplusplus
|
287 | 287 | ||
288 | // Links to various ABIs specifying (or documenting non-normatively) the
|
288 | // Links to various ABIs specifying (or documenting non-normatively) the
|
289 | // alignment requirements of aggregates:
|
289 | // alignment requirements of aggregates:
|
290 | //
|
290 | //
|
291 | // System V AMD64: http://www.x86-64.org/documentation/abi-0.99.pdf
|
291 | // System V AMD64: http://www.x86-64.org/documentation/abi-0.99.pdf
|
292 | // (x86-64.org down as of 2013-02-02?)
|
292 | // (x86-64.org down as of 2013-02-02?)
|
293 | // "An array uses the same alignment as its elements, except that a local or global
|
293 | // "An array uses the same alignment as its elements, except that a local or global
|
294 | // array variable of length at least 16 bytes or a C99 variable-length array variable
|
294 | // array variable of length at least 16 bytes or a C99 variable-length array variable
|
295 | // always has alignment of at least 16 bytes."
|
295 | // always has alignment of at least 16 bytes."
|
296 | // (Not reproducible with GCC or LuaJIT on Ubuntu)
|
296 | // (Not reproducible with GCC or LuaJIT on Ubuntu)
|
297 | //
|
297 | //
|
298 | // Win64: http://msdn.microsoft.com/en-us/library/9dbwhz68.aspx
|
298 | // Win64: http://msdn.microsoft.com/en-us/library/9dbwhz68.aspx
|
299 | //
|
299 | //
|
300 | // x86: http://en.wikipedia.org/wiki/Data_structure_alignment#Typical_alignment_of_C_structs_on_x86
|
300 | // x86: http://en.wikipedia.org/wiki/Data_structure_alignment#Typical_alignment_of_C_structs_on_x86
|
301 | 301 | ||
302 | enum { |
302 | enum { |
303 | SPR_XFLIP = 4, |
303 | SPR_XFLIP = 4, |
304 | SPR_YFLIP = 8, |
304 | SPR_YFLIP = 8, |
305 | 305 | ||
306 | SPR_WALL = 16, |
306 | SPR_WALL = 16, |
307 | SPR_FLOOR = 32, |
307 | SPR_FLOOR = 32, |
308 | SPR_ALIGN_MASK = 32+16, |
308 | SPR_ALIGN_MASK = 32+16, |
309 | }; |
309 | }; |
310 | 310 | ||
311 | #if !defined NEW_MAP_FORMAT
|
311 | #if !defined NEW_MAP_FORMAT
|
312 | #include "buildtypes.h"
|
312 | #include "buildtypes.h"
|
313 | #define UNTRACKED_STRUCTS
|
313 | #define UNTRACKED_STRUCTS
|
314 | #undef buildtypes_h__
|
314 | #undef buildtypes_h__
|
315 | #include "buildtypes.h"
|
315 | #include "buildtypes.h"
|
316 | #undef UNTRACKED_STRUCTS
|
316 | #undef UNTRACKED_STRUCTS
|
317 | #endif
|
317 | #endif
|
318 | 318 | ||
319 | #ifdef NEW_MAP_FORMAT
|
319 | #ifdef NEW_MAP_FORMAT
|
320 | //////////////////// Lunatic new-generation map format ////////////////////
|
320 | //////////////////// Lunatic new-generation map format ////////////////////
|
321 | 321 | ||
322 | #include "buildtypes.h"
|
322 | #include "buildtypes.h"
|
323 | 323 | ||
324 | // 44 bytes
|
324 | // 44 bytes
|
325 | typedef struct |
325 | typedef struct |
326 | {
|
326 | {
|
327 | Tracker(Sector, int16_t) wallptr, wallnum; |
327 | Tracker(Sector, int16_t) wallptr, wallnum; |
328 | 328 | ||
329 | Tracker(Sector, int16_t) ceilingpicnum, ceilingheinum, ceilingbunch; |
329 | Tracker(Sector, int16_t) ceilingpicnum, ceilingheinum, ceilingbunch; |
330 | Tracker(Sector, uint16_t) ceilingstat; |
330 | Tracker(Sector, uint16_t) ceilingstat; |
331 | Tracker(Sector, int32_t) ceilingz; |
331 | Tracker(Sector, int32_t) ceilingz; |
332 | Tracker(Sector, int8_t) ceilingshade; |
332 | Tracker(Sector, int8_t) ceilingshade; |
333 | Tracker(Sector, uint8_t) ceilingpal, /*CM_FLOORZ:*/ ceilingxpanning, ceilingypanning; |
333 | Tracker(Sector, uint8_t) ceilingpal, /*CM_FLOORZ:*/ ceilingxpanning, ceilingypanning; |
334 | 334 | ||
335 | Tracker(Sector, int16_t) floorpicnum, floorheinum, floorbunch; |
335 | Tracker(Sector, int16_t) floorpicnum, floorheinum, floorbunch; |
336 | Tracker(Sector, uint16_t) floorstat; |
336 | Tracker(Sector, uint16_t) floorstat; |
337 | Tracker(Sector, int32_t) floorz; |
337 | Tracker(Sector, int32_t) floorz; |
338 | Tracker(Sector, int8_t) floorshade; |
338 | Tracker(Sector, int8_t) floorshade; |
339 | Tracker(Sector, uint8_t) floorpal, floorxpanning, floorypanning; |
339 | Tracker(Sector, uint8_t) floorpal, floorxpanning, floorypanning; |
340 | 340 | ||
341 | Tracker(Sector, uint8_t) /*CM_CEILINGZ:*/ visibility, fogpal; |
341 | Tracker(Sector, uint8_t) /*CM_CEILINGZ:*/ visibility, fogpal; |
342 | Tracker(Sector, uint16_t) lotag, hitag; |
342 | Tracker(Sector, uint16_t) lotag, hitag; |
343 | Tracker(Sector, int16_t) extra; |
343 | Tracker(Sector, int16_t) extra; |
344 | } sectortypevx; |
344 | } sectortypevx; |
345 | 345 | ||
346 | # define SECTORVX_SZ1 offsetof(sectortypevx, ceilingpicnum)
|
346 | # define SECTORVX_SZ1 offsetof(sectortypevx, ceilingpicnum)
|
347 | # define SECTORVX_SZ4 sizeof(sectortypevx)-offsetof(sectortypevx, visibility)
|
347 | # define SECTORVX_SZ4 sizeof(sectortypevx)-offsetof(sectortypevx, visibility)
|
348 | 348 | ||
349 | static inline void copy_v7_from_vx_sector(sectortypev7 *v7sec, const sectortypevx *vxsec) |
349 | static inline void copy_v7_from_vx_sector(sectortypev7 *v7sec, const sectortypevx *vxsec) |
350 | {
|
350 | {
|
351 | /* [wallptr..wallnum] */
|
351 | /* [wallptr..wallnum] */
|
352 | Bmemcpy(v7sec, vxsec, SECTORVX_SZ1); |
352 | Bmemcpy(v7sec, vxsec, SECTORVX_SZ1); |
353 | 353 | ||
354 | /* ceiling* */
|
354 | /* ceiling* */
|
355 | v7sec->ceilingpicnum = vxsec->ceilingpicnum; |
355 | v7sec->ceilingpicnum = vxsec->ceilingpicnum; |
356 | v7sec->ceilingheinum = vxsec->ceilingheinum; |
356 | v7sec->ceilingheinum = vxsec->ceilingheinum; |
357 | v7sec->ceilingstat = vxsec->ceilingstat; |
357 | v7sec->ceilingstat = vxsec->ceilingstat; |
358 | v7sec->ceilingz = vxsec->ceilingz; |
358 | v7sec->ceilingz = vxsec->ceilingz; |
359 | v7sec->ceilingshade = vxsec->ceilingshade; |
359 | v7sec->ceilingshade = vxsec->ceilingshade; |
360 | v7sec->ceilingpal = vxsec->ceilingpal; |
360 | v7sec->ceilingpal = vxsec->ceilingpal; |
361 | v7sec->ceilingxpanning = vxsec->ceilingxpanning; |
361 | v7sec->ceilingxpanning = vxsec->ceilingxpanning; |
362 | v7sec->ceilingypanning = vxsec->ceilingypanning; |
362 | v7sec->ceilingypanning = vxsec->ceilingypanning; |
363 | 363 | ||
364 | /* floor* */
|
364 | /* floor* */
|
365 | v7sec->floorpicnum = vxsec->floorpicnum; |
365 | v7sec->floorpicnum = vxsec->floorpicnum; |
366 | v7sec->floorheinum = vxsec->floorheinum; |
366 | v7sec->floorheinum = vxsec->floorheinum; |
367 | v7sec->floorstat = vxsec->floorstat; |
367 | v7sec->floorstat = vxsec->floorstat; |
368 | v7sec->floorz = vxsec->floorz; |
368 | v7sec->floorz = vxsec->floorz; |
369 | v7sec->floorshade = vxsec->floorshade; |
369 | v7sec->floorshade = vxsec->floorshade; |
370 | v7sec->floorpal = vxsec->floorpal; |
370 | v7sec->floorpal = vxsec->floorpal; |
371 | v7sec->floorxpanning = vxsec->floorxpanning; |
371 | v7sec->floorxpanning = vxsec->floorxpanning; |
372 | v7sec->floorypanning = vxsec->floorypanning; |
372 | v7sec->floorypanning = vxsec->floorypanning; |
373 | 373 | ||
374 | /* [visibility..extra] */
|
374 | /* [visibility..extra] */
|
375 | Bmemcpy(&v7sec->visibility, &vxsec->visibility, SECTORVX_SZ4); |
375 | Bmemcpy(&v7sec->visibility, &vxsec->visibility, SECTORVX_SZ4); |
376 | 376 | ||
377 | /* Clear YAX_BIT of ceiling and floor. (New-map format build saves TROR
|
377 | /* Clear YAX_BIT of ceiling and floor. (New-map format build saves TROR
|
378 | * maps as map-text.) */
|
378 | * maps as map-text.) */
|
379 | v7sec->ceilingstat &= ~YAX_BIT__COMPAT; |
379 | v7sec->ceilingstat &= ~YAX_BIT__COMPAT; |
380 | v7sec->floorstat &= ~YAX_BIT__COMPAT; |
380 | v7sec->floorstat &= ~YAX_BIT__COMPAT; |
381 | }
|
381 | }
|
382 | 382 | ||
383 | static inline void inplace_vx_from_v7_sector(sectortypevx *vxsec) |
383 | static inline void inplace_vx_from_v7_sector(sectortypevx *vxsec) |
384 | {
|
384 | {
|
385 | const sectortypev7 *v7sec = (sectortypev7 *)vxsec; |
385 | const sectortypev7 *v7sec = (sectortypev7 *)vxsec; |
386 | sectortypev7 bakv7sec;
|
386 | sectortypev7 bakv7sec;
|
387 | 387 | ||
388 | // Can't do this in-place since the members were rearranged.
|
388 | // Can't do this in-place since the members were rearranged.
|
389 | Bmemcpy(&bakv7sec, v7sec, sizeof(sectortypev7)); |
389 | Bmemcpy(&bakv7sec, v7sec, sizeof(sectortypev7)); |
390 | 390 | ||
391 | /* [wallptr..wallnum] is already at the right place */
|
391 | /* [wallptr..wallnum] is already at the right place */
|
392 | 392 | ||
393 | /* ceiling* */
|
393 | /* ceiling* */
|
394 | vxsec->ceilingpicnum = bakv7sec.ceilingpicnum; |
394 | vxsec->ceilingpicnum = bakv7sec.ceilingpicnum; |
395 | vxsec->ceilingheinum = bakv7sec.ceilingheinum; |
395 | vxsec->ceilingheinum = bakv7sec.ceilingheinum; |
396 | vxsec->ceilingstat = bakv7sec.ceilingstat; |
396 | vxsec->ceilingstat = bakv7sec.ceilingstat; |
397 | vxsec->ceilingz = bakv7sec.ceilingz; |
397 | vxsec->ceilingz = bakv7sec.ceilingz; |
398 | vxsec->ceilingshade = bakv7sec.ceilingshade; |
398 | vxsec->ceilingshade = bakv7sec.ceilingshade; |
399 | vxsec->ceilingpal = bakv7sec.ceilingpal; |
399 | vxsec->ceilingpal = bakv7sec.ceilingpal; |
400 | vxsec->ceilingxpanning = bakv7sec.ceilingxpanning; |
400 | vxsec->ceilingxpanning = bakv7sec.ceilingxpanning; |
401 | vxsec->ceilingypanning = bakv7sec.ceilingypanning; |
401 | vxsec->ceilingypanning = bakv7sec.ceilingypanning; |
402 | 402 | ||
403 | /* floor* */
|
403 | /* floor* */
|
404 | vxsec->floorpicnum = bakv7sec.floorpicnum; |
404 | vxsec->floorpicnum = bakv7sec.floorpicnum; |
405 | vxsec->floorheinum = bakv7sec.floorheinum; |
405 | vxsec->floorheinum = bakv7sec.floorheinum; |
406 | vxsec->floorstat = bakv7sec.floorstat; |
406 | vxsec->floorstat = bakv7sec.floorstat; |
407 | vxsec->floorz = bakv7sec.floorz; |
407 | vxsec->floorz = bakv7sec.floorz; |
408 | vxsec->floorshade = bakv7sec.floorshade; |
408 | vxsec->floorshade = bakv7sec.floorshade; |
409 | vxsec->floorpal = bakv7sec.floorpal; |
409 | vxsec->floorpal = bakv7sec.floorpal; |
410 | vxsec->floorxpanning = bakv7sec.floorxpanning; |
410 | vxsec->floorxpanning = bakv7sec.floorxpanning; |
411 | vxsec->floorypanning = bakv7sec.floorypanning; |
411 | vxsec->floorypanning = bakv7sec.floorypanning; |
412 | 412 | ||
413 | /* [visibility..extra] */
|
413 | /* [visibility..extra] */
|
414 | Bmemmove(&vxsec->visibility, &bakv7sec.visibility, SECTORVX_SZ4); |
414 | Bmemmove(&vxsec->visibility, &bakv7sec.visibility, SECTORVX_SZ4); |
415 | }
|
415 | }
|
416 | 416 | ||
417 | static inline void inplace_vx_tweak_sector(sectortypevx *vxsec, int32_t yaxp) |
417 | static inline void inplace_vx_tweak_sector(sectortypevx *vxsec, int32_t yaxp) |
418 | {
|
418 | {
|
419 | if (yaxp) |
419 | if (yaxp) |
420 | {
|
420 | {
|
421 | int32_t cisext = (vxsec->ceilingstat&YAX_BIT__COMPAT); |
421 | int32_t cisext = (vxsec->ceilingstat&YAX_BIT__COMPAT); |
422 | int32_t fisext = (vxsec->floorstat&YAX_BIT__COMPAT); |
422 | int32_t fisext = (vxsec->floorstat&YAX_BIT__COMPAT); |
423 | 423 | ||
424 | vxsec->ceilingbunch = cisext ? vxsec->ceilingxpanning : -1; |
424 | vxsec->ceilingbunch = cisext ? vxsec->ceilingxpanning : -1; |
425 | vxsec->floorbunch = fisext ? vxsec->floorxpanning : -1; |
425 | vxsec->floorbunch = fisext ? vxsec->floorxpanning : -1; |
426 | 426 | ||
427 | if (cisext) |
427 | if (cisext) |
428 | vxsec->ceilingxpanning = 0; |
428 | vxsec->ceilingxpanning = 0; |
429 | if (fisext) |
429 | if (fisext) |
430 | vxsec->floorxpanning = 0; |
430 | vxsec->floorxpanning = 0; |
431 | }
|
431 | }
|
432 | else
|
432 | else
|
433 | {
|
433 | {
|
434 | vxsec->ceilingbunch = vxsec->floorbunch = -1; |
434 | vxsec->ceilingbunch = vxsec->floorbunch = -1; |
435 | }
|
435 | }
|
436 | 436 | ||
437 | /* Clear YAX_BIT of ceiling and floor (map-int VX doesn't use it). */
|
437 | /* Clear YAX_BIT of ceiling and floor (map-int VX doesn't use it). */
|
438 | vxsec->ceilingstat &= ~YAX_BIT__COMPAT; |
438 | vxsec->ceilingstat &= ~YAX_BIT__COMPAT; |
439 | vxsec->floorstat &= ~YAX_BIT__COMPAT; |
439 | vxsec->floorstat &= ~YAX_BIT__COMPAT; |
440 | }
|
440 | }
|
441 | 441 | ||
442 | # undef SECTORVX_SZ1
|
442 | # undef SECTORVX_SZ1
|
443 | # undef SECTORVX_SZ4
|
443 | # undef SECTORVX_SZ4
|
444 | 444 | ||
445 | // 38 bytes
|
445 | // 38 bytes
|
446 | typedef struct |
446 | typedef struct |
447 | {
|
447 | {
|
448 | Tracker(Wall, int32_t) x, y; |
448 | Tracker(Wall, int32_t) x, y; |
449 | Tracker(Wall, int16_t) point2, nextwall, nextsector; |
449 | Tracker(Wall, int16_t) point2, nextwall, nextsector; |
450 | Tracker(Wall, int16_t) upwall, dnwall; |
450 | Tracker(Wall, int16_t) upwall, dnwall; |
451 | Tracker(Wall, uint16_t) cstat; |
451 | Tracker(Wall, uint16_t) cstat; |
452 | Tracker(Wall, int16_t) picnum, overpicnum; |
452 | Tracker(Wall, int16_t) picnum, overpicnum; |
453 | Tracker(Wall, int8_t) shade; |
453 | Tracker(Wall, int8_t) shade; |
454 | Tracker(Wall, uint8_t) pal, xrepeat, yrepeat, xpanning, ypanning; |
454 | Tracker(Wall, uint8_t) pal, xrepeat, yrepeat, xpanning, ypanning; |
455 | Tracker(Wall, uint16_t) lotag, hitag; |
455 | Tracker(Wall, uint16_t) lotag, hitag; |
456 | Tracker(Wall, int16_t) extra; |
456 | Tracker(Wall, int16_t) extra; |
457 | Tracker(Wall, uint8_t) blend, filler_; |
457 | Tracker(Wall, uint8_t) blend, filler_; |
458 | } walltypevx; |
458 | } walltypevx; |
459 | 459 | ||
460 | # define WALLVX_SZ2 offsetof(walltypevx, blend)-offsetof(walltypevx, cstat)
|
460 | # define WALLVX_SZ2 offsetof(walltypevx, blend)-offsetof(walltypevx, cstat)
|
461 | 461 | ||
462 | static inline void copy_v7_from_vx_wall(walltypev7 *v7wal, const walltypevx *vxwal) |
462 | static inline void copy_v7_from_vx_wall(walltypev7 *v7wal, const walltypevx *vxwal) |
463 | {
|
463 | {
|
464 | /* [x..nextsector] */
|
464 | /* [x..nextsector] */
|
465 | Bmemcpy(v7wal, vxwal, offsetof(walltypevx, upwall)); |
465 | Bmemcpy(v7wal, vxwal, offsetof(walltypevx, upwall)); |
466 | /* [cstat..extra] */
|
466 | /* [cstat..extra] */
|
467 | Bmemcpy(&v7wal->cstat, &vxwal->cstat, WALLVX_SZ2); |
467 | Bmemcpy(&v7wal->cstat, &vxwal->cstat, WALLVX_SZ2); |
468 | /* Clear YAX_NEXTWALLBITS. */
|
468 | /* Clear YAX_NEXTWALLBITS. */
|
469 | v7wal->cstat &= ~YAX_NEXTWALLBITS__COMPAT; |
469 | v7wal->cstat &= ~YAX_NEXTWALLBITS__COMPAT; |
470 | }
|
470 | }
|
471 | 471 | ||
472 | static inline void inplace_vx_from_v7_wall(walltypevx *vxwal) |
472 | static inline void inplace_vx_from_v7_wall(walltypevx *vxwal) |
473 | {
|
473 | {
|
474 | const walltypev7 *v7wal = (walltypev7 *)vxwal; |
474 | const walltypev7 *v7wal = (walltypev7 *)vxwal; |
475 | 475 | ||
476 | /* [cstat..extra] */
|
476 | /* [cstat..extra] */
|
477 | Bmemmove(&vxwal->cstat, &v7wal->cstat, WALLVX_SZ2); |
477 | Bmemmove(&vxwal->cstat, &v7wal->cstat, WALLVX_SZ2); |
478 | 478 | ||
479 | vxwal->blend = vxwal->filler_ = 0; |
479 | vxwal->blend = vxwal->filler_ = 0; |
480 | }
|
480 | }
|
481 | 481 | ||
482 | static inline void inplace_vx_tweak_wall(walltypevx *vxwal, int32_t yaxp) |
482 | static inline void inplace_vx_tweak_wall(walltypevx *vxwal, int32_t yaxp) |
483 | {
|
483 | {
|
484 | if (yaxp) |
484 | if (yaxp) |
485 | {
|
485 | {
|
486 | int32_t haveupwall = (vxwal->cstat & YAX_NEXTWALLBIT__COMPAT(YAX_CEILING)); |
486 | int32_t haveupwall = (vxwal->cstat & YAX_NEXTWALLBIT__COMPAT(YAX_CEILING)); |
487 | int32_t havednwall = (vxwal->cstat & YAX_NEXTWALLBIT__COMPAT(YAX_FLOOR)); |
487 | int32_t havednwall = (vxwal->cstat & YAX_NEXTWALLBIT__COMPAT(YAX_FLOOR)); |
488 | 488 | ||
489 | vxwal->upwall = haveupwall ? vxwal->lotag : -1; |
489 | vxwal->upwall = haveupwall ? vxwal->lotag : -1; |
490 | vxwal->dnwall = havednwall ? vxwal->extra : -1; |
490 | vxwal->dnwall = havednwall ? vxwal->extra : -1; |
491 | 491 | ||
492 | if (haveupwall) |
492 | if (haveupwall) |
493 | vxwal->lotag = 0; |
493 | vxwal->lotag = 0; |
494 | if (havednwall) |
494 | if (havednwall) |
495 | vxwal->extra = -1; |
495 | vxwal->extra = -1; |
496 | }
|
496 | }
|
497 | else
|
497 | else
|
498 | {
|
498 | {
|
499 | vxwal->upwall = vxwal->dnwall = -1; |
499 | vxwal->upwall = vxwal->dnwall = -1; |
500 | }
|
500 | }
|
501 | 501 | ||
502 | /* Clear YAX_NEXTWALLBITS (map-int VX doesn't use it). */
|
502 | /* Clear YAX_NEXTWALLBITS (map-int VX doesn't use it). */
|
503 | vxwal->cstat &= ~YAX_NEXTWALLBITS__COMPAT; |
503 | vxwal->cstat &= ~YAX_NEXTWALLBITS__COMPAT; |
504 | }
|
504 | }
|
505 | 505 | ||
506 | # undef WALLVX_SZ2
|
506 | # undef WALLVX_SZ2
|
507 | 507 | ||
508 | // NOTE: spritetype is currently the same for V7/8/9 and VX in-memory map formats.
|
508 | // NOTE: spritetype is currently the same for V7/8/9 and VX in-memory map formats.
|
509 | 509 | ||
510 | typedef sectortypevx sectortype; |
510 | typedef sectortypevx sectortype; |
511 | typedef walltypevx walltype; |
511 | typedef walltypevx walltype; |
512 | 512 | ||
513 | typedef sectortype tsectortype; |
513 | typedef sectortype tsectortype; |
514 | typedef walltype twalltype; |
514 | typedef walltype twalltype; |
515 | typedef spritetype tspritetype; |
515 | typedef spritetype tspritetype; |
516 | //////////////////// END Lunatic new-generation map format ////////////////
|
516 | //////////////////// END Lunatic new-generation map format ////////////////
|
517 | #else
|
517 | #else
|
518 | typedef sectortypev7 sectortype; |
518 | typedef sectortypev7 sectortype; |
519 | typedef walltypev7 walltype; |
519 | typedef walltypev7 walltype; |
520 | #endif
|
520 | #endif
|
521 | 521 | ||
522 | typedef struct { |
522 | typedef struct { |
523 | uint32_t mdanimtims; |
523 | uint32_t mdanimtims; |
524 | int16_t mdanimcur; |
524 | int16_t mdanimcur; |
525 | int16_t angoff, pitch, roll; |
525 | int16_t angoff, pitch, roll; |
526 | vec3_t offset;
|
526 | vec3_t offset;
|
527 | uint8_t flags; |
527 | uint8_t flags; |
528 | uint8_t xpanning, ypanning; |
528 | uint8_t xpanning, ypanning; |
529 | uint8_t filler; |
529 | uint8_t filler; |
530 | float alpha; |
530 | float alpha; |
531 | // NOTE: keep 'tspr' on an 8-byte boundary:
|
531 | // NOTE: keep 'tspr' on an 8-byte boundary:
|
532 | tspritetype *tspr; |
532 | tspritetype *tspr; |
533 | #if !defined UINTPTR_MAX
|
533 | #if !defined UINTPTR_MAX
|
534 | # error Need UINTPTR_MAX define to select between 32- and 64-bit structs
|
534 | # error Need UINTPTR_MAX define to select between 32- and 64-bit structs
|
535 | #endif
|
535 | #endif
|
536 | #if UINTPTR_MAX == 0xffffffff
|
536 | #if UINTPTR_MAX == 0xffffffff
|
537 | /* On a 32-bit build, pad the struct so it has the same size everywhere. */
|
537 | /* On a 32-bit build, pad the struct so it has the same size everywhere. */
|
538 | intptr_t dummy_; |
538 | intptr_t dummy_; |
539 | #endif
|
539 | #endif
|
540 | } spriteext_t; |
540 | } spriteext_t; |
541 | 541 | ||
542 | typedef struct { |
542 | typedef struct { |
543 | float smoothduration; |
543 | float smoothduration; |
544 | int16_t mdcurframe, mdoldframe; |
544 | int16_t mdcurframe, mdoldframe; |
545 | int16_t mdsmooth; |
545 | int16_t mdsmooth; |
546 | uint8_t filler[2]; |
546 | uint8_t filler[2]; |
547 | } spritesmooth_t; |
547 | } spritesmooth_t; |
548 | 548 | ||
549 | #define SPREXT_NOTMD 1
|
549 | #define SPREXT_NOTMD 1
|
550 | #define SPREXT_NOMDANIM 2
|
550 | #define SPREXT_NOMDANIM 2
|
551 | #define SPREXT_AWAY1 4
|
551 | #define SPREXT_AWAY1 4
|
552 | #define SPREXT_AWAY2 8
|
552 | #define SPREXT_AWAY2 8
|
553 | #define SPREXT_TSPRACCESS 16
|
553 | #define SPREXT_TSPRACCESS 16
|
554 | #define SPREXT_TEMPINVISIBLE 32
|
554 | #define SPREXT_TEMPINVISIBLE 32
|
555 | 555 | ||
556 | #define CSTAT_SPRITE_MDHACK 1024
|
556 | #define CSTAT_SPRITE_MDHACK 1024
|
557 | 557 | ||
558 | EXTERN int32_t guniqhudid; |
558 | EXTERN int32_t guniqhudid; |
559 | EXTERN int32_t spritesortcnt; |
559 | EXTERN int32_t spritesortcnt; |
560 | extern int32_t g_loadedMapVersion; |
560 | extern int32_t g_loadedMapVersion; |
561 | 561 | ||
562 | typedef struct { |
562 | typedef struct { |
563 | char *mhkfile; |
563 | char *mhkfile; |
564 | char *title; |
564 | char *title; |
565 | uint8_t md4[16]; |
565 | uint8_t md4[16]; |
566 | } usermaphack_t; |
566 | } usermaphack_t; |
567 | 567 | ||
568 | extern usermaphack_t g_loadedMapHack; |
568 | extern usermaphack_t g_loadedMapHack; |
569 | extern int32_t compare_usermaphacks(const void *, const void *); |
569 | extern int32_t compare_usermaphacks(const void *, const void *); |
570 | extern usermaphack_t *usermaphacks; |
570 | extern usermaphack_t *usermaphacks; |
571 | extern int32_t num_usermaphacks; |
571 | extern int32_t num_usermaphacks; |
572 | 572 | ||
573 | #if !defined DEBUG_MAIN_ARRAYS
|
573 | #if !defined DEBUG_MAIN_ARRAYS
|
574 | EXTERN spriteext_t *spriteext; |
574 | EXTERN spriteext_t *spriteext; |
575 | EXTERN spritesmooth_t *spritesmooth; |
575 | EXTERN spritesmooth_t *spritesmooth; |
576 | 576 | ||
577 | EXTERN sectortype *sector; |
577 | EXTERN sectortype *sector; |
578 | EXTERN walltype *wall; |
578 | EXTERN walltype *wall; |
579 | EXTERN spritetype *sprite; |
579 | EXTERN spritetype *sprite; |
580 | EXTERN tspritetype *tsprite; |
580 | EXTERN tspritetype *tsprite; |
581 | #else
|
581 | #else
|
582 | EXTERN spriteext_t spriteext[MAXSPRITES+MAXUNIQHUDID]; |
582 | EXTERN spriteext_t spriteext[MAXSPRITES+MAXUNIQHUDID]; |
583 | EXTERN spritesmooth_t spritesmooth[MAXSPRITES+MAXUNIQHUDID]; |
583 | EXTERN spritesmooth_t spritesmooth[MAXSPRITES+MAXUNIQHUDID]; |
584 | 584 | ||
585 | EXTERN sectortype sector[MAXSECTORS + M32_FIXME_SECTORS]; |
585 | EXTERN sectortype sector[MAXSECTORS + M32_FIXME_SECTORS]; |
586 | EXTERN walltype wall[MAXWALLS + M32_FIXME_WALLS]; |
586 | EXTERN walltype wall[MAXWALLS + M32_FIXME_WALLS]; |
587 | EXTERN spritetype sprite[MAXSPRITES]; |
587 | EXTERN spritetype sprite[MAXSPRITES]; |
588 | EXTERN tspritetype tsprite[MAXSPRITESONSCREEN]; |
588 | EXTERN tspritetype tsprite[MAXSPRITESONSCREEN]; |
589 | #endif
|
589 | #endif
|
590 | 590 | ||
591 | EXTERN uint32_t sectorchanged[MAXSECTORS + M32_FIXME_SECTORS]; |
591 | EXTERN uint32_t sectorchanged[MAXSECTORS + M32_FIXME_SECTORS]; |
592 | EXTERN uint32_t wallchanged[MAXWALLS + M32_FIXME_WALLS]; |
592 | EXTERN uint32_t wallchanged[MAXWALLS + M32_FIXME_WALLS]; |
593 | EXTERN uint32_t spritechanged[MAXSPRITES]; |
593 | EXTERN uint32_t spritechanged[MAXSPRITES]; |
594 | 594 | ||
595 | #ifdef NEW_MAP_FORMAT
|
595 | #ifdef NEW_MAP_FORMAT
|
596 | FORCE_INLINE int16_t yax_getbunch(int16_t i, int16_t cf) |
596 | FORCE_INLINE int16_t yax_getbunch(int16_t i, int16_t cf) |
597 | {
|
597 | {
|
598 | return cf ? sector[i].floorbunch : sector[i].ceilingbunch; |
598 | return cf ? sector[i].floorbunch : sector[i].ceilingbunch; |
599 | }
|
599 | }
|
600 | 600 | ||
601 | FORCE_INLINE void yax_getbunches(int16_t i, int16_t *cb, int16_t *fb) |
601 | FORCE_INLINE void yax_getbunches(int16_t i, int16_t *cb, int16_t *fb) |
602 | {
|
602 | {
|
603 | *cb = yax_getbunch(i, YAX_CEILING); |
603 | *cb = yax_getbunch(i, YAX_CEILING); |
604 | *fb = yax_getbunch(i, YAX_FLOOR); |
604 | *fb = yax_getbunch(i, YAX_FLOOR); |
605 | }
|
605 | }
|
606 | 606 | ||
607 | FORCE_INLINE int16_t yax_getnextwall(int16_t wal, int16_t cf) |
607 | FORCE_INLINE int16_t yax_getnextwall(int16_t wal, int16_t cf) |
608 | {
|
608 | {
|
609 | return cf ? wall[wal].dnwall : wall[wal].upwall; |
609 | return cf ? wall[wal].dnwall : wall[wal].upwall; |
610 | }
|
610 | }
|
611 | 611 | ||
612 | FORCE_INLINE void yax_setnextwall(int16_t wal, int16_t cf, int16_t thenextwall) |
612 | FORCE_INLINE void yax_setnextwall(int16_t wal, int16_t cf, int16_t thenextwall) |
613 | {
|
613 | {
|
614 | YAX_NEXTWALL(wal, cf) = thenextwall; |
614 | YAX_NEXTWALL(wal, cf) = thenextwall; |
615 | }
|
615 | }
|
616 | #endif
|
616 | #endif
|
617 | 617 | ||
618 | FORCE_INLINE void sector_tracker_hook(uintptr_t address) |
618 | FORCE_INLINE void sector_tracker_hook(uintptr_t address) |
619 | {
|
619 | {
|
620 | uintptr_t const usector = address - (uintptr_t)sector; |
620 | uintptr_t const usector = address - (uintptr_t)sector; |
621 | 621 | ||
622 | #if DEBUGGINGAIDS
|
622 | #if DEBUGGINGAIDS
|
623 | Bassert(usector < ((MAXSECTORS + M32_FIXME_SECTORS) * sizeof(sectortype))); |
623 | Bassert(usector < ((MAXSECTORS + M32_FIXME_SECTORS) * sizeof(sectortype))); |
624 | #endif
|
624 | #endif
|
625 | 625 | ||
626 | sectorchanged[usector / sizeof(sectortype)]++; |
626 | sectorchanged[usector / sizeof(sectortype)]++; |
627 | }
|
627 | }
|
628 | 628 | ||
629 | FORCE_INLINE void wall_tracker_hook(uintptr_t address) |
629 | FORCE_INLINE void wall_tracker_hook(uintptr_t address) |
630 | {
|
630 | {
|
631 | uintptr_t const uwall = address - (uintptr_t)wall; |
631 | uintptr_t const uwall = address - (uintptr_t)wall; |
632 | 632 | ||
633 | #if DEBUGGINGAIDS
|
633 | #if DEBUGGINGAIDS
|
634 | Bassert(uwall < ((MAXWALLS + M32_FIXME_WALLS) * sizeof(walltype))); |
634 | Bassert(uwall < ((MAXWALLS + M32_FIXME_WALLS) * sizeof(walltype))); |
635 | #endif
|
635 | #endif
|
636 | 636 | ||
637 | wallchanged[uwall / sizeof(walltype)]++; |
637 | wallchanged[uwall / sizeof(walltype)]++; |
638 | }
|
638 | }
|
639 | 639 | ||
640 | FORCE_INLINE void sprite_tracker_hook(uintptr_t address) |
640 | FORCE_INLINE void sprite_tracker_hook(uintptr_t address) |
641 | {
|
641 | {
|
642 | uintptr_t const usprite = address - (uintptr_t)sprite; |
642 | uintptr_t const usprite = address - (uintptr_t)sprite; |
643 | 643 | ||
644 | #if DEBUGGINGAIDS
|
644 | #if DEBUGGINGAIDS
|
645 | Bassert(usprite < (MAXSPRITES * sizeof(spritetype))); |
645 | Bassert(usprite < (MAXSPRITES * sizeof(spritetype))); |
646 | #endif
|
646 | #endif
|
647 | 647 | ||
648 | spritechanged[usprite / sizeof(spritetype)]++; |
648 | spritechanged[usprite / sizeof(spritetype)]++; |
649 | }
|
649 | }
|
650 | 650 | ||
651 | 651 | ||
652 | EXTERN int16_t maskwall[MAXWALLSB], maskwallcnt; |
652 | EXTERN int16_t maskwall[MAXWALLSB], maskwallcnt; |
653 | EXTERN int16_t thewall[MAXWALLSB]; |
653 | EXTERN int16_t thewall[MAXWALLSB]; |
654 | EXTERN tspritetype *tspriteptr[MAXSPRITESONSCREEN + 1]; |
654 | EXTERN tspritetype *tspriteptr[MAXSPRITESONSCREEN + 1]; |
655 | 655 | ||
656 | EXTERN int32_t xdim, ydim, numpages; |
656 | EXTERN int32_t xdim, ydim, numpages; |
657 | EXTERN int32_t yxaspect, viewingrange; |
657 | EXTERN int32_t yxaspect, viewingrange; |
658 | EXTERN intptr_t *ylookup; |
658 | EXTERN intptr_t *ylookup; |
659 | 659 | ||
660 | #ifndef GEKKO
|
660 | #ifndef GEKKO
|
661 | #define MAXVALIDMODES 256
|
661 | #define MAXVALIDMODES 256
|
662 | #else
|
662 | #else
|
663 | #define MAXVALIDMODES 16
|
663 | #define MAXVALIDMODES 16
|
664 | #endif
|
664 | #endif
|
665 | EXTERN int32_t validmodecnt; |
665 | EXTERN int32_t validmodecnt; |
666 | struct validmode_t { |
666 | struct validmode_t { |
667 | int32_t xdim,ydim; |
667 | int32_t xdim,ydim; |
668 | char bpp; |
668 | char bpp; |
669 | char fs; // bit 0 = fullscreen flag |
669 | char fs; // bit 0 = fullscreen flag |
670 | char filler[2]; |
670 | char filler[2]; |
671 | int32_t extra; // internal use |
671 | int32_t extra; // internal use |
672 | }; |
672 | }; |
673 | EXTERN struct validmode_t validmode[MAXVALIDMODES]; |
673 | EXTERN struct validmode_t validmode[MAXVALIDMODES]; |
674 | 674 | ||
675 | EXTERN int32_t numyaxbunches; |
675 | EXTERN int32_t numyaxbunches; |
676 | #ifdef YAX_ENABLE
|
676 | #ifdef YAX_ENABLE
|
677 | // Singly-linked list of sectnums grouped by bunches and ceiling (0)/floor (1)
|
677 | // Singly-linked list of sectnums grouped by bunches and ceiling (0)/floor (1)
|
678 | // Usage e.g.:
|
678 | // Usage e.g.:
|
679 | // int16_t bunchnum = yax_getbunch(somesector, YAX_CEILING);
|
679 | // int16_t bunchnum = yax_getbunch(somesector, YAX_CEILING);
|
680 | // Iteration over all sectors whose floor bunchnum equals 'bunchnum' (i.e. "all
|
680 | // Iteration over all sectors whose floor bunchnum equals 'bunchnum' (i.e. "all
|
681 | // floors of the other side"):
|
681 | // floors of the other side"):
|
682 | // for (i=headsectbunch[1][bunchnum]; i!=-1; i=nextsectbunch[1][i])
|
682 | // for (i=headsectbunch[1][bunchnum]; i!=-1; i=nextsectbunch[1][i])
|
683 | // <do stuff with sector i...>
|
683 | // <do stuff with sector i...>
|
684 | 684 | ||
685 | EXTERN int16_t headsectbunch[2][YAX_MAXBUNCHES], nextsectbunch[2][MAXSECTORS]; |
685 | EXTERN int16_t headsectbunch[2][YAX_MAXBUNCHES], nextsectbunch[2][MAXSECTORS]; |
686 | #endif
|
686 | #endif
|
687 | 687 | ||
688 | EXTERN int32_t Numsprites; |
688 | EXTERN int32_t Numsprites; |
689 | EXTERN int16_t numsectors, numwalls; |
689 | EXTERN int16_t numsectors, numwalls; |
690 | EXTERN char display_mirror; |
690 | EXTERN char display_mirror; |
691 | // totalclocklock: the totalclock value that is backed up once on each
|
691 | // totalclocklock: the totalclock value that is backed up once on each
|
692 | // drawrooms() and is used for animateoffs().
|
692 | // drawrooms() and is used for animateoffs().
|
693 | EXTERN int32_t totalclock, totalclocklock; |
693 | EXTERN int32_t totalclock, totalclocklock; |
694 | static inline int32_t BGetTime(void) { return totalclock; } |
694 | static inline int32_t BGetTime(void) { return totalclock; } |
695 | 695 | ||
696 | EXTERN int32_t numframes, randomseed; |
696 | EXTERN int32_t numframes, randomseed; |
697 | EXTERN int16_t sintable[2048]; |
697 | EXTERN int16_t sintable[2048]; |
698 | EXTERN uint8_t palette[768]; |
698 | EXTERN uint8_t palette[768]; |
699 | EXTERN int16_t numshades; |
699 | EXTERN int16_t numshades; |
700 | EXTERN char *palookup[MAXPALOOKUPS]; |
700 | EXTERN char *palookup[MAXPALOOKUPS]; |
701 | EXTERN uint8_t **basepaltableptr; |
701 | EXTERN uint8_t **basepaltableptr; |
702 | EXTERN char showinvisibility; |
702 | EXTERN char showinvisibility; |
703 | EXTERN int32_t g_visibility, parallaxvisibility; |
703 | EXTERN int32_t g_visibility, parallaxvisibility; |
704 | EXTERN int32_t g_rotatespriteNoWidescreen; |
704 | EXTERN int32_t g_rotatespriteNoWidescreen; |
705 | 705 | ||
706 | EXTERN int32_t windowx1, windowy1, windowx2, windowy2; |
706 | EXTERN int32_t windowx1, windowy1, windowx2, windowy2; |
707 | EXTERN int16_t *startumost, *startdmost; |
707 | EXTERN int16_t *startumost, *startdmost; |
708 | 708 | ||
709 | // The maximum tile offset ever used in any tiled parallaxed multi-sky.
|
709 | // The maximum tile offset ever used in any tiled parallaxed multi-sky.
|
710 | #define PSKYOFF_MAX 4
|
710 | #define PSKYOFF_MAX 4
|
711 | 711 | ||
712 | typedef struct { |
712 | typedef struct { |
713 | // The proportion at which looking up/down affects the apparent 'horiz' of
|
713 | // The proportion at which looking up/down affects the apparent 'horiz' of
|
714 | // a parallaxed sky, scaled by 65536 (so, a value of 65536 makes it align
|
714 | // a parallaxed sky, scaled by 65536 (so, a value of 65536 makes it align
|
715 | // with the drawn surrounding scene):
|
715 | // with the drawn surrounding scene):
|
716 | int32_t horizfrac; |
716 | int32_t horizfrac; |
717 | 717 | ||
718 | // The texel index offset in the y direction of a parallaxed sky:
|
718 | // The texel index offset in the y direction of a parallaxed sky:
|
719 | // XXX: currently always 0.
|
719 | // XXX: currently always 0.
|
720 | int32_t yoffs; |
720 | int32_t yoffs; |
721 | 721 | ||
722 | int8_t lognumtiles; // 1<<lognumtiles: number of tiles in multi-sky |
722 | int8_t lognumtiles; // 1<<lognumtiles: number of tiles in multi-sky |
723 | int8_t tileofs[MAXPSKYTILES]; // for 0 <= j < (1<<lognumtiles): tile offset relative to basetile |
723 | int8_t tileofs[MAXPSKYTILES]; // for 0 <= j < (1<<lognumtiles): tile offset relative to basetile |
724 | } psky_t; |
724 | } psky_t; |
725 | 725 | ||
726 | // Index of map-global (legacy) multi-sky:
|
726 | // Index of map-global (legacy) multi-sky:
|
727 | EXTERN int32_t g_pskyidx; |
727 | EXTERN int32_t g_pskyidx; |
728 | // New multi-psky -- up to MAXPSKYMULTIS (effectively constant after initialization):
|
728 | // New multi-psky -- up to MAXPSKYMULTIS (effectively constant after initialization):
|
729 | EXTERN int32_t pskynummultis; |
729 | EXTERN int32_t pskynummultis; |
730 | EXTERN psky_t multipsky[MAXPSKYMULTIS]; |
730 | EXTERN psky_t multipsky[MAXPSKYMULTIS]; |
731 | // Mapping of multi-sky index to base sky tile number:
|
731 | // Mapping of multi-sky index to base sky tile number:
|
732 | EXTERN int32_t multipskytile[MAXPSKYMULTIS]; |
732 | EXTERN int32_t multipskytile[MAXPSKYMULTIS]; |
733 | 733 | ||
734 | FORCE_INLINE int32_t getpskyidx(int32_t picnum) |
734 | FORCE_INLINE int32_t getpskyidx(int32_t picnum) |
735 | {
|
735 | {
|
736 | int32_t j; |
736 | int32_t j; |
737 | 737 | ||
738 | for (j=pskynummultis; j>0; j--) // NOTE: j==0 on non-early loop end |
738 | for (j=pskynummultis; j>0; j--) // NOTE: j==0 on non-early loop end |
739 | if (picnum == multipskytile[j]) |
739 | if (picnum == multipskytile[j]) |
740 | break; // Have a match. |
740 | break; // Have a match. |
741 | 741 | ||
742 | return j; |
742 | return j; |
743 | }
|
743 | }
|
744 | 744 | ||
745 | EXTERN char parallaxtype; |
745 | EXTERN char parallaxtype; |
746 | 746 | ||
747 | // last sprite in the freelist, that is the spritenum for which
|
747 | // last sprite in the freelist, that is the spritenum for which
|
748 | // .statnum==MAXSTATUS && nextspritestat[spritenum]==-1
|
748 | // .statnum==MAXSTATUS && nextspritestat[spritenum]==-1
|
749 | // (or -1 if freelist is empty):
|
749 | // (or -1 if freelist is empty):
|
750 | EXTERN int16_t tailspritefree; |
750 | EXTERN int16_t tailspritefree; |
751 | 751 | ||
752 | EXTERN int16_t headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1]; |
752 | EXTERN int16_t headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1]; |
753 | EXTERN int16_t prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES]; |
753 | EXTERN int16_t prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES]; |
754 | EXTERN int16_t nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES]; |
754 | EXTERN int16_t nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES]; |
755 | 755 | ||
756 | EXTERN vec2_t tilesiz[MAXTILES]; |
756 | EXTERN vec2_t tilesiz[MAXTILES]; |
757 | 757 | ||
758 | EXTERN char picsiz[MAXTILES]; |
758 | EXTERN char picsiz[MAXTILES]; |
759 | EXTERN char walock[MAXTILES]; |
759 | EXTERN char walock[MAXTILES]; |
760 | extern const char pow2char[8]; |
760 | extern const char pow2char[8]; |
761 | extern const int32_t pow2long[32]; |
761 | extern const int32_t pow2long[32]; |
762 | 762 | ||
763 | // picanm[].sf:
|
763 | // picanm[].sf:
|
764 | // |bit(1<<7)
|
764 | // |bit(1<<7)
|
765 | // |animtype|animtype|texhitscan|nofullbright|speed|speed|speed|speed|
|
765 | // |animtype|animtype|texhitscan|nofullbright|speed|speed|speed|speed|
|
766 | enum { |
766 | enum { |
767 | PICANM_ANIMTYPE_NONE = 0, |
767 | PICANM_ANIMTYPE_NONE = 0, |
768 | PICANM_ANIMTYPE_OSC = (1<<6), |
768 | PICANM_ANIMTYPE_OSC = (1<<6), |
769 | PICANM_ANIMTYPE_FWD = (2<<6), |
769 | PICANM_ANIMTYPE_FWD = (2<<6), |
770 | PICANM_ANIMTYPE_BACK = (3<<6), |
770 | PICANM_ANIMTYPE_BACK = (3<<6), |
771 | 771 | ||
772 | PICANM_ANIMTYPE_SHIFT = 6, |
772 | PICANM_ANIMTYPE_SHIFT = 6, |
773 | PICANM_ANIMTYPE_MASK = (3<<6), // must be 192 |
773 | PICANM_ANIMTYPE_MASK = (3<<6), // must be 192 |
774 | PICANM_MISC_MASK = (3<<4), |
774 | PICANM_MISC_MASK = (3<<4), |
775 | PICANM_TEXHITSCAN_BIT = (2<<4), |
775 | PICANM_TEXHITSCAN_BIT = (2<<4), |
776 | PICANM_NOFULLBRIGHT_BIT = (1<<4), |
776 | PICANM_NOFULLBRIGHT_BIT = (1<<4), |
777 | PICANM_ANIMSPEED_MASK = 15, // must be 15 |
777 | PICANM_ANIMSPEED_MASK = 15, // must be 15 |
778 | }; |
778 | }; |
779 | 779 | ||
780 | // NOTE: If the layout of this struct is changed, loadpics() must be modified
|
780 | // NOTE: If the layout of this struct is changed, loadpics() must be modified
|
781 | // accordingly.
|
781 | // accordingly.
|
782 | typedef struct { |
782 | typedef struct { |
783 | uint8_t num; // animate number |
783 | uint8_t num; // animate number |
784 | int8_t xofs, yofs; |
784 | int8_t xofs, yofs; |
785 | uint8_t sf; // anim. speed and flags |
785 | uint8_t sf; // anim. speed and flags |
786 | } picanm_t; |
786 | } picanm_t; |
787 | EXTERN picanm_t picanm[MAXTILES]; |
787 | EXTERN picanm_t picanm[MAXTILES]; |
788 | EXTERN intptr_t waloff[MAXTILES]; // stores pointers to cache -- SA |
788 | EXTERN intptr_t waloff[MAXTILES]; // stores pointers to cache -- SA |
789 | 789 | ||
790 | EXTERN int32_t windowpos, windowx, windowy; |
790 | EXTERN int32_t windowpos, windowx, windowy; |
791 | 791 | ||
792 | //These variables are for auto-mapping with the draw2dscreen function.
|
792 | //These variables are for auto-mapping with the draw2dscreen function.
|
793 | //When you load a new board, these bits are all set to 0 - since
|
793 | //When you load a new board, these bits are all set to 0 - since
|
794 | //you haven't mapped out anything yet. Note that these arrays are
|
794 | //you haven't mapped out anything yet. Note that these arrays are
|
795 | //bit-mapped.
|
795 | //bit-mapped.
|
796 | //If you want draw2dscreen() to show sprite #54 then you say:
|
796 | //If you want draw2dscreen() to show sprite #54 then you say:
|
797 | // spritenum = 54;
|
797 | // spritenum = 54;
|
798 | // show2dsprite[spritenum>>3] |= (1<<(spritenum&7));
|
798 | // show2dsprite[spritenum>>3] |= (1<<(spritenum&7));
|
799 | //And if you want draw2dscreen() to not show sprite #54 then you say:
|
799 | //And if you want draw2dscreen() to not show sprite #54 then you say:
|
800 | // spritenum = 54;
|
800 | // spritenum = 54;
|
801 | // show2dsprite[spritenum>>3] &= ~(1<<(spritenum&7));
|
801 | // show2dsprite[spritenum>>3] &= ~(1<<(spritenum&7));
|
802 | 802 | ||
803 | EXTERN char show2dsector[(MAXSECTORS+7)>>3]; |
803 | EXTERN char show2dsector[(MAXSECTORS+7)>>3]; |
804 | EXTERN char show2dwall[(MAXWALLS+7)>>3]; |
804 | EXTERN char show2dwall[(MAXWALLS+7)>>3]; |
805 | EXTERN char show2dsprite[(MAXSPRITES+7)>>3]; |
805 | EXTERN char show2dsprite[(MAXSPRITES+7)>>3]; |
806 | 806 | ||
807 | // In the editor, gotpic is only referenced from inline assembly;
|
807 | // In the editor, gotpic is only referenced from inline assembly;
|
808 | // the compiler needs that hint or building with LTO will discard it.
|
808 | // the compiler needs that hint or building with LTO will discard it.
|
809 | #if !defined __clang__ && !defined NOASM
|
809 | #if !defined __clang__ && !defined NOASM
|
810 | # define GOTPIC_USED ATTRIBUTE((used))
|
810 | # define GOTPIC_USED ATTRIBUTE((used))
|
811 | #else
|
811 | #else
|
812 | # define GOTPIC_USED
|
812 | # define GOTPIC_USED
|
813 | #endif
|
813 | #endif
|
814 | 814 | ||
815 | EXTERN char GOTPIC_USED gotpic[(MAXTILES+7)>>3]; |
815 | EXTERN char GOTPIC_USED gotpic[(MAXTILES+7)>>3]; |
816 | EXTERN char gotsector[(MAXSECTORS+7)>>3]; |
816 | EXTERN char gotsector[(MAXSECTORS+7)>>3]; |
817 | 817 | ||
818 | EXTERN char editorcolors[256]; |
818 | EXTERN char editorcolors[256]; |
819 | 819 | ||
820 | EXTERN int32_t faketilesiz[MAXTILES]; |
820 | EXTERN int32_t faketilesiz[MAXTILES]; |
821 | EXTERN char *faketiledata[MAXTILES]; |
821 | EXTERN char *faketiledata[MAXTILES]; |
822 | 822 | ||
823 | EXTERN char spritecol2d[MAXTILES][2]; |
823 | EXTERN char spritecol2d[MAXTILES][2]; |
824 | extern char vgapal16[4*256]; |
824 | extern char vgapal16[4*256]; |
825 | 825 | ||
826 | extern uint32_t drawlinepat; |
826 | extern uint32_t drawlinepat; |
827 | 827 | ||
828 | extern void faketimerhandler(void); |
828 | extern void faketimerhandler(void); |
829 | 829 | ||
830 | extern char apptitle[256]; |
830 | extern char apptitle[256]; |
831 | typedef struct { |
831 | typedef struct { |
832 | char r,g,b,f; |
832 | char r,g,b,f; |
833 | } palette_t; |
833 | } palette_t; |
834 | extern palette_t curpalette[256], curpalettefaded[256], palfadergb; |
834 | extern palette_t curpalette[256], curpalettefaded[256], palfadergb; |
835 | extern char palfadedelta; |
835 | extern char palfadedelta; |
836 | 836 | ||
837 | extern int8_t g_noFloorPal[MAXPALOOKUPS]; |
837 | extern int8_t g_noFloorPal[MAXPALOOKUPS]; |
838 | 838 | ||
839 | extern int32_t novoxmips; |
839 | extern int32_t novoxmips; |
840 | 840 | ||
841 | #ifdef DEBUGGINGAIDS
|
841 | #ifdef DEBUGGINGAIDS
|
842 | extern float debug1, debug2; |
842 | extern float debug1, debug2; |
843 | #endif
|
843 | #endif
|
844 | 844 | ||
845 | extern int16_t tiletovox[MAXTILES]; |
845 | extern int16_t tiletovox[MAXTILES]; |
846 | extern int32_t usevoxels, voxscale[MAXVOXELS]; |
846 | extern int32_t usevoxels, voxscale[MAXVOXELS]; |
847 | 847 | ||
848 | #ifdef USE_OPENGL
|
848 | #ifdef USE_OPENGL
|
849 | extern int32_t usemodels, usehightile; |
849 | extern int32_t usemodels, usehightile; |
850 | extern int32_t rendmode; |
850 | extern int32_t rendmode; |
851 | #endif
|
851 | #endif
|
852 | EXTERN int32_t h_xsize[MAXTILES], h_ysize[MAXTILES]; |
852 | EXTERN int32_t h_xsize[MAXTILES], h_ysize[MAXTILES]; |
853 | EXTERN int8_t h_xoffs[MAXTILES], h_yoffs[MAXTILES]; |
853 | EXTERN int8_t h_xoffs[MAXTILES], h_yoffs[MAXTILES]; |
854 | 854 | ||
- | 855 | enum { |
|
- | 856 | GLOBAL_NO_GL_TILESHADES = 1<<0, |
|
- | 857 | GLOBAL_NO_GL_FULLBRIGHT = 1<<1, |
|
- | 858 | }; |
|
- | 859 | ||
- | 860 | extern int32_t globalflags; |
|
- | 861 | ||
855 | extern const char *engineerrstr; |
862 | extern const char *engineerrstr; |
856 | 863 | ||
857 | EXTERN int32_t editorzrange[2]; |
864 | EXTERN int32_t editorzrange[2]; |
858 | 865 | ||
859 | FORCE_INLINE int32_t getrendermode(void) |
866 | FORCE_INLINE int32_t getrendermode(void) |
860 | {
|
867 | {
|
861 | #ifndef USE_OPENGL
|
868 | #ifndef USE_OPENGL
|
862 | return REND_CLASSIC; |
869 | return REND_CLASSIC; |
863 | #else
|
870 | #else
|
864 | return rendmode; |
871 | return rendmode; |
865 | #endif
|
872 | #endif
|
866 | }
|
873 | }
|
867 | 874 | ||
868 | /*************************************************************************
|
875 | /*************************************************************************
|
869 | POSITION VARIABLES:
|
876 | POSITION VARIABLES:
|
870 | 877 | ||
871 | POSX is your x - position ranging from 0 to 65535
|
878 | POSX is your x - position ranging from 0 to 65535
|
872 | POSY is your y - position ranging from 0 to 65535
|
879 | POSY is your y - position ranging from 0 to 65535
|
873 | (the length of a side of the grid in EDITBORD would be 1024)
|
880 | (the length of a side of the grid in EDITBORD would be 1024)
|
874 | POSZ is your z - position (height) ranging from 0 to 65535, 0 highest.
|
881 | POSZ is your z - position (height) ranging from 0 to 65535, 0 highest.
|
875 | ANG is your angle ranging from 0 to 2047. Instead of 360 degrees, or
|
882 | ANG is your angle ranging from 0 to 2047. Instead of 360 degrees, or
|
876 | 2 * PI radians, I use 2048 different angles, so 90 degrees would
|
883 | 2 * PI radians, I use 2048 different angles, so 90 degrees would
|
877 | be 512 in my system.
|
884 | be 512 in my system.
|
878 | 885 | ||
879 | SPRITE VARIABLES:
|
886 | SPRITE VARIABLES:
|
880 | 887 | ||
881 | EXTERN short headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1];
|
888 | EXTERN short headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1];
|
882 | EXTERN short prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES];
|
889 | EXTERN short prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES];
|
883 | EXTERN short nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
|
890 | EXTERN short nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
|
884 | 891 | ||
885 | Example: if the linked lists look like the following:
|
892 | Example: if the linked lists look like the following:
|
886 | ????????????????
|
893 | ????????????????
|
887 | Sector lists: Status lists:
|
894 | Sector lists: Status lists:
|
888 | ????????????????J
|
895 | ????????????????J
|
889 | Sector0: 4, 5, 8 Status0: 2, 0, 8
|
896 | Sector0: 4, 5, 8 Status0: 2, 0, 8
|
890 | Sector1: 16, 2, 0, 7 Status1: 4, 5, 16, 7, 3, 9
|
897 | Sector1: 16, 2, 0, 7 Status1: 4, 5, 16, 7, 3, 9
|
891 | Sector2: 3, 9
|
898 | Sector2: 3, 9
|
892 | ????????????????
|
899 | ????????????????
|
893 | Notice that each number listed above is shown exactly once on both the
|
900 | Notice that each number listed above is shown exactly once on both the
|
894 | left and right side. This is because any sprite that exists must
|
901 | left and right side. This is because any sprite that exists must
|
895 | be in some sector, and must have some kind of status that you define.
|
902 | be in some sector, and must have some kind of status that you define.
|
896 | 903 | ||
897 | 904 | ||
898 | Coding example #1:
|
905 | Coding example #1:
|
899 | To go through all the sprites in sector 1, the code can look like this:
|
906 | To go through all the sprites in sector 1, the code can look like this:
|
900 | 907 | ||
901 | sectnum = 1;
|
908 | sectnum = 1;
|
902 | i = headspritesect[sectnum];
|
909 | i = headspritesect[sectnum];
|
903 | while (i != -1)
|
910 | while (i != -1)
|
904 | {
|
911 | {
|
905 | nexti = nextspritesect[i];
|
912 | nexti = nextspritesect[i];
|
906 | 913 | ||
907 | //your code goes here
|
914 | //your code goes here
|
908 | //ex: printf("Sprite %d is in sector %d\n",i,sectnum);
|
915 | //ex: printf("Sprite %d is in sector %d\n",i,sectnum);
|
909 | 916 | ||
910 | i = nexti;
|
917 | i = nexti;
|
911 | }
|
918 | }
|
912 | 919 | ||
913 | Coding example #2:
|
920 | Coding example #2:
|
914 | To go through all sprites with status = 1, the code can look like this:
|
921 | To go through all sprites with status = 1, the code can look like this:
|
915 | 922 | ||
916 | statnum = 1; //status 1
|
923 | statnum = 1; //status 1
|
917 | i = headspritestat[statnum];
|
924 | i = headspritestat[statnum];
|
918 | while (i != -1)
|
925 | while (i != -1)
|
919 | {
|
926 | {
|
920 | nexti = nextspritestat[i];
|
927 | nexti = nextspritestat[i];
|
921 | 928 | ||
922 | //your code goes here
|
929 | //your code goes here
|
923 | //ex: printf("Sprite %d has a status of 1 (active)\n",i,statnum);
|
930 | //ex: printf("Sprite %d has a status of 1 (active)\n",i,statnum);
|
924 | 931 | ||
925 | i = nexti;
|
932 | i = nexti;
|
926 | }
|
933 | }
|
927 | 934 | ||
928 | insertsprite(short sectnum, short statnum);
|
935 | insertsprite(short sectnum, short statnum);
|
929 | deletesprite(short spritenum);
|
936 | deletesprite(short spritenum);
|
930 | changespritesect(short spritenum, short newsectnum);
|
937 | changespritesect(short spritenum, short newsectnum);
|
931 | changespritestat(short spritenum, short newstatnum);
|
938 | changespritestat(short spritenum, short newstatnum);
|
932 | 939 | ||
933 | TILE VARIABLES:
|
940 | TILE VARIABLES:
|
934 | NUMTILES - the number of tiles found TILES.DAT.
|
941 | NUMTILES - the number of tiles found TILES.DAT.
|
935 | TILESIZX[MAXTILES] - simply the x-dimension of the tile number.
|
942 | TILESIZX[MAXTILES] - simply the x-dimension of the tile number.
|
936 | TILESIZY[MAXTILES] - simply the y-dimension of the tile number.
|
943 | TILESIZY[MAXTILES] - simply the y-dimension of the tile number.
|
937 | WALOFF[MAXTILES] - the actual address pointing to the top-left
|
944 | WALOFF[MAXTILES] - the actual address pointing to the top-left
|
938 | corner of the tile.
|
945 | corner of the tile.
|
939 | PICANM[MAXTILES] - flags for animating the tile.
|
946 | PICANM[MAXTILES] - flags for animating the tile.
|
940 | 947 | ||
941 | TIMING VARIABLES:
|
948 | TIMING VARIABLES:
|
942 | TOTALCLOCK - When the engine is initialized, TOTALCLOCK is set to zero.
|
949 | TOTALCLOCK - When the engine is initialized, TOTALCLOCK is set to zero.
|
943 | From then on, it is incremented 120 times a second by 1. That
|
950 | From then on, it is incremented 120 times a second by 1. That
|
944 | means that the number of seconds elapsed is totalclock / 120.
|
951 | means that the number of seconds elapsed is totalclock / 120.
|
945 | NUMFRAMES - The number of times the draw3dscreen function was called
|
952 | NUMFRAMES - The number of times the draw3dscreen function was called
|
946 | since the engine was initialized. This helps to determine frame
|
953 | since the engine was initialized. This helps to determine frame
|
947 | rate. (Frame rate = numframes * 120 / totalclock.)
|
954 | rate. (Frame rate = numframes * 120 / totalclock.)
|
948 | 955 | ||
949 | OTHER VARIABLES:
|
956 | OTHER VARIABLES:
|
950 | 957 | ||
951 | STARTUMOST[320] is an array of the highest y-coordinates on each column
|
958 | STARTUMOST[320] is an array of the highest y-coordinates on each column
|
952 | that my engine is allowed to write to. You need to set it only
|
959 | that my engine is allowed to write to. You need to set it only
|
953 | once.
|
960 | once.
|
954 | STARTDMOST[320] is an array of the lowest y-coordinates on each column
|
961 | STARTDMOST[320] is an array of the lowest y-coordinates on each column
|
955 | that my engine is allowed to write to. You need to set it only
|
962 | that my engine is allowed to write to. You need to set it only
|
956 | once.
|
963 | once.
|
957 | SINTABLE[2048] is a sin table with 2048 angles rather than the
|
964 | SINTABLE[2048] is a sin table with 2048 angles rather than the
|
958 | normal 360 angles for higher precision. Also since SINTABLE is in
|
965 | normal 360 angles for higher precision. Also since SINTABLE is in
|
959 | all integers, the range is multiplied by 16383, so instead of the
|
966 | all integers, the range is multiplied by 16383, so instead of the
|
960 | normal -1<sin(x)<1, the range of sintable is -16383<sintable[]<16383
|
967 | normal -1<sin(x)<1, the range of sintable is -16383<sintable[]<16383
|
961 | If you use this sintable, you can possibly speed up your code as
|
968 | If you use this sintable, you can possibly speed up your code as
|
962 | well as save space in memory. If you plan to use sintable, 2
|
969 | well as save space in memory. If you plan to use sintable, 2
|
963 | identities you may want to keep in mind are:
|
970 | identities you may want to keep in mind are:
|
964 | sintable[ang&2047] = sin(ang * (3.141592/1024)) * 16383
|
971 | sintable[ang&2047] = sin(ang * (3.141592/1024)) * 16383
|
965 | sintable[(ang+512)&2047] = cos(ang * (3.141592/1024)) * 16383
|
972 | sintable[(ang+512)&2047] = cos(ang * (3.141592/1024)) * 16383
|
966 | NUMSECTORS - the total number of existing sectors. Modified every time
|
973 | NUMSECTORS - the total number of existing sectors. Modified every time
|
967 | you call the loadboard function.
|
974 | you call the loadboard function.
|
968 | ***************************************************************************/
|
975 | ***************************************************************************/
|
969 | 976 | ||
970 | typedef struct { |
977 | typedef struct { |
971 | vec3_t pos;
|
978 | vec3_t pos;
|
972 | int16_t sprite, wall, sect; |
979 | int16_t sprite, wall, sect; |
973 | } hitdata_t; |
980 | } hitdata_t; |
974 | 981 | ||
975 | 982 | ||
976 | int32_t preinitengine(void); // a partial setup of the engine used for launch windows |
983 | int32_t preinitengine(void); // a partial setup of the engine used for launch windows |
977 | int32_t initengine(void); |
984 | int32_t initengine(void); |
978 | void uninitengine(void); |
985 | void uninitengine(void); |
979 | void initspritelists(void); |
986 | void initspritelists(void); |
980 | int32_t loadlookups(int32_t fp); |
987 | int32_t loadlookups(int32_t fp); |
981 | void generatefogpals(void); |
988 | void generatefogpals(void); |
982 | void fillemptylookups(void); |
989 | void fillemptylookups(void); |
983 | int32_t loadboard(const char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum); |
990 | int32_t loadboard(const char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum); |
984 | int32_t loadmaphack(const char *filename); |
991 | int32_t loadmaphack(const char *filename); |
985 | void delete_maphack_lights(); |
992 | void delete_maphack_lights(); |
986 | #ifdef HAVE_CLIPSHAPE_FEATURE
|
993 | #ifdef HAVE_CLIPSHAPE_FEATURE
|
987 | int32_t clipmapinfo_load(void); |
994 | int32_t clipmapinfo_load(void); |
988 | #endif
|
995 | #endif
|
989 | int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int16_t dacursectnum); |
996 | int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int16_t dacursectnum); |
990 | void set_tilesiz(int32_t picnum, int16_t dasizx, int16_t dasizy); |
997 | void set_tilesiz(int32_t picnum, int16_t dasizx, int16_t dasizy); |
991 | int32_t tile_exists(int32_t picnum); |
998 | int32_t tile_exists(int32_t picnum); |
992 | int32_t loadpics(const char *filename, int32_t askedsize); |
999 | int32_t loadpics(const char *filename, int32_t askedsize); |
993 | void E_MapArt_Clear(void); |
1000 | void E_MapArt_Clear(void); |
994 | void E_MapArt_Setup(const char *filename); |
1001 | void E_MapArt_Setup(const char *filename); |
995 | void loadtile(int16_t tilenume); |
1002 | void loadtile(int16_t tilenume); |
996 | int32_t qloadkvx(int32_t voxindex, const char *filename); |
1003 | int32_t qloadkvx(int32_t voxindex, const char *filename); |
997 | intptr_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz); |
1004 | intptr_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz); |
998 | void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2); |
1005 | void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2); |
999 | void makepalookup(int32_t palnum, const char *remapbuf, int8_t r, int8_t g, int8_t b, char noFloorPal); |
1006 | void makepalookup(int32_t palnum, const char *remapbuf, int8_t r, int8_t g, int8_t b, char noFloorPal); |
1000 | //void setvgapalette(void);
|
1007 | //void setvgapalette(void);
|
1001 | void setbasepaltable(uint8_t **basepaltable, uint8_t basepalcount); |
1008 | void setbasepaltable(uint8_t **basepaltable, uint8_t basepalcount); |
1002 | void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags); |
1009 | void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags); |
1003 | void setpalettefade(char r, char g, char b, char offset); |
1010 | void setpalettefade(char r, char g, char b, char offset); |
1004 | void squarerotatetile(int16_t tilenume); |
1011 | void squarerotatetile(int16_t tilenume); |
1005 | void fade_screen_black(int32_t moreopaquep); |
1012 | void fade_screen_black(int32_t moreopaquep); |
1006 | 1013 | ||
1007 | int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp); |
1014 | int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp); |
1008 | void nextpage(void); |
1015 | void nextpage(void); |
1009 | void setaspect_new(); |
1016 | void setaspect_new(); |
1010 | void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2); |
1017 | void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2); |
1011 | void setaspect(int32_t daxrange, int32_t daaspect); |
1018 | void setaspect(int32_t daxrange, int32_t daaspect); |
1012 | void flushperms(void); |
1019 | void flushperms(void); |
1013 | 1020 | ||
1014 | void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, char col) ATTRIBUTE((nonnull(1,2))); |
1021 | void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, char col) ATTRIBUTE((nonnull(1,2))); |
1015 | 1022 | ||
1016 | void plotpixel(int32_t x, int32_t y, char col); |
1023 | void plotpixel(int32_t x, int32_t y, char col); |
1017 | char getpixel(int32_t x, int32_t y); |
1024 | char getpixel(int32_t x, int32_t y); |
1018 | void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz); |
1025 | void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz); |
1019 | void setviewback(void); |
1026 | void setviewback(void); |
1020 | void preparemirror(int32_t dax, int32_t day, int16_t daang, int16_t dawall, |
1027 | void preparemirror(int32_t dax, int32_t day, int16_t daang, int16_t dawall, |
1021 | int32_t *tposx, int32_t *tposy, int16_t *tang); |
1028 | int32_t *tposx, int32_t *tposy, int16_t *tang); |
1022 | void completemirror(void); |
1029 | void completemirror(void); |
1023 | 1030 | ||
1024 | int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, |
1031 | int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, |
1025 | int16_t daang, int32_t dahoriz, int16_t dacursectnum); |
1032 | int16_t daang, int32_t dahoriz, int16_t dacursectnum); |
1026 | void drawmasks(void); |
1033 | void drawmasks(void); |
1027 | void clearview(int32_t dacol); |
1034 | void clearview(int32_t dacol); |
1028 | void clearallviews(int32_t dacol); |
1035 | void clearallviews(int32_t dacol); |
1029 | void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang); |
1036 | void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang); |
1030 | void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, |
1037 | void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, |
1031 | int8_t dashade, char dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, |
1038 | int8_t dashade, char dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, |
1032 | int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2); |
1039 | int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2); |
1033 | void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col); |
1040 | void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col); |
1034 | int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, |
1041 | int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, |
1035 | const char *name, char fontsize) ATTRIBUTE((nonnull(5))); |
1042 | const char *name, char fontsize) ATTRIBUTE((nonnull(5))); |
1036 | void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, |
1043 | void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, |
1037 | const char *name, char fontsize) ATTRIBUTE((nonnull(5))); |
1044 | const char *name, char fontsize) ATTRIBUTE((nonnull(5))); |
1038 | 1045 | ||
1039 | ////////// specialized rotatesprite wrappers for (very) often used cases //////////
|
1046 | ////////// specialized rotatesprite wrappers for (very) often used cases //////////
|
1040 | FORCE_INLINE void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, |
1047 | FORCE_INLINE void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, |
1041 | int8_t dashade, char dapalnum, int32_t dastat, |
1048 | int8_t dashade, char dapalnum, int32_t dastat, |
1042 | int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2) |
1049 | int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2) |
1043 | {
|
1050 | {
|
1044 | rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, cx1, cy1, cx2, cy2); |
1051 | rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, cx1, cy1, cx2, cy2); |
1045 | }
|
1052 | }
|
1046 | // Don't clip at all, i.e. the whole screen real estate is available:
|
1053 | // Don't clip at all, i.e. the whole screen real estate is available:
|
1047 | FORCE_INLINE void rotatesprite_fs(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, |
1054 | FORCE_INLINE void rotatesprite_fs(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, |
1048 | int8_t dashade, char dapalnum, int32_t dastat) |
1055 | int8_t dashade, char dapalnum, int32_t dastat) |
1049 | {
|
1056 | {
|
1050 | rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, 0,0,xdim-1,ydim-1); |
1057 | rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, 0,0,xdim-1,ydim-1); |
1051 | }
|
1058 | }
|
1052 | 1059 | ||
1053 | FORCE_INLINE void rotatesprite_fs_alpha(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, |
1060 | FORCE_INLINE void rotatesprite_fs_alpha(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, |
1054 | int8_t dashade, char dapalnum, int32_t dastat, uint8_t alpha) |
1061 | int8_t dashade, char dapalnum, int32_t dastat, uint8_t alpha) |
1055 | {
|
1062 | {
|
1056 | rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, alpha, 0, 0, 0, xdim-1, ydim-1); |
1063 | rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, alpha, 0, 0, 0, xdim-1, ydim-1); |
1057 | }
|
1064 | }
|
1058 | 1065 | ||
1059 | FORCE_INLINE void rotatesprite_win(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, |
1066 | FORCE_INLINE void rotatesprite_win(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, |
1060 | int8_t dashade, char dapalnum, int32_t dastat) |
1067 | int8_t dashade, char dapalnum, int32_t dastat) |
1061 | {
|
1068 | {
|
1062 | rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, windowx1,windowy1,windowx2,windowy2); |
1069 | rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, windowx1,windowy1,windowx2,windowy2); |
1063 | }
|
1070 | }
|
1064 | 1071 | ||
1065 | void bfirst_search_init(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int32_t maxnum, int16_t firstelt); |
1072 | void bfirst_search_init(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int32_t maxnum, int16_t firstelt); |
1066 | void bfirst_search_try(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int16_t elt); |
1073 | void bfirst_search_try(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int16_t elt); |
1067 | 1074 | ||
1068 | int32_t clipmove(vec3_t *vect, int16_t *sectnum, int32_t xvect, int32_t yvect, int32_t walldist, |
1075 | int32_t clipmove(vec3_t *vect, int16_t *sectnum, int32_t xvect, int32_t yvect, int32_t walldist, |
1069 | int32_t ceildist, int32_t flordist, uint32_t cliptype) ATTRIBUTE((nonnull(1,2))); |
1076 | int32_t ceildist, int32_t flordist, uint32_t cliptype) ATTRIBUTE((nonnull(1,2))); |
1070 | int32_t clipmovex(vec3_t *pos, int16_t *sectnum, int32_t xvect, int32_t yvect, |
1077 | int32_t clipmovex(vec3_t *pos, int16_t *sectnum, int32_t xvect, int32_t yvect, |
1071 | int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype, |
1078 | int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype, |
1072 | uint8_t noslidep) ATTRIBUTE((nonnull(1,2))); |
1079 | uint8_t noslidep) ATTRIBUTE((nonnull(1,2))); |
1073 | int32_t clipinsidebox(int32_t x, int32_t y, int16_t wallnum, int32_t walldist); |
1080 | int32_t clipinsidebox(int32_t x, int32_t y, int16_t wallnum, int32_t walldist); |
1074 | int32_t clipinsideboxline(int32_t x, int32_t y, int32_t x1, int32_t y1, |
1081 | int32_t clipinsideboxline(int32_t x, int32_t y, int32_t x1, int32_t y1, |
1075 | int32_t x2, int32_t y2, int32_t walldist); |
1082 | int32_t x2, int32_t y2, int32_t walldist); |
1076 | int32_t pushmove(vec3_t *vect, int16_t *sectnum, int32_t walldist, |
1083 | int32_t pushmove(vec3_t *vect, int16_t *sectnum, int32_t walldist, |
1077 | int32_t ceildist, int32_t flordist, uint32_t cliptype) ATTRIBUTE((nonnull(1,2))); |
1084 | int32_t ceildist, int32_t flordist, uint32_t cliptype) ATTRIBUTE((nonnull(1,2))); |
1078 | void getzrange(const vec3_t *vect, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz, |
1085 | void getzrange(const vec3_t *vect, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz, |
1079 | int32_t *florhit, int32_t walldist, uint32_t cliptype) ATTRIBUTE((nonnull(1,3,4,5,6))); |
1086 | int32_t *florhit, int32_t walldist, uint32_t cliptype) ATTRIBUTE((nonnull(1,3,4,5,6))); |
1080 | int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, |
1087 | int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, |
1081 | hitdata_t *hitinfo, uint32_t cliptype) ATTRIBUTE((nonnull(1,6))); |
1088 | hitdata_t *hitinfo, uint32_t cliptype) ATTRIBUTE((nonnull(1,6))); |
1082 | void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, |
1089 | void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, |
1083 | int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, |
1090 | int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, |
1084 | int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch, |
1091 | int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch, |
1085 | int32_t (*blacklist_sprite_func)(int32_t)) ATTRIBUTE((nonnull(6,7,8))); |
1092 | int32_t (*blacklist_sprite_func)(int32_t)) ATTRIBUTE((nonnull(6,7,8))); |
1086 | int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, |
1093 | int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, |
1087 | int32_t x2, int32_t y2, int32_t z2, int16_t sect2); |
1094 | int32_t x2, int32_t y2, int32_t z2, int16_t sect2); |
1088 | void updatesector(int32_t x, int32_t y, int16_t *sectnum) ATTRIBUTE((nonnull(3))); |
1095 | void updatesector(int32_t x, int32_t y, int16_t *sectnum) ATTRIBUTE((nonnull(3))); |
1089 | void updatesectorbreadth(int32_t x, int32_t y, int16_t *sectnum) ATTRIBUTE((nonnull(3))); |
1096 | void updatesectorbreadth(int32_t x, int32_t y, int16_t *sectnum) ATTRIBUTE((nonnull(3))); |
1090 | void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum, |
1097 | void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum, |
1091 | const uint8_t *excludesectbitmap) ATTRIBUTE((nonnull(3,4))); |
1098 | const uint8_t *excludesectbitmap) ATTRIBUTE((nonnull(3,4))); |
1092 | void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum) ATTRIBUTE((nonnull(4))); |
1099 | void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum) ATTRIBUTE((nonnull(4))); |
1093 | int32_t inside(int32_t x, int32_t y, int16_t sectnum); |
1100 | int32_t inside(int32_t x, int32_t y, int16_t sectnum); |
1094 | void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day, uint8_t flags); |
1101 | void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day, uint8_t flags); |
1095 | void setfirstwall(int16_t sectnum, int16_t newfirstwall); |
1102 | void setfirstwall(int16_t sectnum, int16_t newfirstwall); |
1096 | 1103 | ||
1097 | extern const int16_t *chsecptr_onextwall; |
1104 | extern const int16_t *chsecptr_onextwall; |
1098 | int32_t checksectorpointer(int16_t i, int16_t sectnum); |
1105 | int32_t checksectorpointer(int16_t i, int16_t sectnum); |
1099 | 1106 | ||
1100 | void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) ATTRIBUTE((nonnull(1,2,3))); |
1107 | void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) ATTRIBUTE((nonnull(1,2,3))); |
1101 | 1108 | ||
1102 | #if !KRANDDEBUG && !defined LUNATIC
|
1109 | #if !KRANDDEBUG && !defined LUNATIC
|
1103 | FORCE_INLINE int32_t krand(void) |
1110 | FORCE_INLINE int32_t krand(void) |
1104 | {
|
1111 | {
|
1105 | randomseed = (randomseed * 1664525ul) + 221297ul; |
1112 | randomseed = (randomseed * 1664525ul) + 221297ul; |
1106 | return ((uint32_t) randomseed)>>16; |
1113 | return ((uint32_t) randomseed)>>16; |
1107 | }
|
1114 | }
|
1108 | #else
|
1115 | #else
|
1109 | int32_t krand(void); |
1116 | int32_t krand(void); |
1110 | #endif
|
1117 | #endif
|
1111 | 1118 | ||
1112 | int32_t ksqrt(uint32_t num); |
1119 | int32_t ksqrt(uint32_t num); |
1113 | int32_t __fastcall getangle(int32_t xvect, int32_t yvect); |
1120 | int32_t __fastcall getangle(int32_t xvect, int32_t yvect); |
1114 | 1121 | ||
1115 | FORCE_INLINE uint32_t uhypsq(int32_t dx, int32_t dy) |
1122 | FORCE_INLINE uint32_t uhypsq(int32_t dx, int32_t dy) |
1116 | {
|
1123 | {
|
1117 | return (uint32_t)dx*dx + (uint32_t)dy*dy; |
1124 | return (uint32_t)dx*dx + (uint32_t)dy*dy; |
1118 | }
|
1125 | }
|
1119 | 1126 | ||
1120 | FORCE_INLINE int32_t logapproach(int32_t val, int32_t targetval) |
1127 | FORCE_INLINE int32_t logapproach(int32_t val, int32_t targetval) |
1121 | {
|
1128 | {
|
1122 | int32_t dif = targetval - val; |
1129 | int32_t dif = targetval - val; |
1123 | return (dif>>1) ? val + (dif>>1) : targetval; |
1130 | return (dif>>1) ? val + (dif>>1) : targetval; |
1124 | }
|
1131 | }
|
1125 | 1132 | ||
1126 | void rotatepoint(int32_t xpivot, int32_t ypivot, int32_t x, int32_t y, |
1133 | void rotatepoint(int32_t xpivot, int32_t ypivot, int32_t x, int32_t y, |
1127 | int16_t daang, int32_t *x2, int32_t *y2) ATTRIBUTE((nonnull(6,7))); |
1134 | int16_t daang, int32_t *x2, int32_t *y2) ATTRIBUTE((nonnull(6,7))); |
1128 | int32_t lastwall(int16_t point); |
1135 | int32_t lastwall(int16_t point); |
1129 | int32_t nextsectorneighborz(int16_t sectnum, int32_t refz, int16_t topbottom, int16_t direction); |
1136 | int32_t nextsectorneighborz(int16_t sectnum, int32_t refz, int16_t topbottom, int16_t direction); |
1130 | 1137 | ||
1131 | int32_t getceilzofslopeptr(const sectortype *sec, int32_t dax, int32_t day) ATTRIBUTE((nonnull(1))); |
1138 | int32_t getceilzofslopeptr(const sectortype *sec, int32_t dax, int32_t day) ATTRIBUTE((nonnull(1))); |
1132 | int32_t getflorzofslopeptr(const sectortype *sec, int32_t dax, int32_t day) ATTRIBUTE((nonnull(1))); |
1139 | int32_t getflorzofslopeptr(const sectortype *sec, int32_t dax, int32_t day) ATTRIBUTE((nonnull(1))); |
1133 | void getzsofslopeptr(const sectortype *sec, int32_t dax, int32_t day, |
1140 | void getzsofslopeptr(const sectortype *sec, int32_t dax, int32_t day, |
1134 | int32_t *ceilz, int32_t *florz) ATTRIBUTE((nonnull(1,4,5))); |
1141 | int32_t *ceilz, int32_t *florz) ATTRIBUTE((nonnull(1,4,5))); |
1135 | 1142 | ||
1136 | FORCE_INLINE int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day) |
1143 | FORCE_INLINE int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day) |
1137 | {
|
1144 | {
|
1138 | return getceilzofslopeptr(§or[sectnum], dax, day); |
1145 | return getceilzofslopeptr(§or[sectnum], dax, day); |
1139 | }
|
1146 | }
|
1140 | 1147 | ||
1141 | FORCE_INLINE int32_t getflorzofslope(int16_t sectnum, int32_t dax, int32_t day) |
1148 | FORCE_INLINE int32_t getflorzofslope(int16_t sectnum, int32_t dax, int32_t day) |
1142 | {
|
1149 | {
|
1143 | return getflorzofslopeptr(§or[sectnum], dax, day); |
1150 | return getflorzofslopeptr(§or[sectnum], dax, day); |
1144 | }
|
1151 | }
|
1145 | 1152 | ||
1146 | FORCE_INLINE void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz) |
1153 | FORCE_INLINE void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz) |
1147 | {
|
1154 | {
|
1148 | getzsofslopeptr(§or[sectnum], dax, day, ceilz, florz); |
1155 | getzsofslopeptr(§or[sectnum], dax, day, ceilz, florz); |
1149 | }
|
1156 | }
|
1150 | 1157 | ||
1151 | // Is <wal> a red wall in a safe fashion, i.e. only if consistency invariant
|
1158 | // Is <wal> a red wall in a safe fashion, i.e. only if consistency invariant
|
1152 | // ".nextsector >= 0 iff .nextwall >= 0" holds.
|
1159 | // ".nextsector >= 0 iff .nextwall >= 0" holds.
|
1153 | FORCE_INLINE int32_t redwallp(const walltype *wal) |
1160 | FORCE_INLINE int32_t redwallp(const walltype *wal) |
1154 | {
|
1161 | {
|
1155 | return (wal->nextwall >= 0 && wal->nextsector >= 0); |
1162 | return (wal->nextwall >= 0 && wal->nextsector >= 0); |
1156 | }
|
1163 | }
|
1157 | 1164 | ||
1158 | FORCE_INLINE int32_t E_SpriteIsValid(const int32_t i) |
1165 | FORCE_INLINE int32_t E_SpriteIsValid(const int32_t i) |
1159 | {
|
1166 | {
|
1160 | return ((unsigned)i < MAXSPRITES && sprite[i].statnum != MAXSTATUS); |
1167 | return ((unsigned)i < MAXSPRITES && sprite[i].statnum != MAXSTATUS); |
1161 | }
|
1168 | }
|
1162 | 1169 | ||
1163 | int32_t clipshape_idx_for_sprite(spritetype *curspr, int32_t curidx); |
1170 | int32_t clipshape_idx_for_sprite(spritetype *curspr, int32_t curidx); |
1164 | 1171 | ||
1165 | void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z); |
1172 | void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z); |
1166 | void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z); |
1173 | void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z); |
1167 | int32_t sectorofwall(int16_t theline); |
1174 | int32_t sectorofwall(int16_t theline); |
1168 | int32_t sectorofwall_noquick(int16_t theline); |
1175 | int32_t sectorofwall_noquick(int16_t theline); |
1169 | int32_t loopnumofsector(int16_t sectnum, int16_t wallnum); |
1176 | int32_t loopnumofsector(int16_t sectnum, int16_t wallnum); |
1170 | void setslope(int32_t sectnum, int32_t cf, int16_t slope); |
1177 | void setslope(int32_t sectnum, int32_t cf, int16_t slope); |
1171 | 1178 | ||
1172 | int32_t lintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_t y2, int32_t z2, int32_t x3, |
1179 | int32_t lintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_t y2, int32_t z2, int32_t x3, |
1173 | int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz); |
1180 | int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz); |
1174 | 1181 | ||
1175 | int32_t rayintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy, int32_t vz, int32_t x3, |
1182 | int32_t rayintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy, int32_t vz, int32_t x3, |
1176 | int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz); |
1183 | int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz); |
1177 | #if !defined NETCODE_DISABLE
|
1184 | #if !defined NETCODE_DISABLE
|
1178 | void do_insertsprite_at_headofstat(int16_t spritenum, int16_t statnum); |
1185 | void do_insertsprite_at_headofstat(int16_t spritenum, int16_t statnum); |
1179 | int32_t insertspritestat(int16_t statnum); |
1186 | int32_t insertspritestat(int16_t statnum); |
1180 | void do_insertsprite_at_headofsect(int16_t spritenum, int16_t sectnum); |
1187 | void do_insertsprite_at_headofsect(int16_t spritenum, int16_t sectnum); |
1181 | void do_deletespritesect(int16_t deleteme); |
1188 | void do_deletespritesect(int16_t deleteme); |
1182 | #endif
|
1189 | #endif
|
1183 | int32_t insertsprite(int16_t sectnum, int16_t statnum); |
1190 | int32_t insertsprite(int16_t sectnum, int16_t statnum); |
1184 | int32_t deletesprite(int16_t spritenum); |
1191 | int32_t deletesprite(int16_t spritenum); |
1185 | 1192 | ||
1186 | int32_t changespritesect(int16_t spritenum, int16_t newsectnum); |
1193 | int32_t changespritesect(int16_t spritenum, int16_t newsectnum); |
1187 | int32_t changespritestat(int16_t spritenum, int16_t newstatnum); |
1194 | int32_t changespritestat(int16_t spritenum, int16_t newstatnum); |
1188 | int32_t setsprite(int16_t spritenum, const vec3_t *) ATTRIBUTE((nonnull(2))); |
1195 | int32_t setsprite(int16_t spritenum, const vec3_t *) ATTRIBUTE((nonnull(2))); |
1189 | int32_t setspritez(int16_t spritenum, const vec3_t *) ATTRIBUTE((nonnull(2))); |
1196 | int32_t setspritez(int16_t spritenum, const vec3_t *) ATTRIBUTE((nonnull(2))); |
1190 | 1197 | ||
1191 | int32_t spriteheightofsptr(const spritetype *spr, int32_t *height, int32_t alsotileyofs); |
1198 | int32_t spriteheightofsptr(const spritetype *spr, int32_t *height, int32_t alsotileyofs); |
1192 | FORCE_INLINE int32_t spriteheightofs(int16_t i, int32_t *height, int32_t alsotileyofs) |
1199 | FORCE_INLINE int32_t spriteheightofs(int16_t i, int32_t *height, int32_t alsotileyofs) |
1193 | {
|
1200 | {
|
1194 | return spriteheightofsptr(&sprite[i], height, alsotileyofs); |
1201 | return spriteheightofsptr(&sprite[i], height, alsotileyofs); |
1195 | }
|
1202 | }
|
1196 | 1203 | ||
1197 | int32_t screencapture(const char *filename, char inverseit, const char *versionstr) ATTRIBUTE((nonnull(1))); |
1204 | int32_t screencapture(const char *filename, char inverseit, const char *versionstr) ATTRIBUTE((nonnull(1))); |
1198 | 1205 | ||
1199 | int32_t getclosestcol_lim(int32_t r, int32_t g, int32_t b, int32_t lastokcol); |
1206 | int32_t getclosestcol_lim(int32_t r, int32_t g, int32_t b, int32_t lastokcol); |
1200 | 1207 | ||
1201 | FORCE_INLINE int32_t getclosestcol(int32_t r, int32_t g, int32_t b) |
1208 | FORCE_INLINE int32_t getclosestcol(int32_t r, int32_t g, int32_t b) |
1202 | {
|
1209 | {
|
1203 | return getclosestcol_lim(r, g, b, 255); |
1210 | return getclosestcol_lim(r, g, b, 255); |
1204 | }
|
1211 | }
|
1205 | 1212 | ||
1206 | // PLAG: line utility functions
|
1213 | // PLAG: line utility functions
|
1207 | typedef struct s_equation { |
1214 | typedef struct s_equation { |
1208 | float a, b, c; |
1215 | float a, b, c; |
1209 | } _equation; |
1216 | } _equation; |
1210 | int32_t wallvisible(int32_t x, int32_t y, int16_t wallnum); |
1217 | int32_t wallvisible(int32_t x, int32_t y, int16_t wallnum); |
1211 | 1218 | ||
1212 | #define STATUS2DSIZ 144
|
1219 | #define STATUS2DSIZ 144
|
1213 | #define STATUS2DSIZ2 26
|
1220 | #define STATUS2DSIZ2 26
|
1214 | 1221 | ||
1215 | //void qsetmode640350(void);
|
1222 | //void qsetmode640350(void);
|
1216 | //void qsetmode640480(void);
|
1223 | //void qsetmode640480(void);
|
1217 | void qsetmodeany(int32_t,int32_t); |
1224 | void qsetmodeany(int32_t,int32_t); |
1218 | void clear2dscreen(void); |
1225 | void clear2dscreen(void); |
1219 | void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, |
1226 | void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, |
1220 | int16_t ange, int32_t zoome, int16_t gride); |
1227 | int16_t ange, int32_t zoome, int16_t gride); |
1221 | void draw2dscreen(const vec3_t *pos, int16_t cursectnum, |
1228 | void draw2dscreen(const vec3_t *pos, int16_t cursectnum, |
1222 | int16_t ange, int32_t zoome, int16_t gride) ATTRIBUTE((nonnull(1))); |
1229 | int16_t ange, int32_t zoome, int16_t gride) ATTRIBUTE((nonnull(1))); |
1223 | int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col); |
1230 | int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col); |
1224 | void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col); |
1231 | void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col); |
1225 | 1232 | ||
1226 | int32_t setrendermode(int32_t renderer); |
1233 | int32_t setrendermode(int32_t renderer); |
1227 | 1234 | ||
1228 | #ifdef USE_OPENGL
|
1235 | #ifdef USE_OPENGL
|
1229 | void setrollangle(int32_t rolla); |
1236 | void setrollangle(int32_t rolla); |
1230 | #endif
|
1237 | #endif
|
1231 | 1238 | ||
1232 | // pal: pass -1 to invalidate all palettes for the tile, or >=0 for a particular palette
|
1239 | // pal: pass -1 to invalidate all palettes for the tile, or >=0 for a particular palette
|
1233 | // how: pass -1 to invalidate all instances of the tile in texture memory, or a bitfield
|
1240 | // how: pass -1 to invalidate all instances of the tile in texture memory, or a bitfield
|
1234 | // bit 0: opaque or masked (non-translucent) texture, using repeating
|
1241 | // bit 0: opaque or masked (non-translucent) texture, using repeating
|
1235 | // bit 1: ignored
|
1242 | // bit 1: ignored
|
1236 | // bit 2: 33% translucence, using repeating
|
1243 | // bit 2: 33% translucence, using repeating
|
1237 | // bit 3: 67% translucence, using repeating
|
1244 | // bit 3: 67% translucence, using repeating
|
1238 | // bit 4: opaque or masked (non-translucent) texture, using clamping
|
1245 | // bit 4: opaque or masked (non-translucent) texture, using clamping
|
1239 | // bit 5: ignored
|
1246 | // bit 5: ignored
|
1240 | // bit 6: 33% translucence, using clamping
|
1247 | // bit 6: 33% translucence, using clamping
|
1241 | // bit 7: 67% translucence, using clamping
|
1248 | // bit 7: 67% translucence, using clamping
|
1242 | // clamping is for sprites, repeating is for walls
|
1249 | // clamping is for sprites, repeating is for walls
|
1243 | void invalidatetile(int16_t tilenume, int32_t pal, int32_t how); |
1250 | void invalidatetile(int16_t tilenume, int32_t pal, int32_t how); |
1244 | 1251 | ||
1245 | void setpolymost2dview(void); // sets up GL for 2D drawing |
1252 | void setpolymost2dview(void); // sets up GL for 2D drawing |
1246 | 1253 | ||
1247 | int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen, int32_t tilezoom, |
1254 | int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen, int32_t tilezoom, |
1248 | int32_t usehitile, uint8_t *loadedhitile); |
1255 | int32_t usehitile, uint8_t *loadedhitile); |
1249 | void polymost_glreset(void); |
1256 | void polymost_glreset(void); |
1250 | void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype); |
1257 | void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype); |
1251 | 1258 | ||
1252 | #ifdef USE_OPENGL
|
1259 | #ifdef USE_OPENGL
|
1253 | extern int32_t glanisotropy; |
1260 | extern int32_t glanisotropy; |
1254 | extern int32_t glusetexcompr; |
1261 | extern int32_t glusetexcompr; |
1255 | extern int32_t gltexfiltermode; |
1262 | extern int32_t gltexfiltermode; |
1256 | extern int32_t glredbluemode; |
1263 | extern int32_t glredbluemode; |
1257 | extern int32_t glusetexcache, glusememcache; |
1264 | extern int32_t glusetexcache, glusememcache; |
1258 | extern int32_t glmultisample, glnvmultisamplehint; |
1265 | extern int32_t glmultisample, glnvmultisamplehint; |
1259 | extern int32_t glprojectionhacks; |
1266 | extern int32_t glprojectionhacks; |
1260 | extern int32_t gltexmaxsize; |
1267 | extern int32_t gltexmaxsize; |
1261 | void gltexapplyprops (void); |
1268 | void gltexapplyprops (void); |
1262 | void texcache_invalidate(void); |
1269 | void texcache_invalidate(void); |
1263 | 1270 | ||
1264 | #ifndef EDUKE32_GLES
|
1271 | #ifndef EDUKE32_GLES
|
1265 | extern int32_t r_detailmapping; |
1272 | extern int32_t r_detailmapping; |
1266 | extern int32_t r_glowmapping; |
1273 | extern int32_t r_glowmapping; |
1267 | #endif
|
1274 | #endif
|
1268 | 1275 | ||
1269 | extern int32_t r_vertexarrays; |
1276 | extern int32_t r_vertexarrays; |
1270 | extern int32_t r_vbos; |
1277 | extern int32_t r_vbos; |
1271 | extern int32_t r_vbocount; |
1278 | extern int32_t r_vbocount; |
1272 | extern int32_t r_animsmoothing; |
1279 | extern int32_t r_animsmoothing; |
1273 | extern int32_t r_parallaxskyclamping; |
1280 | extern int32_t r_parallaxskyclamping; |
1274 | extern int32_t r_parallaxskypanning; |
1281 | extern int32_t r_parallaxskypanning; |
1275 | extern int32_t r_fullbrights; |
1282 | extern int32_t r_fullbrights; |
1276 | extern int32_t r_downsize; |
1283 | extern int32_t r_downsize; |
1277 | extern int32_t r_downsizevar; |
1284 | extern int32_t r_downsizevar; |
1278 | extern int32_t mdtims, omdtims; |
1285 | extern int32_t mdtims, omdtims; |
1279 | extern int32_t glrendmode; |
1286 | extern int32_t glrendmode; |
1280 | #endif
|
1287 | #endif
|
1281 | 1288 | ||
1282 | void hicinit(void); |
1289 | void hicinit(void); |
1283 | // effect bitset: 1 = greyscale, 2 = invert
|
1290 | // effect bitset: 1 = greyscale, 2 = invert
|
1284 | void hicsetpalettetint(int32_t palnum, char r, char g, char b, char effect); |
1291 | void hicsetpalettetint(int32_t palnum, char r, char g, char b, char effect); |
1285 | // flags bitset: 1 = don't compress
|
1292 | // flags bitset: 1 = don't compress
|
1286 | int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, const char *filen, float alphacut, |
1293 | int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, const char *filen, float alphacut, |
1287 | float xscale, float yscale, float specpower, float specfactor, char flags); |
1294 | float xscale, float yscale, float specpower, float specfactor, char flags); |
1288 | int32_t hicsetskybox(int32_t picnum, int32_t palnum, char *faces[6], int32_t flags); |
1295 | int32_t hicsetskybox(int32_t picnum, int32_t palnum, char *faces[6], int32_t flags); |
1289 | int32_t hicclearsubst(int32_t picnum, int32_t palnum); |
1296 | int32_t hicclearsubst(int32_t picnum, int32_t palnum); |
1290 | 1297 | ||
1291 | int32_t Ptile2tile(int32_t tile, int32_t pallet) ATTRIBUTE((pure)); |
1298 | int32_t Ptile2tile(int32_t tile, int32_t pallet) ATTRIBUTE((pure)); |
1292 | int32_t md_loadmodel(const char *fn); |
1299 | int32_t md_loadmodel(const char *fn); |
1293 | int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, float yoffset, int32_t flags); |
1300 | int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, float yoffset, int32_t flags); |
1294 | // int32_t md_tilehasmodel(int32_t tilenume, int32_t pal);
|
1301 | // int32_t md_tilehasmodel(int32_t tilenume, int32_t pal);
|
1295 | 1302 | ||
1296 | extern const char *G_DefaultDefFile(void); |
1303 | extern const char *G_DefaultDefFile(void); |
1297 | extern const char *G_DefFile(void); |
1304 | extern const char *G_DefFile(void); |
1298 | extern char *g_defNamePtr; |
1305 | extern char *g_defNamePtr; |
1299 | 1306 | ||
1300 | extern char **g_defModules; |
1307 | extern char **g_defModules; |
1301 | extern int32_t g_defModulesNum; |
1308 | extern int32_t g_defModulesNum; |
1302 | 1309 | ||
1303 | #ifdef HAVE_CLIPSHAPE_FEATURE
|
1310 | #ifdef HAVE_CLIPSHAPE_FEATURE
|
1304 | extern char **g_clipMapFiles; |
1311 | extern char **g_clipMapFiles; |
1305 | extern int32_t g_clipMapFilesNum; |
1312 | extern int32_t g_clipMapFilesNum; |
1306 | #endif
|
1313 | #endif
|
1307 | 1314 | ||
1308 | #ifdef USE_OPENGL
|
1315 | #ifdef USE_OPENGL
|
1309 | typedef struct |
1316 | typedef struct |
1310 | {
|
1317 | {
|
1311 | // maps build tiles to particular animation frames of a model
|
1318 | // maps build tiles to particular animation frames of a model
|
1312 | int32_t modelid; |
1319 | int32_t modelid; |
1313 | int32_t skinnum; |
1320 | int32_t skinnum; |
1314 | int32_t framenum; // calculate the number from the name when declaring |
1321 | int32_t framenum; // calculate the number from the name when declaring |
1315 | float smoothduration; |
1322 | float smoothduration; |
1316 | int32_t next; |
1323 | int32_t next; |
1317 | char pal; |
1324 | char pal; |
1318 | } tile2model_t; |
1325 | } tile2model_t; |
1319 | 1326 | ||
1320 | # define EXTRATILES (MAXTILES/8)
|
1327 | # define EXTRATILES (MAXTILES/8)
|
1321 | 1328 | ||
1322 | EXTERN int32_t mdinited; |
1329 | EXTERN int32_t mdinited; |
1323 | EXTERN tile2model_t tile2model[MAXTILES+EXTRATILES]; |
1330 | EXTERN tile2model_t tile2model[MAXTILES+EXTRATILES]; |
1324 | 1331 | ||
1325 | FORCE_INLINE int32_t md_tilehasmodel(int32_t tilenume,int32_t pal) |
1332 | FORCE_INLINE int32_t md_tilehasmodel(int32_t tilenume,int32_t pal) |
1326 | {
|
1333 | {
|
1327 | return mdinited ? tile2model[Ptile2tile(tilenume,pal)].modelid : -1; |
1334 | return mdinited ? tile2model[Ptile2tile(tilenume,pal)].modelid : -1; |
1328 | }
|
1335 | }
|
1329 | #endif // defined USE_OPENGL
|
1336 | #endif // defined USE_OPENGL
|
1330 | 1337 | ||
1331 | int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, |
1338 | int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, |
1332 | int32_t skinnum, float smoothduration, int32_t pal); |
1339 | int32_t skinnum, float smoothduration, int32_t pal); |
1333 | int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *frameend, |
1340 | int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *frameend, |
1334 | int32_t fps, int32_t flags); |
1341 | int32_t fps, int32_t flags); |
1335 | int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32_t skinnum, |
1342 | int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32_t skinnum, |
1336 | int32_t surfnum, float param, float specpower, float specfactor); |
1343 | int32_t surfnum, float param, float specpower, float specfactor); |
1337 | int32_t md_definehud (int32_t modelid, int32_t tilex, float xadd, float yadd, float zadd, |
1344 | int32_t md_definehud (int32_t modelid, int32_t tilex, float xadd, float yadd, float zadd, |
1338 | int32_t angadd, int32_t flags, int32_t fov); |
1345 | int32_t angadd, int32_t flags, int32_t fov); |
1339 | int32_t md_undefinetile(int32_t tile); |
1346 | int32_t md_undefinetile(int32_t tile); |
1340 | int32_t md_undefinemodel(int32_t modelid); |
1347 | int32_t md_undefinemodel(int32_t modelid); |
1341 | 1348 | ||
1342 | int32_t loaddefinitionsfile(const char *fn); |
1349 | int32_t loaddefinitionsfile(const char *fn); |
1343 | 1350 | ||
1344 | // if loadboard() fails with -2 return, try loadoldboard(). if it fails with
|
1351 | // if loadboard() fails with -2 return, try loadoldboard(). if it fails with
|
1345 | // -2, board is dodgy
|
1352 | // -2, board is dodgy
|
1346 | int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum); |
1353 | int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum); |
1347 | 1354 | ||
1348 | 1355 | ||
1349 | // Hash functions
|
1356 | // Hash functions
|
1350 | 1357 | ||
1351 | typedef struct _hashitem // size is 12/24 bytes. |
1358 | typedef struct _hashitem // size is 12/24 bytes. |
1352 | {
|
1359 | {
|
1353 | char *string; |
1360 | char *string; |
1354 | intptr_t key; |
1361 | intptr_t key; |
1355 | struct _hashitem *next; |
1362 | struct _hashitem *next; |
1356 | } hashitem_t; |
1363 | } hashitem_t; |
1357 | 1364 | ||
1358 | typedef struct |
1365 | typedef struct |
1359 | {
|
1366 | {
|
1360 | int32_t size; |
1367 | int32_t size; |
1361 | hashitem_t **items; |
1368 | hashitem_t **items; |
1362 | } hashtable_t; |
1369 | } hashtable_t; |
1363 | 1370 | ||
1364 | void hash_init(hashtable_t *t); |
1371 | void hash_init(hashtable_t *t); |
1365 | void hash_free(hashtable_t *t); |
1372 | void hash_free(hashtable_t *t); |
1366 | intptr_t hash_findcase(const hashtable_t *t, const char *s); |
1373 | intptr_t hash_findcase(const hashtable_t *t, const char *s); |
1367 | intptr_t hash_find(const hashtable_t *t, const char *s); |
1374 | intptr_t hash_find(const hashtable_t *t, const char *s); |
1368 | void hash_add(hashtable_t *t, const char *s, intptr_t key, int32_t replace); |
1375 | void hash_add(hashtable_t *t, const char *s, intptr_t key, int32_t replace); |
1369 | void hash_delete(hashtable_t *t, const char *s); |
1376 | void hash_delete(hashtable_t *t, const char *s); |
1370 | 1377 | ||
1371 | #ifdef POLYMER
|
1378 | #ifdef POLYMER
|
1372 | # include "polymer.h"
|
1379 | # include "polymer.h"
|
1373 | #else
|
1380 | #else
|
1374 | # ifdef USE_OPENGL
|
1381 | # ifdef USE_OPENGL
|
1375 | # include "polymost.h"
|
1382 | # include "polymost.h"
|
1376 | # endif
|
1383 | # endif
|
1377 | #endif
|
1384 | #endif
|
1378 | 1385 | ||
1379 | FORCE_INLINE void push_nofog(void) |
1386 | FORCE_INLINE void push_nofog(void) |
1380 | {
|
1387 | {
|
1381 | #ifdef USE_OPENGL
|
1388 | #ifdef USE_OPENGL
|
1382 | if (getrendermode() >= REND_POLYMOST) |
1389 | if (getrendermode() >= REND_POLYMOST) |
1383 | {
|
1390 | {
|
1384 | bglDisable(GL_FOG); |
1391 | bglDisable(GL_FOG); |
1385 | }
|
1392 | }
|
1386 | #endif
|
1393 | #endif
|
1387 | }
|
1394 | }
|
1388 | 1395 | ||
1389 | FORCE_INLINE void pop_nofog(void) |
1396 | FORCE_INLINE void pop_nofog(void) |
1390 | {
|
1397 | {
|
1391 | #ifdef USE_OPENGL
|
1398 | #ifdef USE_OPENGL
|
1392 | if (getrendermode() >= REND_POLYMOST && !nofog) |
1399 | if (getrendermode() >= REND_POLYMOST && !nofog) |
1393 | bglEnable(GL_FOG); |
1400 | bglEnable(GL_FOG); |
1394 | #endif
|
1401 | #endif
|
1395 | }
|
1402 | }
|
1396 | 1403 | ||
1397 | #ifdef LUNATIC
|
1404 | #ifdef LUNATIC
|
1398 | extern const int32_t engine_main_arrays_are_static; |
1405 | extern const int32_t engine_main_arrays_are_static; |
1399 | extern const int32_t engine_v8; |
1406 | extern const int32_t engine_v8; |
1400 | int32_t Mulscale(int32_t a, int32_t b, int32_t sh); |
1407 | int32_t Mulscale(int32_t a, int32_t b, int32_t sh); |
1401 | #endif
|
1408 | #endif
|
1402 | 1409 | ||
1403 | #ifdef __cplusplus
|
1410 | #ifdef __cplusplus
|
1404 | }
|
1411 | }
|
1405 | #endif
|
1412 | #endif
|
1406 | 1413 | ||
1407 | #endif // build_h_
|
1414 | #endif // build_h_
|
1408 | 1415 |