Subversion Repositories eduke32

Rev

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

Rev Author Line No. Line
476 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.
7139 hendricks2 4
//
5
// This file has been modified from Ken Silverman's original release
6
// by Jonathon Fowler (jf@jonof.id.au)
7
// by the EDuke32 team (development@voidpoint.com)
476 terminx 8
 
4747 terminx 9
#ifndef editor_h_
10
#define editor_h_
476 terminx 11
 
6074 hendricks2 12
#include "compat.h"
5281 terminx 13
#include "baselayer.h"
1729 terminx 14
 
4766 hendricks2 15
#ifdef __cplusplus
16
extern "C" {
476 terminx 17
#endif
18
 
4558 hendricks2 19
extern const char *defaultsetupfilename;
4344 hendricks2 20
extern char setupfilename[BMAX_PATH];
21
 
4557 hendricks2 22
extern char levelname[BMAX_PATH];
23
 
727 terminx 24
// Build keys
25
#define BK_MOVEFORWARD   0
26
#define BK_MOVEBACKWARD  1
27
#define BK_TURNLEFT      2
28
#define BK_TURNRIGHT     3
29
#define BK_RUN                   4
30
#define BK_STRAFE        5
4934 helixhorne 31
//#define BK_SHOOT               6
32
//#define BK_OPEN                7
727 terminx 33
#define BK_MOVEUP        8
34
#define BK_MOVEDOWN      9
4934 helixhorne 35
//#define BK_LOOKUP     10
36
//#define BK_LOOKDOWN   11
37
//#define BK_STRAFELEFT   12
38
//#define BK_STRAFERIGHT  13
727 terminx 39
#define BK_MODE2D_3D    14
4934 helixhorne 40
//#define BK_PLAYERVIEW   15
41
//#define BK_ZOOMIN     16
42
//#define BK_ZOOMOUT    17
43
//#define BK_MESSAGE    18
727 terminx 44
#define BK_CONSOLE      19
476 terminx 45
#define NUMBUILDKEYS 20
46
 
1886 helixhorne 47
extern int32_t horiz;
48
extern vec3_t pos;
49
extern int16_t ang, cursectnum;
3509 helixhorne 50
extern int32_t g_doHardcodedMovement;
1886 helixhorne 51
 
2028 helixhorne 52
extern int8_t m32_clipping;  // 0: none, 1: only white walls, 2: like game
53
 
1886 helixhorne 54
extern int16_t editstatus, searchit;
55
extern int32_t searchx, searchy, osearchx, osearchy;      //search input
56
 
57
extern int16_t searchsector, searchwall, searchstat;  //search output
1848 helixhorne 58
extern int16_t searchbottomwall, searchisbottom;
1836 helixhorne 59
extern int32_t zmode, kensplayerheight, zlock;
476 terminx 60
 
1886 helixhorne 61
extern int16_t highlightsector[MAXSECTORS], highlightsectorcnt;
62
extern int16_t highlight[MAXWALLS+MAXSPRITES];
63
extern int16_t asksave;
64
 
8443 hendricks2 65
extern int16_t pointhighlight, linehighlight, sectorhighlight, highlightcnt;
1886 helixhorne 66
 
8440 hendricks2 67
extern int16_t defaultspritecstat;
1801 helixhorne 68
 
2715 helixhorne 69
extern int32_t tempsectornum;
1205 terminx 70
extern int32_t temppicnum, tempcstat, templotag, temphitag, tempextra;
1882 helixhorne 71
extern uint32_t temppal, tempvis, tempxrepeat, tempyrepeat, tempxpanning, tempypanning;
1205 terminx 72
extern int32_t tempshade, tempxvel, tempyvel, tempzvel;
5925 terminx 73
extern int32_t tempstatnum, tempblend;
1205 terminx 74
extern char somethingintab;
476 terminx 75
 
1886 helixhorne 76
extern char names[MAXTILES][25];
1205 terminx 77
extern uint8_t buildkeys[NUMBUILDKEYS];
476 terminx 78
 
4607 terminx 79
extern float vid_gamma_3d, vid_contrast_3d, vid_brightness_3d;
1886 helixhorne 80
extern double msens;
1679 helixhorne 81
 
3042 helixhorne 82
extern vec3_t startpos;
1886 helixhorne 83
extern int16_t startang, startsectnum;
84
 
85
extern int32_t lastpm16time, synctics;
86
extern int32_t halfxdim16, midydim16, zoom;
1205 terminx 87
extern int32_t ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d, forcesetup;
88
extern int32_t unrealedlook, quickmapcycling;
89
extern int32_t pk_turnaccel,pk_turndecel,pk_uedaccel;
90
extern int32_t revertCTRL,scrollamount;
91
extern int32_t autosave;
92
extern int32_t mlook;
1892 helixhorne 93
extern int16_t prefixtiles[10];
476 terminx 94
 
1886 helixhorne 95
extern int32_t showfirstwall;
96
 
97
extern int32_t graphicsmode;
98
 
99
extern int32_t grid, autogrid;
100
extern int32_t editorgridextent;        // in engine.c
101
 
102
extern char game_executable[BMAX_PATH];
4558 hendricks2 103
extern const char* DefaultGameExec;
104
extern const char* DefaultGameLocalExec;
105
 
1361 terminx 106
extern char program_origcwd[BMAX_PATH];
1904 helixhorne 107
extern const char *mapster32_fullpath;
1361 terminx 108
extern char *testplay_addparam;
1832 helixhorne 109
extern const char *g_namesFileName;
1361 terminx 110
 
5240 terminx 111
extern int32_t gridlock;
112
 
1894 helixhorne 113
extern int32_t g_maxCacheSize;
1886 helixhorne 114
 
1890 helixhorne 115
extern int32_t g_lazy_tileselector;
7143 terminx 116
extern bool m32_osd_tryscript;
1691 helixhorne 117
extern int32_t showheightindicators;
118
extern int32_t showambiencesounds;
1650 helixhorne 119
 
1899 helixhorne 120
extern int32_t numgraysects;
7594 terminx 121
extern uint8_t graysectbitmap[(MAXSECTORS+7)>>3];
122
extern uint8_t graywallbitmap[(MAXWALLS+7)>>3];
1928 helixhorne 123
extern int32_t autogray, showinnergray;
1870 helixhorne 124
 
4561 hendricks2 125
extern void drawgradient(void);
126
 
1882 helixhorne 127
#ifdef YAX_ENABLE
128
int32_t yax_is121(int16_t bunchnum, int16_t getfloor);
129
#endif
130
 
2314 helixhorne 131
extern void M32_DrawRoomsAndMasks(void);
132
 
2350 helixhorne 133
extern void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore);  // editor-only
134
extern void M32_ResetFakeRORTiles(void);
135
 
