Subversion Repositories eduke32

Rev

Rev 883 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
573 terminx 1
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
2
// Ken Silverman's official web site: "http://www.advsys.net/ken"
3
// See the included license file "BUILDLIC.TXT" for license info.
4
//
5
// This file has been modified from Ken Silverman's original release
6
// by Jonathon Fowler (jonof@edgenetwk.com)
540 terminx 7
 
573 terminx 8
 
9
#ifndef __build_h__
10
#define __build_h__
11
 
618 terminx 12
#include "compat.h"
13
 
573 terminx 14
#ifdef __cplusplus
15
extern "C" {
16
#endif
17
 
18
#define MAXSECTORSV8 4096
19
#define MAXWALLSV8 16384
20
#define MAXSPRITESV8 16384
21
 
22
#define MAXSECTORSV7 1024
23
#define MAXWALLSV7 8192
24
#define MAXSPRITESV7 4096
25
 
26
#define MAXSECTORS MAXSECTORSV8
27
#define MAXWALLS MAXWALLSV8
687 plagman 28
#define MAXWALLSB ((MAXWALLS>>2)+(MAXWALLS>>3))
573 terminx 29
#define MAXSPRITES MAXSPRITESV8
30
 
31
#define MAXTILES 15360
32
#define MAXVOXELS 4096
33
#define MAXSTATUS 1024
34
#define MAXPLAYERS 16
677 terminx 35
#define MAXXDIM 3072
36
#define MAXYDIM 2304
573 terminx 37
#define MAXPALOOKUPS 256
38
#define MAXPSKYTILES 256
39
#define MAXSPRITESONSCREEN 4096
40
#define MAXUNIQHUDID 256 //Extra slots so HUD models can store animation state without messing game sprites
41
 
587 terminx 42
#define RESERVEDPALS 8 // don't forget to increment this when adding reserved pals
573 terminx 43
#define DETAILPAL   (MAXPALOOKUPS - 1)
44
#define GLOWPAL     (MAXPALOOKUPS - 2)
587 terminx 45
#define REDPAL      (MAXPALOOKUPS - 3)
46
#define BLUEPAL     (MAXPALOOKUPS - 4)
47
#define BROWNPAL    (MAXPALOOKUPS - 5)
48
#define GREYPAL     (MAXPALOOKUPS - 6)
49
#define GREENPAL    (MAXPALOOKUPS - 7)
50
#define SPECPAL     (MAXPALOOKUPS - 8)
573 terminx 51
 
886 terminx 52
#define STAT_NOCULL 99
53
 
573 terminx 54
#define CLIPMASK0 (((1L)<<16)+1L)
55
#define CLIPMASK1 (((256L)<<16)+64L)
56
 
57
    //Make all variables in BUILD.H defined in the ENGINE,
58
    //and externed in GAME
59
#ifdef ENGINE
60
#  define EXTERN
61
#else
62
#  define EXTERN extern
63
#endif
64
 
65
#ifdef __GNUC__
66
#define BPACK __attribute__ ((packed))
67
#else
68
#define BPACK
69
#endif
70
 
71
#ifdef _MSC_VER
72
#pragma pack(1)
73
#endif
74
 
75
#ifdef __WATCOMC__
76
#pragma pack(push,1);
77
#endif
78
 
79
 
80
//ceilingstat/floorstat:
81
//   bit 0: 1 = parallaxing, 0 = not                                 "P"
82
//   bit 1: 1 = groudraw, 0 = not
83
//   bit 2: 1 = swap x&y, 0 = not                                    "F"
84
//   bit 3: 1 = double smooshiness                                   "E"
85
//   bit 4: 1 = x-flip                                               "F"
86
//   bit 5: 1 = y-flip                                               "F"
87
//   bit 6: 1 = Align texture to first wall of sector                "R"
88
//   bits 7-8:                                                       "T"
89
//          00 = normal floors
90
//          01 = masked floors
91
//          10 = transluscent masked floors
92
//          11 = reverse transluscent masked floors
93
//   bits 9-15: reserved
94
 
95
    //40 bytes
96
typedef struct BPACK
97
{
98
    short wallptr, wallnum;
584 terminx 99
    int ceilingz, floorz;
573 terminx 100
    short ceilingstat, floorstat;
101
    short ceilingpicnum, ceilingheinum;
102
    signed char ceilingshade;
103
    char ceilingpal, ceilingxpanning, ceilingypanning;
104
    short floorpicnum, floorheinum;
105
    signed char floorshade;
106
    char floorpal, floorxpanning, floorypanning;
107
    char visibility, filler;
108
    short lotag, hitag, extra;
109
} sectortype;
110
 
111
//cstat:
112
//   bit 0: 1 = Blocking wall (use with clipmove, getzrange)         "B"
113
//   bit 1: 1 = bottoms of invisible walls swapped, 0 = not          "2"
114
//   bit 2: 1 = align picture on bottom (for doors), 0 = top         "O"
115
//   bit 3: 1 = x-flipped, 0 = normal                                "F"
116
//   bit 4: 1 = masking wall, 0 = not                                "M"
117
//   bit 5: 1 = 1-way wall, 0 = not                                  "1"
118
//   bit 6: 1 = Blocking wall (use with hitscan / cliptype 1)        "H"
119
//   bit 7: 1 = Transluscence, 0 = not                               "T"
120
//   bit 8: 1 = y-flipped, 0 = normal                                "F"
121
//   bit 9: 1 = Transluscence reversing, 0 = normal                  "T"
122
//   bits 10-15: reserved
123
 
124
    //32 bytes
125
typedef struct BPACK
126
{
584 terminx 127
    int x, y;
573 terminx 128
    short point2, nextwall, nextsector, cstat;
129
    short picnum, overpicnum;
130
    signed char shade;
131
    char pal, xrepeat, yrepeat, xpanning, ypanning;
132
    short lotag, hitag, extra;
133
} walltype;
134
 
135
//cstat:
136
//   bit 0: 1 = Blocking sprite (use with clipmove, getzrange)       "B"
137
//   bit 1: 1 = transluscence, 0 = normal                            "T"
138
//   bit 2: 1 = x-flipped, 0 = normal                                "F"
139
//   bit 3: 1 = y-flipped, 0 = normal                                "F"
140
//   bits 5-4: 00 = FACE sprite (default)                            "R"
141
//             01 = WALL sprite (like masked walls)
142
//             10 = FLOOR sprite (parallel to ceilings&floors)
143
//   bit 6: 1 = 1-sided sprite, 0 = normal                           "1"
144
//   bit 7: 1 = Real centered centering, 0 = foot center             "C"
145
//   bit 8: 1 = Blocking sprite (use with hitscan / cliptype 1)      "H"
146
//   bit 9: 1 = Transluscence reversing, 0 = normal                  "T"
147
//   bits 10-14: reserved
148
//   bit 15: 1 = Invisible sprite, 0 = not invisible
149
 
150
    //44 bytes
151
typedef struct BPACK
152
{
584 terminx 153
    int x, y, z;
573 terminx 154
    short cstat, picnum;
155
    signed char shade;
156
    char pal, clipdist, filler;
157
    unsigned char xrepeat, yrepeat;
158
    signed char xoffset, yoffset;
159
    short sectnum, statnum;
160
    short ang, owner, xvel, yvel, zvel;
161
    short lotag, hitag, extra;
162
} spritetype;
163
 
164
typedef struct BPACK {
584 terminx 165
    unsigned int mdanimtims;
573 terminx 166
    short mdanimcur;
167
    short angoff;
168
    short pitch, roll;
584 terminx 169
    int xoff, yoff, zoff;
573 terminx 170
    unsigned char flags;
590 plagman 171
    unsigned char xpanning, ypanning;
172
    char filler[1];
853 terminx 173
    spritetype *tspr;
573 terminx 174
} spriteexttype;
175
 
176
typedef struct BPACK {
747 terminx 177
    float smoothduration;
573 terminx 178
    short mdcurframe, mdoldframe;
179
    short mdsmooth;
747 terminx 180
    char filler[2];
573 terminx 181
} spritesmoothtype;
182
 
183
#define SPREXT_NOTMD 1
184
#define SPREXT_NOMDANIM 2
587 terminx 185
#define SPREXT_AWAY1 4
186
#define SPREXT_AWAY2 8
853 terminx 187
#define SPREXT_TSPRACCESS 16
188
 
574 terminx 189
EXTERN spriteexttype *spriteext;
190
EXTERN spritesmoothtype *spritesmooth;
584 terminx 191
EXTERN int guniqhudid;
573 terminx 192
 
574 terminx 193
EXTERN sectortype *sector;
194
EXTERN walltype *wall;
687 plagman 195
EXTERN short maskwall[MAXWALLSB], maskwallcnt;
196
EXTERN short thewall[MAXWALLSB];
574 terminx 197
EXTERN spritetype *sprite;
672 plagman 198
EXTERN spritetype *tspriteptr[MAXSPRITESONSCREEN];
573 terminx 199
 
584 terminx 200
EXTERN int spritesortcnt;
574 terminx 201
EXTERN spritetype *tsprite;
573 terminx 202
 
618 terminx 203
EXTERN int xdim, ydim, numpages;
584 terminx 204
EXTERN int yxaspect, viewingrange;
618 terminx 205
EXTERN intptr_t ylookup[MAXYDIM+1];
573 terminx 206
 
207
#define MAXVALIDMODES 256
584 terminx 208
EXTERN int validmodecnt;
573 terminx 209
struct validmode_t {
584 terminx 210
    int xdim,ydim;
573 terminx 211
    char bpp;
212
    char fs;    // bit 0 = fullscreen flag
213
    char filler[2];
584 terminx 214
    int extra; // internal use
573 terminx 215
};
216
EXTERN struct validmode_t validmode[MAXVALIDMODES];
217
 
218
EXTERN short numsectors, numwalls;
701 plagman 219
EXTERN char display_mirror;
584 terminx 220
EXTERN /*volatile*/ int totalclock;
221
EXTERN int numframes, randomseed;
573 terminx 222
EXTERN short sintable[2048];
223
EXTERN char palette[768];
224
EXTERN short numpalookups;
225
EXTERN char *palookup[MAXPALOOKUPS];
226
EXTERN char parallaxtype, showinvisibility;
584 terminx 227
EXTERN int parallaxyoffs, parallaxyscale;
228
EXTERN int visibility, parallaxvisibility;
573 terminx 229
 
584 terminx 230
EXTERN int windowx1, windowy1, windowx2, windowy2;
573 terminx 231
EXTERN short startumost[MAXXDIM], startdmost[MAXXDIM];
232
 
233
EXTERN short pskyoff[MAXPSKYTILES], pskybits;
234
 
235
EXTERN short headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1];
236
EXTERN short prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES];
237
EXTERN short nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
238
 
