2007-01-29 01:18:16 +00:00
|
|
|
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
|
|
|
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
|
|
|
// See the included license file "BUILDLIC.TXT" for license info.
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef editor_h_
|
|
|
|
#define editor_h_
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2015-07-08 03:34:42 +00:00
|
|
|
#include "baselayer.h"
|
2010-11-23 22:30:27 +00:00
|
|
|
#include <math.h>
|
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
2007-01-29 01:18:16 +00:00
|
|
|
#endif
|
|
|
|
|
2011-03-04 18:47:06 +00:00
|
|
|
#define VERSION "2.0.0devel"
|
2009-05-01 19:28:57 +00:00
|
|
|
|
2014-07-28 06:43:16 +00:00
|
|
|
extern const char *defaultsetupfilename;
|
2014-02-22 08:03:02 +00:00
|
|
|
extern char setupfilename[BMAX_PATH];
|
|
|
|
|
2014-07-28 06:42:28 +00:00
|
|
|
extern char levelname[BMAX_PATH];
|
|
|
|
|
2008-05-16 00:23:33 +00:00
|
|
|
// Build keys
|
|
|
|
#define BK_MOVEFORWARD 0
|
|
|
|
#define BK_MOVEBACKWARD 1
|
|
|
|
#define BK_TURNLEFT 2
|
|
|
|
#define BK_TURNRIGHT 3
|
|
|
|
#define BK_RUN 4
|
|
|
|
#define BK_STRAFE 5
|
2015-01-18 22:11:31 +00:00
|
|
|
//#define BK_SHOOT 6
|
|
|
|
//#define BK_OPEN 7
|
2008-05-16 00:23:33 +00:00
|
|
|
#define BK_MOVEUP 8
|
|
|
|
#define BK_MOVEDOWN 9
|
2015-01-18 22:11:31 +00:00
|
|
|
//#define BK_LOOKUP 10
|
|
|
|
//#define BK_LOOKDOWN 11
|
|
|
|
//#define BK_STRAFELEFT 12
|
|
|
|
//#define BK_STRAFERIGHT 13
|
2008-05-16 00:23:33 +00:00
|
|
|
#define BK_MODE2D_3D 14
|
2015-01-18 22:11:31 +00:00
|
|
|
//#define BK_PLAYERVIEW 15
|
|
|
|
//#define BK_ZOOMIN 16
|
|
|
|
//#define BK_ZOOMOUT 17
|
|
|
|
//#define BK_MESSAGE 18
|
2008-05-16 00:23:33 +00:00
|
|
|
#define BK_CONSOLE 19
|
2007-01-29 01:18:16 +00:00
|
|
|
#define NUMBUILDKEYS 20
|
|
|
|
|
2011-05-15 22:37:24 +00:00
|
|
|
extern int32_t horiz;
|
|
|
|
extern vec3_t pos;
|
|
|
|
extern int16_t ang, cursectnum;
|
2013-02-19 20:35:14 +00:00
|
|
|
extern int32_t g_doHardcodedMovement;
|
2011-05-15 22:37:24 +00:00
|
|
|
|
2011-09-16 19:17:48 +00:00
|
|
|
extern int8_t m32_clipping; // 0: none, 1: only white walls, 2: like game
|
|
|
|
|
2011-05-15 22:37:24 +00:00
|
|
|
extern int16_t editstatus, searchit;
|
|
|
|
extern int32_t searchx, searchy, osearchx, osearchy; //search input
|
|
|
|
|
|
|
|
extern int16_t searchsector, searchwall, searchstat; //search output
|
2011-03-17 23:37:38 +00:00
|
|
|
extern int16_t searchbottomwall, searchisbottom;
|
2011-03-08 23:02:38 +00:00
|
|
|
extern int32_t zmode, kensplayerheight, zlock;
|
2011-02-24 20:40:27 +00:00
|
|
|
|
2011-05-15 22:37:24 +00:00
|
|
|
extern int16_t highlightsector[MAXSECTORS], highlightsectorcnt;
|
|
|
|
extern int16_t highlight[MAXWALLS+MAXSPRITES];
|
|
|
|
extern int16_t asksave;
|
|
|
|
|
|
|
|
extern int16_t pointhighlight, linehighlight, highlightcnt;
|
|
|
|
|
2011-02-24 20:40:27 +00:00
|
|
|
#define DEFAULT_SPRITE_CSTAT 0
|
|
|
|
//extern int16_t defaultspritecstat;
|
2009-01-09 09:29:17 +00:00
|
|
|
|
2012-06-01 20:09:19 +00:00
|
|
|
extern int32_t tempsectornum;
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t temppicnum, tempcstat, templotag, temphitag, tempextra;
|
2011-05-12 23:31:13 +00:00
|
|
|
extern uint32_t temppal, tempvis, tempxrepeat, tempyrepeat, tempxpanning, tempypanning;
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t tempshade, tempxvel, tempyvel, tempzvel;
|
|
|
|
extern char somethingintab;
|
|
|
|
|
2011-05-15 22:37:24 +00:00
|
|
|
extern char names[MAXTILES][25];
|
2009-01-09 09:29:17 +00:00
|
|
|
extern uint8_t buildkeys[NUMBUILDKEYS];
|
|
|
|
|
2014-09-30 04:06:57 +00:00
|
|
|
extern float vid_gamma_3d, vid_contrast_3d, vid_brightness_3d;
|
2011-05-15 22:37:24 +00:00
|
|
|
extern double msens;
|
|
|
|
|
2012-10-01 17:52:30 +00:00
|
|
|
extern vec3_t startpos;
|
2011-05-15 22:37:24 +00:00
|
|
|
extern int16_t startang, startsectnum;
|
2010-08-02 18:59:59 +00:00
|
|
|
|
2011-05-15 22:37:24 +00:00
|
|
|
extern int32_t lastpm16time, synctics;
|
|
|
|
extern int32_t halfxdim16, midydim16, zoom;
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d, forcesetup;
|
|
|
|
extern int32_t unrealedlook, quickmapcycling;
|
|
|
|
extern int32_t pk_turnaccel,pk_turndecel,pk_uedaccel;
|
|
|
|
extern int32_t revertCTRL,scrollamount;
|
|
|
|
extern int32_t autosave;
|
|
|
|
extern int32_t mlook;
|
2011-05-22 21:52:22 +00:00
|
|
|
extern int16_t prefixtiles[10];
|
2009-01-09 09:29:17 +00:00
|
|
|
|
2011-05-15 22:37:24 +00:00
|
|
|
extern int32_t showfirstwall;
|
|
|
|
|
|
|
|
extern int32_t graphicsmode;
|
|
|
|
|
|
|
|
extern int32_t grid, autogrid;
|
|
|
|
extern int32_t editorgridextent; // in engine.c
|
|
|
|
|
|
|
|
extern char game_executable[BMAX_PATH];
|
2014-07-28 06:43:16 +00:00
|
|
|
extern const char* DefaultGameExec;
|
|
|
|
extern const char* DefaultGameLocalExec;
|
|
|
|
|
2009-05-05 16:21:33 +00:00
|
|
|
extern char program_origcwd[BMAX_PATH];
|
2011-06-16 19:39:22 +00:00
|
|
|
extern const char *mapster32_fullpath;
|
2009-05-05 16:21:33 +00:00
|
|
|
extern char *testplay_addparam;
|
2011-03-07 16:30:06 +00:00
|
|
|
extern const char *g_namesFileName;
|
2009-05-05 16:21:33 +00:00
|
|
|
|
2015-05-26 00:48:01 +00:00
|
|
|
extern int32_t gridlock;
|
|
|
|
|
2011-05-23 18:07:45 +00:00
|
|
|
extern int32_t g_maxCacheSize;
|
2011-05-15 22:37:24 +00:00
|
|
|
|
2011-05-18 22:44:09 +00:00
|
|
|
extern int32_t g_lazy_tileselector;
|
2010-05-22 23:42:37 +00:00
|
|
|
extern int32_t m32_osd_tryscript;
|
2010-08-11 22:37:45 +00:00
|
|
|
extern int32_t showheightindicators;
|
|
|
|
extern int32_t showambiencesounds;
|
2010-05-22 23:42:37 +00:00
|
|
|
|
2011-05-29 12:30:38 +00:00
|
|
|
extern int32_t numgraysects;
|
2011-04-22 22:51:03 +00:00
|
|
|
extern uint8_t graysectbitmap[MAXSECTORS>>3];
|
|
|
|
extern uint8_t graywallbitmap[MAXWALLS>>3];
|
2011-07-04 21:20:59 +00:00
|
|
|
extern int32_t autogray, showinnergray;
|
2011-04-22 22:51:03 +00:00
|
|
|
|
2014-07-28 06:44:37 +00:00
|
|
|
extern void drawgradient(void);
|
|
|
|
|
2011-05-12 23:31:13 +00:00
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
int32_t yax_is121(int16_t bunchnum, int16_t getfloor);
|
|
|
|
#endif
|
|
|
|
|
2012-02-04 21:33:52 +00:00
|
|
|
extern void M32_DrawRoomsAndMasks(void);
|
|
|
|
|
2012-02-16 19:25:42 +00:00
|
|
|
extern void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore); // editor-only
|
|
|
|
extern void M32_ResetFakeRORTiles(void);
|
|
|
|
|
2011-08-20 11:54:16 +00:00
|
|
|
// set to 1 to enable:
|
2012-03-15 18:12:17 +00:00
|
|
|
#define M32_UNDO 1
|
2011-05-15 22:37:24 +00:00
|
|
|
extern int32_t map_revision;
|
|
|
|
extern int32_t map_undoredo(int32_t dir);
|
|
|
|
extern void map_undoredo_free(void);
|
2014-07-28 06:44:37 +00:00
|
|
|
extern void create_map_snapshot(void);
|
|
|
|
|
|
|
|
typedef struct mapundo_
|
|
|
|
{
|
|
|
|
int32_t revision;
|
|
|
|
int32_t num[3]; // numsectors, numwalls, numsprites
|
|
|
|
|
|
|
|
// These exist temporarily as sector/wall/sprite data, but are compressed
|
|
|
|
// most of the time. +4 bytes refcount at the beginning.
|
|
|
|
char *sws[3]; // sector, wall, sprite
|
|
|
|
|
2016-01-11 05:06:02 +00:00
|
|
|
uintptr_t crc[3];
|
2014-07-28 06:44:37 +00:00
|
|
|
|
|
|
|
struct mapundo_ *next; // 'redo' loads this
|
|
|
|
struct mapundo_ *prev; // 'undo' loads this
|
|
|
|
} mapundo_t;
|
|
|
|
extern mapundo_t *mapstate;
|
|
|
|
|
|
|
|
extern void FuncMenu(void);
|
|
|
|
#ifdef LUNATIC
|
|
|
|
extern void LuaFuncMenu(void);
|
|
|
|
#endif
|
2011-05-15 22:37:24 +00:00
|
|
|
|
2010-11-27 22:12:24 +00:00
|
|
|
// editor side view
|
|
|
|
extern int32_t m32_sideview;
|
|
|
|
extern int32_t m32_sideelev;
|
|
|
|
extern int16_t m32_sideang;
|
|
|
|
extern int32_t m32_sidecos, m32_sidesin;
|
|
|
|
extern int32_t m32_swcnt;
|
2011-04-11 22:28:58 +00:00
|
|
|
extern int32_t m32_wallscreenxy[MAXWALLS][2];
|
|
|
|
extern int16_t m32_wallsprite[MAXWALLS+MAXSPRITES];
|
2010-11-27 22:12:24 +00:00
|
|
|
extern int8_t sideview_reversehrot;
|
2011-09-06 17:46:00 +00:00
|
|
|
extern int32_t scalescreeny(int32_t sy);
|
2010-12-19 22:47:10 +00:00
|
|
|
extern void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome) ATTRIBUTE((nonnull));
|
2010-12-05 17:39:52 +00:00
|
|
|
//extern void invscreencoords(int32_t *dx, int32_t *dy, int32_t sx, int32_t sy, int32_t zoome);
|
2010-12-19 22:47:10 +00:00
|
|
|
extern int32_t getinvdisplacement(int32_t *dx, int32_t *dy, int32_t dz) ATTRIBUTE((nonnull));
|
2011-09-06 17:46:00 +00:00
|
|
|
extern int32_t getscreenvdisp(int32_t bz, int32_t zoome);
|
2010-11-27 22:12:24 +00:00
|
|
|
extern void setup_sideview_sincos(void);
|
|
|
|
|
2013-01-16 20:38:56 +00:00
|
|
|
extern int8_t keeptexturestretch;
|
2016-01-15 07:58:57 +00:00
|
|
|
extern int16_t pointhighlightdist, linehighlightdist;
|
2013-01-16 20:38:56 +00:00
|
|
|
|
2011-02-25 22:10:25 +00:00
|
|
|
extern int32_t wallength(int16_t i);
|
|
|
|
extern void fixrepeats(int16_t i);
|
2011-05-07 18:23:34 +00:00
|
|
|
extern uint32_t getlenbyrep(int32_t len, int32_t repeat);
|
|
|
|
extern void fixxrepeat(int16_t wallnum, uint32_t lenrepquot);
|
2011-03-17 23:37:38 +00:00
|
|
|
extern void AlignWallPoint2(int32_t w0);
|
2011-05-07 18:23:34 +00:00
|
|
|
extern int32_t AutoAlignWalls(int32_t w0, uint32_t flags, int32_t nrecurs);
|
2011-02-25 22:10:25 +00:00
|
|
|
|
2013-05-30 18:10:45 +00:00
|
|
|
extern void SetFirstWall(int32_t sectnum, int32_t wallnum, int32_t alsoynw);
|
2011-11-11 20:05:29 +00:00
|
|
|
extern int32_t fixspritesectors(void);
|
2011-09-04 19:43:48 +00:00
|
|
|
extern void clearkeys(void);
|
2011-05-29 23:10:51 +00:00
|
|
|
|
2014-07-24 14:01:44 +00:00
|
|
|
extern const char *ExtGetVer(void);
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t ExtInit(void);
|
2016-01-12 10:30:56 +00:00
|
|
|
extern int32_t ExtPreInit(int32_t argc,char const * const * argv);
|
2014-07-28 06:42:28 +00:00
|
|
|
extern int32_t ExtPostStartupWindow(void);
|
2015-09-23 17:54:42 +00:00
|
|
|
extern void ExtPostInit(void);
|
2007-01-29 01:18:16 +00:00
|
|
|
extern void ExtUnInit(void);
|
|
|
|
extern void ExtPreCheckKeys(void);
|
2012-08-13 18:25:37 +00:00
|
|
|
extern void ExtAnalyzeSprites(int32_t, int32_t, int32_t, int32_t);
|
2007-01-29 01:18:16 +00:00
|
|
|
extern void ExtCheckKeys(void);
|
|
|
|
extern void ExtPreLoadMap(void);
|
2011-11-11 20:05:29 +00:00
|
|
|
extern void ExtSetupMapFilename(const char *mapname);
|
2007-01-29 01:18:16 +00:00
|
|
|
extern void ExtLoadMap(const char *mapname);
|
2011-11-11 20:05:29 +00:00
|
|
|
extern int32_t ExtPreSaveMap(void);
|
2007-01-29 01:18:16 +00:00
|
|
|
extern void ExtSaveMap(const char *mapname);
|
2009-01-09 09:29:17 +00:00
|
|
|
extern const char *ExtGetSectorCaption(int16_t sectnum);
|
|
|
|
extern const char *ExtGetWallCaption(int16_t wallnum);
|
|
|
|
extern const char *ExtGetSpriteCaption(int16_t spritenum);
|
|
|
|
extern void ExtShowSectorData(int16_t sectnum);
|
|
|
|
extern void ExtShowWallData(int16_t wallnum);
|
|
|
|
extern void ExtShowSpriteData(int16_t spritenum);
|
|
|
|
extern void ExtEditSectorData(int16_t sectnum);
|
|
|
|
extern void ExtEditWallData(int16_t wallnum);
|
|
|
|
extern void ExtEditSpriteData(int16_t spritenum);
|
|
|
|
extern const char *ExtGetSectorType(int32_t lotag);
|
|
|
|
|
2013-10-28 21:26:25 +00:00
|
|
|
extern void B_SetBoardFileName(const char *fn);
|
2011-01-16 00:23:39 +00:00
|
|
|
extern int32_t LoadBoard(const char *filename, uint32_t flags);
|
|
|
|
extern const char *SaveBoard(const char *fn, uint32_t flags);
|
2012-10-01 17:52:44 +00:00
|
|
|
extern const char *GetSaveBoardFilename(const char *fn);
|
2011-01-16 00:23:39 +00:00
|
|
|
|
2014-08-08 20:02:54 +00:00
|
|
|
extern int32_t clockdir(int32_t wallstart);
|
|
|
|
extern int32_t loopinside(int32_t x, int32_t y, int16_t startwall);
|
|
|
|
|
|
|
|
enum {
|
|
|
|
// NOTE: These must not be changed, see e.g. loopinside().
|
|
|
|
CLOCKDIR_CW = 0, // outer loop
|
|
|
|
CLOCKDIR_CCW = 1, // inner loop
|
|
|
|
};
|
|
|
|
|
|
|
|
// <loopstart> has to be the starting (i.e. least index) wall of a loop!
|
|
|
|
//
|
|
|
|
// The returned value will be either
|
|
|
|
// - the starting wall of the next loop of this sector,
|
|
|
|
// - the first wall of the next sector, or
|
|
|
|
// - out of bounds (== MAXWALLS).
|
|
|
|
// Thus, it MUST be checked for a proper bound!
|
|
|
|
static inline int32_t get_nextloopstart(int32_t loopstart)
|
|
|
|
{
|
|
|
|
int32_t i = loopstart;
|
|
|
|
|
|
|
|
while (++i) // sic
|
|
|
|
if (wall[i].point2 == loopstart)
|
|
|
|
return i + 1;
|
|
|
|
|
|
|
|
return MAXWALLS;
|
|
|
|
}
|
|
|
|
|
2011-01-16 00:23:39 +00:00
|
|
|
#define CORRUPT_SECTOR (1<<17)
|
|
|
|
#define CORRUPT_WALL (1<<18)
|
|
|
|
#define CORRUPT_SPRITE (1<<19)
|
|
|
|
#define CORRUPT_MASK (CORRUPT_SECTOR|CORRUPT_WALL|CORRUPT_SPRITE)
|
|
|
|
#define MAXCORRUPTTHINGS 64
|
2011-02-13 15:15:37 +00:00
|
|
|
extern int32_t corruptlevel, numcorruptthings, corruptthings[MAXCORRUPTTHINGS];
|
2011-01-03 22:04:20 +00:00
|
|
|
extern int32_t autocorruptcheck;
|
2015-08-08 07:04:14 +00:00
|
|
|
extern int32_t corruptcheck_noalreadyrefd, corruptcheck_heinum;
|
2015-11-14 17:21:11 +00:00
|
|
|
extern int32_t corruptcheck_game_duke3d;
|
2014-07-28 06:44:37 +00:00
|
|
|
extern int32_t corrupt_tryfix_alt;
|
2011-02-21 23:08:21 +00:00
|
|
|
extern int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing);
|
2011-01-03 22:04:20 +00:00
|
|
|
|
2011-11-11 20:05:29 +00:00
|
|
|
extern int32_t fixmaponsave_sprites;
|
2011-03-13 11:59:32 +00:00
|
|
|
extern int32_t m32_script_expertmode; // if true, make read-only vars writable
|
|
|
|
|
2010-08-17 20:00:44 +00:00
|
|
|
extern void showsectordata(int16_t sectnum, int16_t small);
|
|
|
|
extern void showwalldata(int16_t wallnum, int16_t small);
|
|
|
|
extern void showspritedata(int16_t spritenum, int16_t small);
|
|
|
|
|
2015-07-10 07:56:48 +00:00
|
|
|
extern void drawsmallabel(const char *text, char col, char backcol, char border, int32_t dax, int32_t day, int32_t daz);
|
2011-03-07 16:30:06 +00:00
|
|
|
|
2015-10-20 07:15:01 +00:00
|
|
|
extern uint8_t blackcol;
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t circlewall;
|
2015-07-10 07:56:48 +00:00
|
|
|
extern int32_t searchlock;
|
2009-01-09 09:29:17 +00:00
|
|
|
|
|
|
|
int32_t loadsetup(const char *fn); // from config.c
|
|
|
|
int32_t writesetup(const char *fn); // from config.c
|
2007-01-29 01:18:16 +00:00
|
|
|
|
|
|
|
void editinput(void);
|
|
|
|
void clearmidstatbar16(void);
|
2011-04-22 22:51:03 +00:00
|
|
|
void fade_editor_screen(int32_t keepcol);
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2011-04-17 17:01:20 +00:00
|
|
|
// internal getnumber* helpers:
|
|
|
|
extern int32_t getnumber_internal1(char ch, int32_t *danumptr, int32_t maxnumber, char sign);
|
|
|
|
extern int32_t getnumber_autocomplete(const char *namestart, char ch, int32_t *danum, int32_t flags);
|
|
|
|
|
2014-07-28 06:44:37 +00:00
|
|
|
// always CRLF for us
|
|
|
|
#ifdef _WIN32
|
|
|
|
# define OURNEWL "\n"
|
|
|
|
#else
|
|
|
|
# define OURNEWL "\r\n"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
extern const char *yupdownwall[2];
|
|
|
|
extern const char *YUPDOWNWALL[2];
|
|
|
|
#endif
|
|
|
|
|
2013-09-21 13:38:44 +00:00
|
|
|
int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, char sign, const char *(func)(int32_t));
|
2008-09-03 10:47:19 +00:00
|
|
|
#define getnumber256(namestart, num, maxnumber, sign) _getnumber256(namestart, num, maxnumber, sign, NULL)
|
2013-09-21 13:38:44 +00:00
|
|
|
int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char sign, const char *(func)(int32_t));
|
2008-09-03 10:47:19 +00:00
|
|
|
#define getnumber16(namestart, num, maxnumber, sign) _getnumber16(namestart, num, maxnumber, sign, NULL)
|
2010-05-18 05:14:17 +00:00
|
|
|
void printmessage256(int32_t x, int32_t y, const char *name);
|
2010-12-19 22:47:10 +00:00
|
|
|
void message(const char *fmt, ...) ATTRIBUTE((format(printf,1,2)));
|
2014-07-28 06:44:37 +00:00
|
|
|
void silentmessage(const char *fmt, ...) ATTRIBUTE((format(printf,1,2)));
|
2013-06-28 14:07:44 +00:00
|
|
|
extern int32_t AskIfSure(const char *text);
|
2010-05-18 05:14:17 +00:00
|
|
|
|
2014-07-28 06:44:37 +00:00
|
|
|
extern char getmessage[162], getmessageleng;
|
|
|
|
extern int32_t getmessagetimeoff;
|
|
|
|
|
|
|
|
extern int32_t mouseaction;
|
|
|
|
|
2011-04-17 17:01:20 +00:00
|
|
|
const char* getstring_simple(const char *querystr, const char *defaultstr, int32_t maxlen, int32_t completion);
|
2010-08-14 21:32:28 +00:00
|
|
|
|
2010-05-18 05:14:17 +00:00
|
|
|
// like snprintf, but pads the output buffer with 'fill' at the end
|
2010-12-19 22:47:10 +00:00
|
|
|
//int32_t snfillprintf(char *outbuf, size_t bufsiz, int32_t fill, const char *fmt, ...);
|
|
|
|
void _printmessage16(const char *fmt, ...) ATTRIBUTE((format(printf,1,2)));
|
2008-06-10 02:29:58 +00:00
|
|
|
|
|
|
|
#define printmessage16(fmt, ...) lastpm16time = totalclock, _printmessage16(fmt, ## __VA_ARGS__)
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2009-05-08 23:13:12 +00:00
|
|
|
extern char lastpm16buf[156];
|
2009-05-01 06:35:27 +00:00
|
|
|
|
2015-10-31 15:13:32 +00:00
|
|
|
int32_t fillsector_maybetrans(int16_t sectnum, int32_t fillcolor, uint8_t dotrans); // fillcolor == -1: default (pulsating)
|
2011-05-23 22:42:39 +00:00
|
|
|
int32_t ask_if_sure(const char *query, uint32_t flags);
|
|
|
|
int32_t editor_ask_function(const char *question, const char *dachars, int32_t numchars);
|
2011-04-28 21:28:33 +00:00
|
|
|
|
2015-10-31 15:13:32 +00:00
|
|
|
static inline int32_t fillsector(int16_t sectnum, int32_t fillcolor)
|
|
|
|
{
|
|
|
|
return fillsector_maybetrans(sectnum, fillcolor, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int32_t fillsector_notrans(int16_t sectnum, int32_t fillcolor)
|
|
|
|
{
|
|
|
|
return fillsector_maybetrans(sectnum, fillcolor, 0);
|
|
|
|
}
|
|
|
|
|
2012-11-17 19:46:43 +00:00
|
|
|
void spriteoncfz(int32_t i, int32_t *czptr, int32_t *fzptr) ATTRIBUTE((nonnull(2,3)));
|
2011-02-24 20:40:27 +00:00
|
|
|
void DoSpriteOrnament(int32_t i);
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void getpoint(int32_t searchxe, int32_t searchye, int32_t *x, int32_t *y);
|
|
|
|
int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point);
|
2011-04-22 22:51:03 +00:00
|
|
|
void update_highlight(void);
|
|
|
|
void update_highlightsector(void);
|
2012-08-20 21:27:42 +00:00
|
|
|
void reset_highlightsector(void);
|
|
|
|
void reset_highlight(void);
|
2015-09-05 08:30:59 +00:00
|
|
|
void handlesecthighlight1(int32_t i, int32_t sub, int32_t nograycheck);
|
* New m32script commands:
- sethighlightsector <sectnum> <on?>
- updatehighlightsector
- collectsectors <<array_to_collect_sectnums>> <initial_sector> <<num_collected_sectors>> <sector_filtering_state>
The latter does a breadth-first search starting from an initial sector and collects nextsectors only when the filtering state, given a sectnum as RETURN input, writes a nonzero value into RETURN. As a usage example, a.m32 includes the state 'collect_teleporting_sectors', that collects all sectors containing an SE7 and highlights them afterwards. This way, it should be possible to retrofit old maps with TROR by distributing small scripts that do most of the work (right now, joining has to be done by hand, though).
* corruption checker: for the 'nextwall inconsistent with nextsector' corruption, suggest an alternative fix by searching fitting nextwalls and changing the nextwall of the corrupt wall (as opposed to the nextsector). It will display with a leading '?' in the listing, and can be demanded by suffixing 'corruptcheck tryfix' with it. For example,
corruptcheck tryfix 9-21 ?
would fix some corruptions in Billy Boy's cranium.map without introducing drawing errors.
* fix demo playback (tueidj figured this out)
git-svn-id: https://svn.eduke32.com/eduke32@1927 1a8010ca-5511-0410-912e-c29ae57300e0
2011-07-03 22:51:28 +00:00
|
|
|
void ovh_whiteoutgrab(int32_t restoreredwalls);
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2011-05-23 22:42:39 +00:00
|
|
|
int32_t inside_editor_curpos(int16_t sectnum);
|
2011-03-07 16:30:06 +00:00
|
|
|
void correct_sprite_yoffset(int32_t i);
|
2011-03-05 12:59:27 +00:00
|
|
|
|
2012-06-20 20:55:03 +00:00
|
|
|
void inflineintersect(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
|
|
|
int32_t x3, int32_t y3, int32_t x4, int32_t y4,
|
|
|
|
int32_t *intx, int32_t *inty, int32_t *sign12, int32_t *sign34);
|
|
|
|
|
2012-11-04 23:03:22 +00:00
|
|
|
void ovhscrcoords(int32_t x, int32_t y, int32_t *scrx, int32_t *scry);
|
|
|
|
|
2011-02-24 20:40:27 +00:00
|
|
|
extern uint8_t hlsectorbitmap[MAXSECTORS>>3];
|
|
|
|
|
2009-05-05 16:21:33 +00:00
|
|
|
void test_map(int32_t mode);
|
|
|
|
|
2014-07-28 06:44:37 +00:00
|
|
|
extern void M32RunScript(const char *s);
|
2010-05-18 05:14:17 +00:00
|
|
|
|
2011-04-17 17:01:20 +00:00
|
|
|
////////// tag labeling system //////////
|
|
|
|
// max (strlen+1), i.e. array length to allocate for a tag label:
|
|
|
|
#define TAGLAB_MAX 40
|
|
|
|
|
|
|
|
extern int32_t taglab_load(const char *filename, int32_t flags);
|
|
|
|
extern int32_t taglab_save(const char *mapname);
|
|
|
|
|
|
|
|
extern void taglab_init();
|
|
|
|
extern int32_t taglab_add(const char *label, int16_t tag);
|
|
|
|
extern const char *taglab_getlabel(int16_t tag);
|
|
|
|
extern int32_t taglab_gettag(const char *label);
|
|
|
|
|
|
|
|
extern int32_t taglab_linktags(int32_t spritep, int32_t num);
|
2014-05-06 22:15:19 +00:00
|
|
|
extern int32_t taglab_getnextfreetag(int32_t *duetoptr);
|
2011-04-17 17:01:20 +00:00
|
|
|
|
|
|
|
extern int32_t showtags;
|
|
|
|
|
2012-11-03 19:32:39 +00:00
|
|
|
int32_t select_sprite_tag(int32_t spritenum);
|
|
|
|
|
2015-07-08 03:34:42 +00:00
|
|
|
extern int32_t m32_2d3dmode, m32_2d3dsize;
|
|
|
|
extern vec2_t m32_2d3d;
|
|
|
|
|
|
|
|
#define XSIZE_2D3D (xdim2d / m32_2d3dsize)
|
|
|
|
#define YSIZE_2D3D (ydim2d / m32_2d3dsize)
|
|
|
|
|
2015-07-11 14:13:04 +00:00
|
|
|
static inline int32_t m32_2d3d_resolutions_match()
|
|
|
|
{
|
|
|
|
return (xdimgame == xdim2d && ydimgame == ydim2d);
|
|
|
|
}
|
|
|
|
|
2015-07-08 03:34:42 +00:00
|
|
|
static inline int32_t m32_is2d3dmode(void)
|
|
|
|
{
|
2015-10-20 07:14:52 +00:00
|
|
|
return !in3dmode() && m32_2d3dmode && (unsigned)cursectnum < MAXSECTORS &&
|
2015-07-11 14:13:04 +00:00
|
|
|
m32_2d3d_resolutions_match() &&
|
|
|
|
searchx > m32_2d3d.x && searchx < (m32_2d3d.x + XSIZE_2D3D) &&
|
2015-07-08 03:34:42 +00:00
|
|
|
searchy > m32_2d3d.y && searchy < (m32_2d3d.y + YSIZE_2D3D);
|
|
|
|
}
|
|
|
|
|
2015-07-08 03:34:46 +00:00
|
|
|
extern int32_t getspritecol(int32_t spr);
|
2011-04-17 17:01:20 +00:00
|
|
|
|
2010-05-18 05:14:17 +00:00
|
|
|
#define NEXTWALL(i) (wall[wall[i].nextwall])
|
|
|
|
#define POINT2(i) (wall[wall[i].point2])
|
|
|
|
#define SPRITESEC(j) (sector[sprite[j].sectnum])
|
|
|
|
|
2010-09-27 21:52:04 +00:00
|
|
|
#define SCRIPTHISTSIZ 32 // should be the same as OSD_HISTORYDEPTH for maximum win, should be a power of two
|
2012-07-01 22:11:25 +00:00
|
|
|
extern char *scripthist[SCRIPTHISTSIZ];
|
2010-06-25 23:01:54 +00:00
|
|
|
extern int32_t scripthistend;
|
|
|
|
|
2010-08-16 13:56:49 +00:00
|
|
|
//////////////////// Aiming ////////////////////
|
|
|
|
#define SEARCH_WALL 0
|
|
|
|
#define SEARCH_CEILING 1
|
|
|
|
#define SEARCH_FLOOR 2
|
|
|
|
#define SEARCH_SPRITE 3
|
|
|
|
#define SEARCH_MASKWALL 4
|
|
|
|
|
2015-07-22 02:06:23 +00:00
|
|
|
#define ASSERT_AIMING ((unsigned)searchstat<=4)
|
2010-08-16 13:56:49 +00:00
|
|
|
|
|
|
|
#define AIMING_AT_WALL (searchstat==0)
|
|
|
|
#define AIMING_AT_CEILING (searchstat==1)
|
|
|
|
#define AIMING_AT_FLOOR (searchstat==2)
|
|
|
|
#define AIMING_AT_SPRITE (searchstat==3)
|
|
|
|
#define AIMING_AT_MASKWALL (searchstat==4)
|
|
|
|
|
|
|
|
#define AIMING_AT_WALL_OR_MASK (AIMING_AT_WALL || AIMING_AT_MASKWALL)
|
|
|
|
#define AIMING_AT_CEILING_OR_FLOOR (AIMING_AT_CEILING || AIMING_AT_FLOOR)
|
|
|
|
|
2013-06-28 14:07:44 +00:00
|
|
|
// SaveBoard flags.
|
|
|
|
enum SaveBoardFlags
|
|
|
|
{
|
|
|
|
M32_SB_NOEXT = 1, // no ExtSaveMap (backup.map) and no taglabels saving
|
|
|
|
M32_SB_ASKOV = 2, // for NEW_MAP_FORMAT build, ask whether write map if going from V7/8 to VX
|
|
|
|
};
|
|
|
|
|
2010-09-06 23:08:35 +00:00
|
|
|
// showdebug is now used as a general informational on-screen display
|
|
|
|
#define M32_SHOWDEBUG
|
|
|
|
|
2011-02-10 23:15:02 +00:00
|
|
|
// this should be only used if there's no dependency on endwall after the loop.
|
|
|
|
// of course, users of this macro should know that it modifies startwall and endwall.
|
|
|
|
#define WALLS_OF_SECTOR(Sect, Itervar) \
|
|
|
|
startwall=sector[(Sect)].wallptr, endwall=startwall+sector[(Sect)].wallnum, Itervar=startwall; \
|
|
|
|
Itervar < endwall; \
|
|
|
|
Itervar++
|
|
|
|
|
2011-04-22 22:51:03 +00:00
|
|
|
#define SET_PROTECT_BITS(Var, Newval, Bitstoprotect) do { \
|
|
|
|
(Var) &= (Bitstoprotect); \
|
|
|
|
(Var) |= (Newval) & ~(Bitstoprotect); } while (0)
|
|
|
|
|
2011-02-24 20:40:27 +00:00
|
|
|
#define BTAG_MAX 65535
|
|
|
|
#define BZ_MAX 8388608
|
2011-03-17 23:37:38 +00:00
|
|
|
#define BHEINUM_MAX 32767
|
2011-02-24 20:40:27 +00:00
|
|
|
|
2011-03-17 23:37:38 +00:00
|
|
|
#define M32_MAXPALOOKUPS (MAXPALOOKUPS-RESERVEDPALS-1)
|
|
|
|
|
2015-01-11 04:55:07 +00:00
|
|
|
FORCE_INLINE int32_t atoi_safe(const char *str) { return (int32_t)Bstrtol(str, NULL, 10); }
|
2011-02-24 20:40:27 +00:00
|
|
|
|
2015-01-11 04:55:07 +00:00
|
|
|
FORCE_INLINE void inpclamp(int32_t *x, int32_t mi, int32_t ma)
|
2011-03-23 17:41:01 +00:00
|
|
|
{
|
2015-01-11 04:55:07 +00:00
|
|
|
if (*x > ma) *x = ma;
|
|
|
|
if (*x < mi) *x = mi;
|
2011-03-23 17:41:01 +00:00
|
|
|
}
|
|
|
|
|
2015-07-17 00:12:40 +00:00
|
|
|
#define drawtranspixel(p, col) drawpixel(p, blendtable[0][(readpixel(p) * 256) + col])
|
|
|
|
|
2015-11-14 23:40:59 +00:00
|
|
|
// Timed offset for Mapster32 color index cycling.
|
|
|
|
// Range: 0 .. 16
|
2015-07-17 00:12:48 +00:00
|
|
|
#define M32_THROB klabs(sintable[((totalclock << 4) & 2047)] >> 10)
|
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-01-29 01:18:16 +00:00
|
|
|
#endif
|