1973 helixhorne 136
// set to 1 to enable:
2486 helixhorne 137
#define M32_UNDO 1
1886 helixhorne 138
extern int32_t map_revision;
139
extern int32_t map_undoredo(int32_t dir);
140
extern void map_undoredo_free(void);
4561 hendricks2 141
extern void create_map_snapshot(void);
1886 helixhorne 142
 
8425 terminx 143
enum
144
{
145
    UNDO_SECTORS,
146
    UNDO_WALLS,
147
    UNDO_SPRITES
148
};
149
 
4561 hendricks2 150
typedef struct mapundo_
151
{
152
    int32_t revision;
153
    int32_t num[3];  // numsectors, numwalls, numsprites
154
 
8425 terminx 155
    // These exist temporarily as sector/wall/sprite data, but are always compressed
156
    // +4 bytes refcount at the beginning.
157
    char *lz4Blocks[3];  // sector, wall, sprite
158
    int   lz4Size[3];
4561 hendricks2 159
 
5546 terminx 160
    uintptr_t crc[3];
4561 hendricks2 161
 
162
    struct mapundo_ *next;  // 'redo' loads this
163
    struct mapundo_ *prev;  // 'undo' loads this
164
} mapundo_t;
165
extern mapundo_t *mapstate;
166
 
167
extern void FuncMenu(void);
168
#ifdef LUNATIC
169
extern void LuaFuncMenu(void);
170
#endif
171
 
1730 helixhorne 172
// editor side view
173
extern int32_t m32_sideview;
174
extern int32_t m32_sideelev;
175
extern int16_t m32_sideang;
176
extern int32_t m32_sidecos, m32_sidesin;
177
extern int32_t m32_swcnt;
1865 helixhorne 178
extern int32_t m32_wallscreenxy[MAXWALLS][2];
179
extern int16_t m32_wallsprite[MAXWALLS+MAXSPRITES];
1730 helixhorne 180
extern int8_t sideview_reversehrot;
2008 helixhorne 181
extern int32_t scalescreeny(int32_t sy);
6831 terminx 182
extern void editorGet2dScreenCoordinates(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome) ATTRIBUTE((nonnull));
1733 helixhorne 183
//extern void invscreencoords(int32_t *dx, int32_t *dy, int32_t sx, int32_t sy, int32_t zoome);
1740 helixhorne 184
extern int32_t getinvdisplacement(int32_t *dx, int32_t *dy, int32_t dz) ATTRIBUTE((nonnull));
2008 helixhorne 185
extern int32_t getscreenvdisp(int32_t bz, int32_t zoome);
6831 terminx 186
extern void editorSetup2dSideView(void);
1730 helixhorne 187
 