239
EXTERN short tilesizx[MAXTILES], tilesizy[MAXTILES];
240
EXTERN char picsiz[MAXTILES];
241
EXTERN char walock[MAXTILES];
584 terminx 242
EXTERN int pow2long[32];
618 terminx 243
EXTERN int numtiles, picanm[MAXTILES];
244
EXTERN intptr_t waloff[MAXTILES];  // stores pointers to cache  -- SA
573 terminx 245
 
540 terminx 246
EXTERN int windowpos, windowx, windowy;
573 terminx 247
 
248
    //These variables are for auto-mapping with the draw2dscreen function.
249
    //When you load a new board, these bits are all set to 0 - since
250
    //you haven't mapped out anything yet.  Note that these arrays are
251
    //bit-mapped.
252
    //If you want draw2dscreen() to show sprite #54 then you say:
253
    //   spritenum = 54;
254
    //   show2dsprite[spritenum>>3] |= (1<<(spritenum&7));
255
    //And if you want draw2dscreen() to not show sprite #54 then you say:
256
    //   spritenum = 54;
257
    //   show2dsprite[spritenum>>3] &= ~(1<<(spritenum&7));
258
    //Automapping defaults to 0 (do nothing).  If you set automapping to 1,
259
    //   then in 3D mode, the walls and sprites that you see will show up the
