1 #ifndef ENGINE_PRIV_H
2 #define ENGINE_PRIV_H
3
4 #define MAXCLIPNUM 1024
5 #define MAXPERMS 1024
6 #define MAXTILEFILES 256
7 #define MAXYSAVES ((MAXXDIM*MAXSPRITES)>>7)
8 #define MAXNODESPERLINE 42 //Warning: This depends on MAXYSAVES & MAXYDIM!
9 #define MAXWALLSB 2048
10 #define MAXCLIPDIST 1024
11
12 extern unsigned char pow2char[8];
13 extern int pow2long[32];
14
15 extern short thesector[MAXWALLSB], thewall[MAXWALLSB];
16 extern short bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB];
17 extern short maskwall[MAXWALLSB], maskwallcnt;
18 extern spritetype *tspriteptr[MAXSPRITESONSCREEN];
19 extern int xdimen, xdimenrecip, halfxdimen, xdimenscale, xdimscale, ydimen, ydimenscale;
20 extern intptr_t frameoffset;
21 extern int globalposx, globalposy, globalposz, globalhoriz;
22 extern short globalang, globalcursectnum;
23 extern int globalpal, cosglobalang, singlobalang;
24 extern int cosviewingrangeglobalang, sinviewingrangeglobalang;
25 extern int globalvisibility;
26 extern int asm1, asm2, asm4;
27 extern intptr_t asm3;
28 extern int globalshade;
29 extern short globalpicnum;
30 extern int globalx1, globaly2;
31 extern int globalorientation;
32
33 extern short searchit;
34 extern int searchx, searchy;
35 extern short searchsector, searchwall, searchstat;
36
37 extern char inpreparemirror;
38
39 extern int curbrightness, gammabrightness;
40 extern float curgamma;
41 extern unsigned char britable[16][256];
42 extern unsigned char picsiz[MAXTILES];
43 extern int lastx[MAXYDIM];
44 extern unsigned char *transluc;
45 extern short sectorborder[256], sectorbordercnt;
46 extern int qsetmode;
47 extern int hitallsprites;
48
49 extern int xb1[MAXWALLSB];
50 extern int rx1[MAXWALLSB], ry1[MAXWALLSB];
51 extern short p2[MAXWALLSB];
52 extern short numscans, numhits, numbunches;
53
54 #if USE_OPENGL
55 extern palette_t palookupfog[MAXPALOOKUPS];
56 #endif
57
58 int wallmost(short *mostbuf, int w, int sectnum, unsigned char dastat);
59 int wallfront(int l1, int l2);
60 int animateoffs(short tilenum, short fakevar);
61
62
63 #if defined(__WATCOMC__) && USE_ASM
64
65 #pragma aux setgotpic =\
66 "mov ebx, eax",\
67 "cmp byte ptr walock[eax], 200",\
68 "jae skipit",\
69 "mov byte ptr walock[eax], 199",\
70 "skipit: shr eax, 3",\
71 "and ebx, 7",\
72 "mov dl, byte ptr gotpic[eax]",\
73 "mov bl, byte ptr pow2char[ebx]",\
74 "or dl, bl",\
75 "mov byte ptr gotpic[eax], dl",\
76 parm [eax]\
77 modify exact [eax ebx ecx edx]
78 void setgotpic(int);
79
80 #elif defined(_MSC_VER) && defined(_M_IX86) && USE_ASM // __WATCOMC__
81
setgotpic(int a)82 static inline void setgotpic(int a)
83 {
84 _asm {
85 push ebx
86 mov eax, a
87 mov ebx, eax
88 cmp byte ptr walock[eax], 200
89 jae skipit
90 mov byte ptr walock[eax], 199
91 skipit:
92 shr eax, 3
93 and ebx, 7
94 mov dl, byte ptr gotpic[eax]
95 mov bl, byte ptr pow2char[ebx]
96 or dl, bl
97 mov byte ptr gotpic[eax], dl
98 pop ebx
99 }
100 }
101
102 #elif defined(__GNUC__) && defined(__i386__) && USE_ASM // _MSC_VER
103
104 #define setgotpic(a) \
105 ({ int __a=(a); \
106 __asm__ __volatile__ ( \
107 "movl %%eax, %%ebx\n\t" \
108 "cmpb $200, %[walock](%%eax)\n\t" \
109 "jae 0f\n\t" \
110 "movb $199, %[walock](%%eax)\n\t" \
111 "0:\n\t" \
112 "shrl $3, %%eax\n\t" \
113 "andl $7, %%ebx\n\t" \
114 "movb %[gotpic](%%eax), %%dl\n\t" \
115 "movb %[pow2char](%%ebx), %%bl\n\t" \
116 "orb %%bl, %%dl\n\t" \
117 "movb %%dl, %[gotpic](%%eax)" \
118 : "=a" (__a) \
119 : "a" (__a), [walock] "m" (walock[0]), \
120 [gotpic] "m" (gotpic[0]), \
121 [pow2char] "m" (pow2char[0]) \
122 : "ebx", "edx", "memory", "cc"); \
123 __a; })
124
125 #else // __GNUC__ && __i386__
126
setgotpic(int tilenume)127 static inline void setgotpic(int tilenume)
128 {
129 if (walock[tilenume] < 200) walock[tilenume] = 199;
130 gotpic[tilenume>>3] |= pow2char[tilenume&7];
131 }
132
133 #endif
134
135 #endif /* ENGINE_PRIV_H */
136