3398 helixhorne 188
extern int8_t keeptexturestretch;
5568 terminx 189
extern int16_t pointhighlightdist, linehighlightdist;
3398 helixhorne 190
 
1803 helixhorne 191
extern int32_t wallength(int16_t i);
192
extern void fixrepeats(int16_t i);
1877 helixhorne 193
extern uint32_t getlenbyrep(int32_t len, int32_t repeat);
194
extern void fixxrepeat(int16_t wallnum, uint32_t lenrepquot);
1848 helixhorne 195
extern void AlignWallPoint2(int32_t w0);
1877 helixhorne 196
extern int32_t AutoAlignWalls(int32_t w0, uint32_t flags, int32_t nrecurs);
1803 helixhorne 197
 
3825 helixhorne 198
extern void SetFirstWall(int32_t sectnum, int32_t wallnum, int32_t alsoynw);
2110 helixhorne 199
extern int32_t fixspritesectors(void);
2001 helixhorne 200
extern void clearkeys(void);
1900 helixhorne 201
 
4555 hendricks2 202
extern const char *ExtGetVer(void);
1205 terminx 203
extern int32_t ExtInit(void);
5552 hendricks2 204
extern int32_t ExtPreInit(int32_t argc,char const * const * argv);
4557 hendricks2 205
extern int32_t ExtPostStartupWindow(void);
5345 hendricks2 206
extern void ExtPostInit(void);
476 terminx 207
extern void ExtUnInit(void);
208
extern void ExtPreCheckKeys(void);
8428 hendricks2 209
extern void ExtAnalyzeSprites(int32_t, int32_t, int32_t, int32_t, int32_t);
476 terminx 210
extern void ExtCheckKeys(void);
211
extern void ExtPreLoadMap(void);
2110 helixhorne 212
extern void ExtSetupMapFilename(const char *mapname);
476 terminx 213
extern void ExtLoadMap(const char *mapname);
2110 helixhorne 214
extern int32_t ExtPreSaveMap(void);
476 terminx 215
extern void ExtSaveMap(const char *mapname);
1205 terminx 216
extern const char *ExtGetSectorCaption(int16_t sectnum);
217
extern const char *ExtGetWallCaption(int16_t wallnum);
218
extern const char *ExtGetSpriteCaption(int16_t spritenum);
219
extern void ExtShowSectorData(int16_t sectnum);
220
extern void ExtShowWallData(int16_t wallnum);
221
extern void ExtShowSpriteData(int16_t spritenum);
222
extern void ExtEditSectorData(int16_t sectnum);
223
extern void ExtEditWallData(int16_t wallnum);
224
extern void ExtEditSpriteData(int16_t spritenum);
225
extern const char *ExtGetSectorType(int32_t lotag);
476 terminx 226
 
4121 helixhorne 227
extern void B_SetBoardFileName(const char *fn);
1760 helixhorne 228
extern int32_t LoadBoard(const char *filename, uint32_t flags);
229
extern const char *SaveBoard(const char *fn, uint32_t flags);
3046 helixhorne 230
extern const char *GetSaveBoardFilename(const char *fn);
1760 helixhorne 231
 
4569 helixhorne 232
extern int32_t clockdir(int32_t wallstart);
233
extern int32_t loopinside(int32_t x, int32_t y, int16_t startwall);
234
 
235
enum {
236
    // NOTE: These must not be changed, see e.g. loopinside().
237
    CLOCKDIR_CW = 0,  // outer loop
238
    CLOCKDIR_CCW = 1,  // inner loop
239
};
240
 
241
// <loopstart> has to be the starting (i.e. least index) wall of a loop!
242
//
243
// The returned value will be either
244
//  - the starting wall of the next loop of this sector,
245
//  - the first wall of the next sector, or
246
//  - out of bounds (== MAXWALLS).
247
// Thus, it MUST be checked for a proper bound!
248
static inline int32_t get_nextloopstart(int32_t loopstart)
249
{
250
    int32_t i = loopstart;
251
 
252
    while (++i)  // sic
253
        if (wall[i].point2 == loopstart)
254
            return i + 1;
255
 
256
    return MAXWALLS;
257
}
258
 