260
    //   next time you flip to 2D mode.
261
 
262
EXTERN char show2dsector[(MAXSECTORS+7)>>3];
263
EXTERN char show2dwall[(MAXWALLS+7)>>3];
264
EXTERN char show2dsprite[(MAXSPRITES+7)>>3];
265
EXTERN char automapping;
266
 
267
EXTERN char gotpic[(MAXTILES+7)>>3];
268
EXTERN char gotsector[(MAXSECTORS+7)>>3];
269
 
270
EXTERN char captureformat;
271
extern char vgapalette[5*256];
584 terminx 272
extern unsigned int drawlinepat;
573 terminx 273
 
274
extern void faketimerhandler(void);
275
 
276
extern char apptitle[256];
277
typedef struct {
278
    unsigned char r,g,b,f;
279
} palette_t;
280
extern palette_t curpalette[256], curpalettefaded[256], palfadergb;
281
extern char palfadedelta;
282
 
584 terminx 283
extern int dommxoverlay, novoxmips;
573 terminx 284
 
285
#ifdef SUPERBUILD
584 terminx 286
extern int tiletovox[MAXTILES];
287
extern int usevoxels, voxscale[MAXVOXELS];
573 terminx 288
#endif
289
#ifdef POLYMOST
584 terminx 290
extern int usemodels, usehightile;
697 plagman 291
extern int rendmode;
573 terminx 292
#endif
665 terminx 293
EXTERN int h_xsize[MAXTILES], h_ysize[MAXTILES];
294
EXTERN signed char h_xoffs[MAXTILES], h_yoffs[MAXTILES];
573 terminx 295
 