1760 helixhorne 259
#define CORRUPT_SECTOR (1<<17)
260
#define CORRUPT_WALL (1<<18)
261
#define CORRUPT_SPRITE (1<<19)
262
#define CORRUPT_MASK (CORRUPT_SECTOR|CORRUPT_WALL|CORRUPT_SPRITE)
263
#define MAXCORRUPTTHINGS 64
1792 helixhorne 264
extern int32_t corruptlevel, numcorruptthings, corruptthings[MAXCORRUPTTHINGS];
1751 helixhorne 265
extern int32_t autocorruptcheck;
5320 helixhorne 266
extern int32_t corruptcheck_noalreadyrefd, corruptcheck_heinum;
5420 helixhorne 267
extern int32_t corruptcheck_game_duke3d;
4561 hendricks2 268
extern int32_t corrupt_tryfix_alt;
1799 helixhorne 269
extern int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing);
1751 helixhorne 270
 
2110 helixhorne 271
extern int32_t fixmaponsave_sprites;
1843 helixhorne 272
extern int32_t m32_script_expertmode;  // if true, make read-only vars writable
273
 
1697 helixhorne 274
extern void showsectordata(int16_t sectnum, int16_t small);
275
extern void showwalldata(int16_t wallnum, int16_t small);
276
extern void showspritedata(int16_t spritenum, int16_t small);
277
 
5289 terminx 278
extern void drawsmallabel(const char *text, char col, char backcol, char border, int32_t dax, int32_t day, int32_t daz);
1832 helixhorne 279
 
1205 terminx 280
extern int32_t circlewall;
5289 terminx 281
extern int32_t searchlock;
1044 terminx 282
 
1205 terminx 283
int32_t loadsetup(const char *fn);      // from config.c
284
int32_t writesetup(const char *fn);     // from config.c
476 terminx 285
 
286
void editinput(void);
287
void clearmidstatbar16(void);
1870 helixhorne 288
void fade_editor_screen(int32_t keepcol);
476 terminx 289
 
1867 helixhorne 290
// internal getnumber* helpers:
291
extern int32_t getnumber_internal1(char ch, int32_t *danumptr, int32_t maxnumber, char sign);
292
extern int32_t getnumber_autocomplete(const char *namestart, char ch, int32_t *danum, int32_t flags);
293
 
4561 hendricks2 294
// always CRLF for us
295
#ifdef _WIN32
296
# define OURNEWL "\n"
297
#else
298
# define OURNEWL "\r\n"
299
#endif
300
 
301
#ifdef YAX_ENABLE
302
extern const char *yupdownwall[2];
303
extern const char *YUPDOWNWALL[2];
304
#endif
305
 
4068 helixhorne 306
int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, char sign, const char *(func)(int32_t));
1049 terminx 307
#define getnumber256(namestart, num, maxnumber, sign) _getnumber256(namestart, num, maxnumber, sign, NULL)
4068 helixhorne 308
int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char sign, const char *(func)(int32_t));
1049 terminx 309
#define getnumber16(namestart, num, maxnumber, sign) _getnumber16(namestart, num, maxnumber, sign, NULL)
1644 helixhorne 310
void printmessage256(int32_t x, int32_t y, const char *name);
1740 helixhorne 311
void message(const char *fmt, ...) ATTRIBUTE((format(printf,1,2)));
4561 hendricks2 312
void silentmessage(const char *fmt, ...) ATTRIBUTE((format(printf,1,2)));
3911 helixhorne 313
extern int32_t AskIfSure(const char *text);
1644 helixhorne 314
 
4561 hendricks2 315
extern char getmessage[162], getmessageleng;
316
extern int32_t getmessagetimeoff;
317
 
318
extern int32_t mouseaction;
319
 
1867 helixhorne 320
const char* getstring_simple(const char *querystr, const char *defaultstr, int32_t maxlen, int32_t completion);
1695 helixhorne 321
 
1644 helixhorne 322
// like snprintf, but pads the output buffer with 'fill' at the end
1740 helixhorne 323
//int32_t snfillprintf(char *outbuf, size_t bufsiz, int32_t fill, const char *fmt, ...);
324
void _printmessage16(const char *fmt, ...) ATTRIBUTE((format(printf,1,2)));
476 terminx 325
 