296
extern char *engineerrstr;
297
extern char noclip;
298
 
299
/*************************************************************************
300
POSITION VARIABLES:
301
 
302
        POSX is your x - position ranging from 0 to 65535
303
        POSY is your y - position ranging from 0 to 65535
304
            (the length of a side of the grid in EDITBORD would be 1024)
305
        POSZ is your z - position (height) ranging from 0 to 65535, 0 highest.
306
        ANG is your angle ranging from 0 to 2047.  Instead of 360 degrees, or
307
             2 * PI radians, I use 2048 different angles, so 90 degrees would
308
             be 512 in my system.
309
 
310
SPRITE VARIABLES:
311
 
312
    EXTERN short headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1];
313
    EXTERN short prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES];
314
    EXTERN short nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
315
 
316
    Example: if the linked lists look like the following:
317
         ????????????????????????????????
318
               Sector lists:               Status lists:              
319
         ???????????????????????????????J
320
           Sector0:  4, 5, 8             Status0:  2, 0, 8            
321
           Sector1:  16, 2, 0, 7         Status1:  4, 5, 16, 7, 3, 9  
322
           Sector2:  3, 9                                              
323
         ????????????????????????????????
324
    Notice that each number listed above is shown exactly once on both the
325
        left and right side.  This is because any sprite that exists must
326
        be in some sector, and must have some kind of status that you define.
327
 
328
 
329
Coding example #1:
330
    To go through all the sprites in sector 1, the code can look like this:
331
 
332
        sectnum = 1;
333
        i = headspritesect[sectnum];
334
        while (i != -1)
335
        {
336
            nexti = nextspritesect[i];
337
 
338
            //your code goes here
339
            //ex: printf("Sprite %d is in sector %d\n",i,sectnum);
340
 
341
            i = nexti;
342
        }
343
 
344
Coding example #2:
345
    To go through all sprites with status = 1, the code can look like this:
346
 
347
        statnum = 1;        //status 1
348
        i = headspritestat[statnum];
349
        while (i != -1)
350
        {
351
            nexti = nextspritestat[i];
352
 
353
            //your code goes here
354
            //ex: printf("Sprite %d has a status of 1 (active)\n",i,statnum);
355
 
356
            i = nexti;
357
        }
358
 
359
             insertsprite(short sectnum, short statnum);
360
             deletesprite(short spritenum);
361
             changespritesect(short spritenum, short newsectnum);
362
             changespritestat(short spritenum, short newstatnum);
363
 
364
TILE VARIABLES:
365
        NUMTILES - the number of tiles found TILES.DAT.
366
        TILESIZX[MAXTILES] - simply the x-dimension of the tile number.
367
        TILESIZY[MAXTILES] - simply the y-dimension of the tile number.
368
        WALOFF[MAXTILES] - the actual 32-bit offset pointing to the top-left
369
                                 corner of the tile.
370
        PICANM[MAXTILES] - flags for animating the tile.
371
 
372
TIMING VARIABLES:
373
        TOTALCLOCK - When the engine is initialized, TOTALCLOCK is set to zero.
374
            From then on, it is incremented 120 times a second by 1.  That
375
            means that the number of seconds elapsed is totalclock / 120.
376
        NUMFRAMES - The number of times the draw3dscreen function was called
377
            since the engine was initialized.  This helps to determine frame
378
            rate.  (Frame rate = numframes * 120 / totalclock.)
379
 
380
OTHER VARIABLES:
381
 
382
        STARTUMOST[320] is an array of the highest y-coordinates on each column
383
                that my engine is allowed to write to.  You need to set it only
384
                once.
385
        STARTDMOST[320] is an array of the lowest y-coordinates on each column
386
                that my engine is allowed to write to.  You need to set it only
387
                once.
388
        SINTABLE[2048] is a sin table with 2048 angles rather than the
389
            normal 360 angles for higher precision.  Also since SINTABLE is in
390
            all integers, the range is multiplied by 16383, so instead of the
391
            normal -1<sin(x)<1, the range of sintable is -16383<sintable[]<16383
392
            If you use this sintable, you can possibly speed up your code as
393
            well as save space in memory.  If you plan to use sintable, 2
394
            identities you may want to keep in mind are:
395
                sintable[ang&2047]       = sin(ang * (3.141592/1024)) * 16383
396
                sintable[(ang+512)&2047] = cos(ang * (3.141592/1024)) * 16383
397
        NUMSECTORS - the total number of existing sectors.  Modified every time
398
            you call the loadboard function.
399
***************************************************************************/
400
 
401
int    preinitengine(void);     // a partial setup of the engine used for launch windows
402
int    initengine(void);
403
void   uninitengine(void);
404
void   initspritelists(void);
584 terminx 405
int   loadboard(char *filename, char fromwhere, int *daposx, int *daposy, int *daposz, short *daang, short *dacursectnum);
406
int   loadmaphack(char *filename);
407
int   saveboard(char *filename, int *daposx, int *daposy, int *daposz, short *daang, short *dacursectnum);
408
int   loadpics(char *filename, int askedsize);
573 terminx 409
void   loadtile(short tilenume);
584 terminx 410
int   qloadkvx(int voxindex, char *filename);
411
int   allocatepermanenttile(short tilenume, int xsiz, int ysiz);
412
void   copytilepiece(int tilenume1, int sx1, int sy1, int xsiz, int ysiz, int tilenume2, int sx2, int sy2);
413
void   makepalookup(int palnum, char *remapbuf, signed char r, signed char g, signed char b, char dastat);
573 terminx 414
void   setvgapalette(void);
415
void   setbrightness(char dabrightness, char *dapal, char noapply);
416
void   setpalettefade(char r, char g, char b, char offset);
417
void   squarerotatetile(short tilenume);
418
 
584 terminx 419
int   setgamemode(char davidoption, int daxdim, int daydim, int dabpp);
573 terminx 420
void   nextpage(void);
584 terminx 421
void   setview(int x1, int y1, int x2, int y2);
422
void   setaspect(int daxrange, int daaspect);
573 terminx 423
void   flushperms(void);
424
 
584 terminx 425
void   plotpixel(int x, int y, char col);
426
char   getpixel(int x, int y);
427
void   setviewtotile(short tilenume, int xsiz, int ysiz);
573 terminx 428
void   setviewback(void);
584 terminx 429
void   preparemirror(int dax, int day, int daz, short daang, int dahoriz, short dawall, short dasector, int *tposx, int *tposy, short *tang);
573 terminx 430
void   completemirror(void);
431
 
584 terminx 432
void   drawrooms(int daposx, int daposy, int daposz, short daang, int dahoriz, short dacursectnum);
573 terminx 433
void   drawmasks(void);
584 terminx 434
void   clearview(int dacol);
435
void   clearallviews(int dacol);
436
void   drawmapview(int dax, int day, int zoome, short ang);
437
void   rotatesprite(int sx, int sy, int z, short a, short picnum, signed char dashade, char dapalnum, char dastat, int cx1, int cy1, int cx2, int cy2);
438
void   drawline256(int x1, int y1, int x2, int y2, char col);
439
void   printext16(int xpos, int ypos, short col, short backcol, char *name, char fontsize);
440
void   printext256(int xpos, int ypos, short col, short backcol, char *name, char fontsize);
573 terminx 441
 