8050 pogokeen 326
#define printmessage16(fmt, ...) lastpm16time = (int32_t) totalclock, _printmessage16(fmt, ## __VA_ARGS__)
783 terminx 327
 
1372 helixhorne 328
extern char lastpm16buf[156];
1359 terminx 329
 
5411 helixhorne 330
int32_t fillsector_maybetrans(int16_t sectnum, int32_t fillcolor, uint8_t dotrans);  // fillcolor == -1: default (pulsating)
1895 helixhorne 331
int32_t ask_if_sure(const char *query, uint32_t flags);
332
int32_t editor_ask_function(const char *question, const char *dachars, int32_t numchars);
1874 helixhorne 333
 
5411 helixhorne 334
static inline int32_t fillsector(int16_t sectnum, int32_t fillcolor)
335
{
336
    return fillsector_maybetrans(sectnum, fillcolor, 1);
337
}
338
 
339
static inline int32_t fillsector_notrans(int16_t sectnum, int32_t fillcolor)
340
{
341
    return fillsector_maybetrans(sectnum, fillcolor, 0);
342
}
343
 
3205 helixhorne 344
void spriteoncfz(int32_t i, int32_t *czptr, int32_t *fzptr) ATTRIBUTE((nonnull(2,3)));
1801 helixhorne 345
void DoSpriteOrnament(int32_t i);
346
 
1205 terminx 347
void getpoint(int32_t searchxe, int32_t searchye, int32_t *x, int32_t *y);
348
int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point);
1870 helixhorne 349
void update_highlight(void);
350
void update_highlightsector(void);
2943 helixhorne 351
void reset_highlightsector(void);
352
void reset_highlight(void);
5339 helixhorne 353
void handlesecthighlight1(int32_t i, int32_t sub, int32_t nograycheck);
1927 helixhorne 354
void ovh_whiteoutgrab(int32_t restoreredwalls);
476 terminx 355
 
1895 helixhorne 356
int32_t inside_editor_curpos(int16_t sectnum);
1832 helixhorne 357
void correct_sprite_yoffset(int32_t i);
1830 helixhorne 358
 
2774 helixhorne 359
void inflineintersect(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
360
                      int32_t x3, int32_t y3, int32_t x4, int32_t y4,
361
                      int32_t *intx, int32_t *inty, int32_t *sign12, int32_t *sign34);
362
 
3113 helixhorne 363
void ovhscrcoords(int32_t x, int32_t y, int32_t *scrx, int32_t *scry);
364
 
7594 terminx 365
extern uint8_t hlsectorbitmap[(MAXSECTORS+7)>>3];
1801 helixhorne 366
 
1361 terminx 367
void test_map(int32_t mode);
368
 
4561 hendricks2 369
extern void M32RunScript(const char *s);
1644 helixhorne 370
 
1867 helixhorne 371
////////// tag labeling system //////////
372
// max (strlen+1), i.e. array length to allocate for a tag label:
373
#define TAGLAB_MAX 40
374
 
375
extern int32_t taglab_load(const char *filename, int32_t flags);
376
extern int32_t taglab_save(const char *mapname);
377
 
378
extern void taglab_init();
379
extern int32_t taglab_add(const char *label, int16_t tag);
380
extern const char *taglab_getlabel(int16_t tag);
381
extern int32_t taglab_gettag(const char *label);
382
 
383
extern int32_t taglab_linktags(int32_t spritep, int32_t num);
4464 helixhorne 384
extern int32_t taglab_getnextfreetag(int32_t *duetoptr);
1867 helixhorne 385
 
386
extern int32_t showtags;
387
 
3108 helixhorne 388
int32_t select_sprite_tag(int32_t spritenum);
1867 helixhorne 389
 
5281 terminx 390
extern int32_t m32_2d3dmode, m32_2d3dsize;
391
extern vec2_t m32_2d3d;
7435 terminx 392
extern int32_t m32_3dundo;
3108 helixhorne 393
 
5281 terminx 394
#define XSIZE_2D3D (xdim2d / m32_2d3dsize)
395
#define YSIZE_2D3D (ydim2d / m32_2d3dsize)
396
 
5291 helixhorne 397
static inline int32_t m32_2d3d_resolutions_match()
398
{
399
    return (xdimgame == xdim2d && ydimgame == ydim2d);
400
}
401
 
5281 terminx 402
static inline int32_t m32_is2d3dmode(void)
403
{
5385 terminx 404
    return !in3dmode() && m32_2d3dmode && (unsigned)cursectnum < MAXSECTORS &&
5291 helixhorne 405
        m32_2d3d_resolutions_match() &&
406
        searchx > m32_2d3d.x && searchx < (m32_2d3d.x + XSIZE_2D3D) &&
5281 terminx 407
        searchy > m32_2d3d.y && searchy < (m32_2d3d.y + YSIZE_2D3D);
408
}
409
 
6831 terminx 410
extern int32_t editorGet2dSpriteColor(int32_t spr);
5281 terminx 411
 
1644 helixhorne 412
#define SPRITESEC(j) (sector[sprite[j].sectnum])
413
 
1708 helixhorne 414
#define SCRIPTHISTSIZ 32  // should be the same as OSD_HISTORYDEPTH for maximum win, should be a power of two
2795 helixhorne 415
extern char *scripthist[SCRIPTHISTSIZ];
1661 helixhorne 416
extern int32_t scripthistend;
417
 
1696 helixhorne 418
//////////////////// Aiming ////////////////////
419
#define SEARCH_WALL 0
420
#define SEARCH_CEILING 1
421
#define SEARCH_FLOOR 2
422
#define SEARCH_SPRITE 3
423
#define SEARCH_MASKWALL 4
424
 
5307 terminx 425
#define ASSERT_AIMING ((unsigned)searchstat<=4)
1696 helixhorne 426
 
427
#define AIMING_AT_WALL (searchstat==0)
428
#define AIMING_AT_CEILING (searchstat==1)
429
#define AIMING_AT_FLOOR (searchstat==2)
430
#define AIMING_AT_SPRITE (searchstat==3)
431
#define AIMING_AT_MASKWALL (searchstat==4)
432
 
433
#define AIMING_AT_WALL_OR_MASK (AIMING_AT_WALL || AIMING_AT_MASKWALL)
434
#define AIMING_AT_CEILING_OR_FLOOR (AIMING_AT_CEILING || AIMING_AT_FLOOR)
435
 
3911 helixhorne 436
// SaveBoard flags.
437
enum SaveBoardFlags
438
{
439
    M32_SB_NOEXT = 1,  // no ExtSaveMap (backup.map) and no taglabels saving
440
    M32_SB_ASKOV = 2,  // for NEW_MAP_FORMAT build, ask whether write map if going from V7/8 to VX
441
};
442
 
1706 helixhorne 443
// showdebug is now used as a general informational on-screen display
444
#define M32_SHOWDEBUG
445
 
1790 helixhorne 446
// this should be only used if there's no dependency on endwall after the loop.
447
// of course, users of this macro should know that it modifies startwall and endwall.
448
#define WALLS_OF_SECTOR(Sect, Itervar) \
449
    startwall=sector[(Sect)].wallptr, endwall=startwall+sector[(Sect)].wallnum, Itervar=startwall; \
450
    Itervar < endwall; \
451
    Itervar++
452
 
1870 helixhorne 453
#define SET_PROTECT_BITS(Var, Newval, Bitstoprotect) do {  \
454
    (Var) &= (Bitstoprotect);  \
455
    (Var) |= (Newval) & ~(Bitstoprotect); } while (0)
456
 
1801 helixhorne 457
#define BTAG_MAX 65535
458
#define BZ_MAX 8388608
1848 helixhorne 459
#define BHEINUM_MAX 32767
1801 helixhorne 460
 
1848 helixhorne 461
#define M32_MAXPALOOKUPS (MAXPALOOKUPS-RESERVEDPALS-1)
1801 helixhorne 462
 
6076 hendricks2 463
static FORCE_INLINE void inpclamp(int32_t *x, int32_t mi, int32_t ma)
1854 helixhorne 464
{
4898 terminx 465
    if (*x > ma) *x = ma;
466
    if (*x < mi) *x = mi;
1854 helixhorne 467
}
468
 
5300 terminx 469
#define drawtranspixel(p, col) drawpixel(p, blendtable[0][(readpixel(p) * 256) + col])
470
 
5429 helixhorne 471
// Timed offset for Mapster32 color index cycling.
472
// Range: 0 .. 16
8050 pogokeen 473
#define M32_THROB klabs(sintable[(((int32_t) totalclock << 4) & 2047)] >> 10)
5302 terminx 474
 
8484 hendricks2 475
void m32_showmouse(void);
476
 
4766 hendricks2 477
#ifdef __cplusplus
478
}
476 terminx 479
#endif
4766 hendricks2 480
 
481
#endif