584 terminx 442
int   clipmove(int *x, int *y, int *z, short *sectnum, int xvect, int yvect, int walldist, int ceildist, int flordist, unsigned int cliptype);
443
int   clipinsidebox(int x, int y, short wallnum, int walldist);
444
int   clipinsideboxline(int x, int y, int x1, int y1, int x2, int y2, int walldist);
445
int   pushmove(int *x, int *y, int *z, short *sectnum, int walldist, int ceildist, int flordist, unsigned int cliptype);
446
void   getzrange(int x, int y, int z, short sectnum, int *ceilz, int *ceilhit, int *florz, int *florhit, int walldist, unsigned int cliptype);
447
int   hitscan(int xs, int ys, int zs, short sectnum, int vx, int vy, int vz, short *hitsect, short *hitwall, short *hitsprite, int *hitx, int *hity, int *hitz, unsigned int cliptype);
448
int   neartag(int xs, int ys, int zs, short sectnum, short ange, short *neartagsector, short *neartagwall, short *neartagsprite, int *neartaghitdist, int neartagrange, char tagsearch);
449
int   cansee(int x1, int y1, int z1, short sect1, int x2, int y2, int z2, short sect2);
450
void   updatesector(int x, int y, short *sectnum);
451
void   updatesectorz(int x, int y, int z, short *sectnum);
452
int   inside(int x, int y, short sectnum);
453
void   dragpoint(short pointhighlight, int dax, int day);
573 terminx 454
void   setfirstwall(short sectnum, short newfirstwall);
455
 
584 terminx 456
void   getmousevalues(int *mousx, int *mousy, int *bstatus);
457
int    krand(void);
458
int   ksqrt(int num);
459
int   getangle(int xvect, int yvect);
460
void   rotatepoint(int xpivot, int ypivot, int x, int y, short daang, int *x2, int *y2);
461
int   lastwall(short point);
462
int   nextsectorneighborz(short sectnum, int thez, short topbottom, short direction);
463
int   getceilzofslope(short sectnum, int dax, int day);
464
int   getflorzofslope(short sectnum, int dax, int day);
465
void   getzsofslope(short sectnum, int dax, int day, int *ceilz, int *florz);
466
void   alignceilslope(short dasect, int x, int y, int z);
467
void   alignflorslope(short dasect, int x, int y, int z);
468
int   sectorofwall(short theline);
469
int   loopnumofsector(short sectnum, short wallnum);
573 terminx 470
 
584 terminx 471
int   insertsprite(short sectnum, short statnum);
472
int   deletesprite(short spritenum);
473
int   changespritesect(short spritenum, short newsectnum);
474
int   changespritestat(short spritenum, short newstatnum);
475
int   setsprite(short spritenum, int newx, int newy, int newz);
573 terminx 476
 
584 terminx 477
int   screencapture(char *filename, char inverseit);
573 terminx 478
 
479
// PLAG: line utility functions
480
typedef struct  s_equation {
481
    float       a, b, c;
482
}               _equation;
483
typedef struct  s_point2d {
484
    float       x, y;
485
}               _point2d;
584 terminx 486
_equation       equation(int x1, int y1, int x2, int y2);
573 terminx 487
int             sameside(_equation* eq, _point2d* p1, _point2d* p2);
488
int             wallvisible(short wallnum);
489
 
723 terminx 490
#ifdef POLYMER
697 plagman 491
// polymer stuff for the game to provide it with the animatessprites ptr
492
typedef void (*animatespritesptr)(int, int, int, int);
493
EXTERN void polymer_setanimatesprites(animatespritesptr, int, int, int, int);
723 terminx 494
#endif
697 plagman 495
 
573 terminx 496
#define STATUS2DSIZ 144
497
void   qsetmode640350(void);
498
void   qsetmode640480(void);
584 terminx 499
void   qsetmodeany(int,int);
573 terminx 500
void   clear2dscreen(void);
584 terminx 501
void   draw2dgrid(int posxe, int posye, short ange, int zoome, short gride);
502
void   draw2dscreen(int posxe, int posye, short ange, int zoome, short gride);
503
void   drawline16(int x1, int y1, int x2, int y2, char col);
504
void   drawcircle16(int x1, int y1, int r, char col);
573 terminx 505
 
506
int   setrendermode(int renderer);
507
int   getrendermode(void);
508
 
584 terminx 509
void    setrollangle(int rolla);
573 terminx 510
 
511
//  pal: pass -1 to invalidate all palettes for the tile, or >=0 for a particular palette
512
//  how: pass -1 to invalidate all instances of the tile in texture memory, or a bitfield
513
//         bit 0: opaque or masked (non-translucent) texture, using repeating
514
//         bit 1: ignored
515
//         bit 2: 33% translucence, using repeating
516
//         bit 3: 67% translucence, using repeating
517
//         bit 4: opaque or masked (non-translucent) texture, using clamping
518
//         bit 5: ignored
519
//         bit 6: 33% translucence, using clamping
520
//         bit 7: 67% translucence, using clamping
521
//       clamping is for sprites, repeating is for walls
584 terminx 522
void invalidatetile(short tilenume, int pal, int how);
573 terminx 523
 
584 terminx 524
int animateoffs(short tilenum, short fakevar);
573 terminx 525
 
526
void setpolymost2dview(void);   // sets up GL for 2D drawing
527
 
584 terminx 528
int polymost_drawtilescreen(int tilex, int tiley, int wallnum, int dimen, int tilezoom);
573 terminx 529
void polymost_glreset(void);
584 terminx 530
void polymost_precache(int dapicnum, int dapalnum, int datype);
573 terminx 531
 
532
#if defined(POLYMOST) && defined(USE_OPENGL)
584 terminx 533
extern int glanisotropy;
534
extern int glusetexcompr;
535
extern int gltexfiltermode;
536
extern int glredbluemode;
537
extern int glusetexcache, glusetexcachecompression;
538
extern int glmultisample, glnvmultisamplehint;
539
extern int glwidescreen, glprojectionhacks;
573 terminx 540
void gltexapplyprops (void);
541
 
584 terminx 542
extern int r_depthpeeling, r_peelscount;
543
extern int r_detailmapping;
544
extern int r_glowmapping;
545
extern int r_vertexarrays;
546
extern int r_vbos;
547
extern int r_vbocount;
548
extern int r_animsmoothing;
623 plagman 549
extern int r_parallaxskyclamping;
550
extern int r_parallaxskypanning;
882 terminx 551
extern int r_cullobstructedmodels;
886 terminx 552
extern int r_fullbrights;
606 terminx 553
extern int mdtims, omdtims;
573 terminx 554
#endif
555
 
556
void hicinit(void);
557
// effect bitset: 1 = greyscale, 2 = invert
584 terminx 558
void hicsetpalettetint(int palnum, unsigned char r, unsigned char g, unsigned char b, unsigned char effect);
573 terminx 559
// flags bitset: 1 = don't compress
584 terminx 560
int hicsetsubsttex(int picnum, int palnum, char *filen, float alphacut, float xscale, float yscale, char flags);
561
int hicsetskybox(int picnum, int palnum, char *faces[6]);
562
int hicclearsubst(int picnum, int palnum);
573 terminx 563
 
587 terminx 564
int Ptile2tile(int tile, int pallet);
573 terminx 565
int md_loadmodel(const char *fn);
587 terminx 566
int md_setmisc(int modelid, float scale, int shadeoff, float zadd, int flags);
567
int md_tilehasmodel(int tilenume, int pal);
568
int md_defineframe(int modelid, const char *framename, int tilenume, int skinnum, float smoothduration, int pal);
573 terminx 569
int md_defineanimation(int modelid, const char *framestart, const char *frameend, int fps, int flags);
570
int md_defineskin(int modelid, const char *skinfn, int palnum, int skinnum, int surfnum, float param);
571
int md_definehud (int modelid, int tilex, double xadd, double yadd, double zadd, double angadd, int flags);
572
int md_undefinetile(int tile);
573
int md_undefinemodel(int modelid);
574
 
587 terminx 575
#define MAXPALCONV 200
576
void clearconv();
577
void setpalconv(int pal,int pal1,int pal2);
723 terminx 578
void getpalmap(int *stage,int *pal1,int *pal2);
587 terminx 579
int checkpalmaps(int pal);
580
void applypalmap(char *pic, char *palmap, int size, int pal);
581
 
573 terminx 582
int loaddefinitionsfile(char *fn);
583
 
584 terminx 584
extern int mapversion;  // if loadboard() fails with -2 return, try loadoldboard(). if it fails with -2, board is dodgy
585
int loadoldboard(char *filename, char fromwhere, int *daposx, int *daposy, int *daposz, short *daang, short *dacursectnum);
573 terminx 586
 
587
#ifdef _MSC_VER
588
#pragma pack()
589
#endif
590
 
591
#ifdef __WATCOMC__
592
#pragma pack(pop)
593
#endif
594
 
595
#undef BPACK
596
 
597
#ifdef __cplusplus
598
}
599
#endif
600
 
601
#endif // __build_h__