2007-09-05 21:56:58 +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.
|
|
|
|
//
|
|
|
|
// This file has been modified from Ken Silverman's original release
|
|
|
|
// by Jonathon Fowler (jonof@edgenetwk.com)
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __build_h__
|
|
|
|
#define __build_h__
|
|
|
|
|
2008-02-16 22:27:08 +00:00
|
|
|
#include "compat.h"
|
2009-02-28 07:44:54 +00:00
|
|
|
#include "pragmas.h"
|
2008-02-16 22:27:08 +00:00
|
|
|
|
2007-09-05 21:56:58 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define MAXSECTORSV8 4096
|
|
|
|
#define MAXWALLSV8 16384
|
|
|
|
#define MAXSPRITESV8 16384
|
|
|
|
|
|
|
|
#define MAXSECTORSV7 1024
|
|
|
|
#define MAXWALLSV7 8192
|
|
|
|
#define MAXSPRITESV7 4096
|
|
|
|
|
|
|
|
#define MAXSECTORS MAXSECTORSV8
|
|
|
|
#define MAXWALLS MAXWALLSV8
|
2008-04-03 06:58:36 +00:00
|
|
|
#define MAXWALLSB ((MAXWALLS>>2)+(MAXWALLS>>3))
|
2007-09-05 21:56:58 +00:00
|
|
|
#define MAXSPRITES MAXSPRITESV8
|
|
|
|
|
2011-02-24 20:40:27 +00:00
|
|
|
// additional space beyond wall, in walltypes:
|
2011-02-25 22:49:56 +00:00
|
|
|
#define M32_FIXME_WALLS 512
|
|
|
|
#define M32_FIXME_SECTORS 2
|
2011-02-24 20:40:27 +00:00
|
|
|
|
2007-09-05 21:56:58 +00:00
|
|
|
#define MAXTILES 15360
|
|
|
|
#define MAXVOXELS 4096
|
|
|
|
#define MAXSTATUS 1024
|
|
|
|
#define MAXPLAYERS 16
|
2011-04-07 01:16:29 +00:00
|
|
|
#define MAXXDIM 7680
|
|
|
|
#define MAXYDIM 3200
|
2011-01-27 07:05:12 +00:00
|
|
|
#define MAXBASEPALS 8
|
2007-09-05 21:56:58 +00:00
|
|
|
#define MAXPALOOKUPS 256
|
2011-05-12 23:31:13 +00:00
|
|
|
#define MAXPSKYMULTIS 8
|
2007-09-05 21:56:58 +00:00
|
|
|
#define MAXPSKYTILES 256
|
|
|
|
#define MAXSPRITESONSCREEN 4096
|
|
|
|
#define MAXUNIQHUDID 256 //Extra slots so HUD models can store animation state without messing game sprites
|
|
|
|
|
2009-12-05 09:22:43 +00:00
|
|
|
#define RESERVEDPALS 4 // don't forget to increment this when adding reserved pals
|
2007-09-05 21:56:58 +00:00
|
|
|
#define DETAILPAL (MAXPALOOKUPS - 1)
|
|
|
|
#define GLOWPAL (MAXPALOOKUPS - 2)
|
2009-04-28 22:56:43 +00:00
|
|
|
#define SPECULARPAL (MAXPALOOKUPS - 3)
|
|
|
|
#define NORMALPAL (MAXPALOOKUPS - 4)
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2008-07-22 12:17:05 +00:00
|
|
|
#define TSPR_TEMP 99
|
|
|
|
#define TSPR_MIRROR 100
|
2008-07-22 09:05:34 +00:00
|
|
|
|
2009-04-29 19:43:51 +00:00
|
|
|
#define PR_LIGHT_PRIO_MAX 0
|
|
|
|
#define PR_LIGHT_PRIO_MAX_GAME 1
|
|
|
|
#define PR_LIGHT_PRIO_HIGH 2
|
|
|
|
#define PR_LIGHT_PRIO_HIGH_GAME 3
|
|
|
|
#define PR_LIGHT_PRIO_LOW 4
|
|
|
|
#define PR_LIGHT_PRIO_LOW_GAME 5
|
|
|
|
|
2011-05-15 23:16:37 +00:00
|
|
|
////////// True Room over Room (YAX == rot -17 of "PRO") //////////
|
|
|
|
#define YAX_ENABLE
|
|
|
|
//#define YAX_DEBUG
|
|
|
|
//#define ENGINE_SCREENSHOT_DEBUG
|
|
|
|
|
2011-03-02 21:21:47 +00:00
|
|
|
////////// yax defs //////////
|
2011-05-07 18:23:34 +00:00
|
|
|
#define SECTORFLD(Sect,Fld, Cf) (*((Cf) ? (§or[Sect].floor##Fld) : (§or[Sect].ceiling##Fld)))
|
|
|
|
|
|
|
|
#define YAX_MAXBUNCHES 256
|
2011-03-02 21:21:47 +00:00
|
|
|
#define YAX_BIT 1024
|
2011-04-11 22:28:58 +00:00
|
|
|
// "has next wall when constrained"-bit (1<<10: ceiling, 1<<11: floor)
|
|
|
|
#define YAX_NEXTWALLBIT(Cf) (1<<(10+Cf))
|
|
|
|
#define YAX_NEXTWALLBITS (YAX_NEXTWALLBIT(0)|YAX_NEXTWALLBIT(1))
|
2011-03-23 17:41:01 +00:00
|
|
|
#define YAX_CEILING 0 // don't change!
|
|
|
|
#define YAX_FLOOR 1 // don't change!
|
2011-03-02 21:21:47 +00:00
|
|
|
|
2011-05-07 18:23:34 +00:00
|
|
|
void yax_updategrays(int32_t posze);
|
2011-03-02 21:21:47 +00:00
|
|
|
|
2011-05-07 18:23:34 +00:00
|
|
|
#ifdef YAX_ENABLE
|
2011-04-11 22:28:58 +00:00
|
|
|
// more user tag hijacking: lotag/extra :/
|
2011-05-07 18:23:34 +00:00
|
|
|
# define YAX_NEXTWALL(Wall, Cf) (*(&wall[Wall].lotag + 2*Cf))
|
2011-04-11 22:28:58 +00:00
|
|
|
|
2011-05-07 18:23:34 +00:00
|
|
|
# define YAX_ITER_WALLS(Wal, Itervar, Cfvar) Cfvar=0, Itervar=(Wal); Itervar!=-1; \
|
2011-04-14 20:48:08 +00:00
|
|
|
Itervar=yax_getnextwall(Itervar, Cfvar), (void)(Itervar==-1 && Cfvar==0 && (Cfvar=1) && (Itervar=yax_getnextwall((Wal), Cfvar)))
|
|
|
|
|
2011-05-15 22:37:24 +00:00
|
|
|
# define SECTORS_OF_BUNCH(Bunchnum, Cf, Itervar) Itervar = headsectbunch[Cf][Bunchnum]; \
|
|
|
|
Itervar != -1; Itervar = nextsectbunch[Cf][Itervar]
|
|
|
|
|
2011-05-12 23:31:13 +00:00
|
|
|
extern int16_t yax_bunchnum[MAXSECTORS][2];
|
|
|
|
extern int16_t yax_nextwall[MAXWALLS][2];
|
|
|
|
|
2011-03-02 21:21:47 +00:00
|
|
|
int16_t yax_getbunch(int16_t i, int16_t cf);
|
2011-03-13 11:59:32 +00:00
|
|
|
void yax_getbunches(int16_t i, int16_t *cb, int16_t *fb);
|
2011-03-02 21:21:47 +00:00
|
|
|
void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum);
|
2011-03-13 11:59:32 +00:00
|
|
|
void yax_setbunches(int16_t i, int16_t cb, int16_t fb);
|
2011-04-11 22:28:58 +00:00
|
|
|
int16_t yax_getnextwall(int16_t wal, int16_t cf);
|
|
|
|
void yax_setnextwall(int16_t wal, int16_t cf, int16_t thenextwall);
|
2011-05-12 23:31:13 +00:00
|
|
|
void yax_update(int32_t resetstat);
|
2011-04-22 22:48:06 +00:00
|
|
|
int32_t yax_getneighborsect(int32_t x, int32_t y, int32_t sectnum, int32_t cf, int16_t *ret_bunchnum);
|
2011-03-02 21:21:47 +00:00
|
|
|
|
2011-05-07 18:23:34 +00:00
|
|
|
static inline int32_t yax_waltosecmask(int32_t walclipmask)
|
|
|
|
{
|
|
|
|
// blocking: walstat&1 --> secstat&512
|
|
|
|
// hitscan: walstat&64 --> secstat&2048
|
|
|
|
return ((walclipmask&1)<<9) | ((walclipmask&64)<<5);
|
|
|
|
}
|
|
|
|
void yax_preparedrawrooms(void);
|
|
|
|
void yax_drawrooms(void (*ExtAnalyzeSprites)(void), int32_t horiz, int16_t sectnum);
|
2011-04-22 22:48:06 +00:00
|
|
|
# define YAX_SKIPSECTOR(i) if (graysectbitmap[(i)>>3]&(1<<((i)&7))) continue
|
|
|
|
# define YAX_SKIPWALL(i) if (graywallbitmap[(i)>>3]&(1<<((i)&7))) continue
|
|
|
|
#else
|
2011-05-07 18:23:34 +00:00
|
|
|
# define yax_preparedrawrooms()
|
|
|
|
# define yax_drawrooms(ExtAnalyzeSprites, horiz, sectnum)
|
2011-04-22 22:48:06 +00:00
|
|
|
# define YAX_SKIPSECTOR(i) (i)=(i)
|
|
|
|
# define YAX_SKIPWALL(i) (i)=(i)
|
|
|
|
#endif
|
2011-03-02 21:21:47 +00:00
|
|
|
|
2007-09-05 21:56:58 +00:00
|
|
|
#define CLIPMASK0 (((1L)<<16)+1L)
|
|
|
|
#define CLIPMASK1 (((256L)<<16)+64L)
|
|
|
|
|
2011-02-15 21:02:43 +00:00
|
|
|
// max x/y val (= max editorgridextent in Mapster32)
|
|
|
|
#define BXY_MAX 524288
|
|
|
|
|
2007-09-05 21:56:58 +00:00
|
|
|
//Make all variables in BUILD.H defined in the ENGINE,
|
|
|
|
//and externed in GAME
|
|
|
|
#ifdef ENGINE
|
|
|
|
# define EXTERN
|
|
|
|
#else
|
|
|
|
# define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2009-07-09 02:29:48 +00:00
|
|
|
#pragma pack(push,1)
|
2007-09-05 21:56:58 +00:00
|
|
|
|
|
|
|
//ceilingstat/floorstat:
|
|
|
|
// bit 0: 1 = parallaxing, 0 = not "P"
|
|
|
|
// bit 1: 1 = groudraw, 0 = not
|
|
|
|
// bit 2: 1 = swap x&y, 0 = not "F"
|
|
|
|
// bit 3: 1 = double smooshiness "E"
|
|
|
|
// bit 4: 1 = x-flip "F"
|
|
|
|
// bit 5: 1 = y-flip "F"
|
|
|
|
// bit 6: 1 = Align texture to first wall of sector "R"
|
2011-04-28 21:28:33 +00:00
|
|
|
// bits 8-7: "T"
|
2007-09-05 21:56:58 +00:00
|
|
|
// 00 = normal floors
|
|
|
|
// 01 = masked floors
|
|
|
|
// 10 = transluscent masked floors
|
|
|
|
// 11 = reverse transluscent masked floors
|
2011-04-28 21:28:33 +00:00
|
|
|
// bit 9: 1 = blocking ceiling/floor
|
|
|
|
// bit 10: 1 = YAX'ed ceiling/floor
|
2011-05-07 18:23:34 +00:00
|
|
|
// bit 11: 1 = hitscan-sensitive ceiling/floor
|
|
|
|
// bits 12-15: reserved
|
2007-09-05 21:56:58 +00:00
|
|
|
|
|
|
|
//40 bytes
|
2009-07-09 02:29:48 +00:00
|
|
|
typedef struct
|
2007-09-05 21:56:58 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t wallptr, wallnum;
|
|
|
|
int32_t ceilingz, floorz;
|
|
|
|
int16_t ceilingstat, floorstat;
|
|
|
|
int16_t ceilingpicnum, ceilingheinum;
|
|
|
|
int8_t ceilingshade;
|
2009-01-10 07:38:50 +00:00
|
|
|
uint8_t ceilingpal, ceilingxpanning, ceilingypanning;
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t floorpicnum, floorheinum;
|
|
|
|
int8_t floorshade;
|
2009-01-10 07:38:50 +00:00
|
|
|
uint8_t floorpal, floorxpanning, floorypanning;
|
|
|
|
uint8_t visibility, filler;
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t lotag, hitag, extra;
|
2007-09-05 21:56:58 +00:00
|
|
|
} sectortype;
|
|
|
|
|
|
|
|
//cstat:
|
|
|
|
// bit 0: 1 = Blocking wall (use with clipmove, getzrange) "B"
|
|
|
|
// bit 1: 1 = bottoms of invisible walls swapped, 0 = not "2"
|
|
|
|
// bit 2: 1 = align picture on bottom (for doors), 0 = top "O"
|
|
|
|
// bit 3: 1 = x-flipped, 0 = normal "F"
|
|
|
|
// bit 4: 1 = masking wall, 0 = not "M"
|
|
|
|
// bit 5: 1 = 1-way wall, 0 = not "1"
|
|
|
|
// bit 6: 1 = Blocking wall (use with hitscan / cliptype 1) "H"
|
|
|
|
// bit 7: 1 = Transluscence, 0 = not "T"
|
|
|
|
// bit 8: 1 = y-flipped, 0 = normal "F"
|
|
|
|
// bit 9: 1 = Transluscence reversing, 0 = normal "T"
|
2011-04-11 22:28:58 +00:00
|
|
|
// bits 10 and 11: reserved (in use by YAX)
|
|
|
|
// bits 12-15: reserved
|
2007-09-05 21:56:58 +00:00
|
|
|
|
|
|
|
//32 bytes
|
2009-07-09 02:29:48 +00:00
|
|
|
typedef struct
|
2007-09-05 21:56:58 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t x, y;
|
|
|
|
int16_t point2, nextwall, nextsector, cstat;
|
|
|
|
int16_t picnum, overpicnum;
|
|
|
|
int8_t shade;
|
2009-01-10 07:38:50 +00:00
|
|
|
uint8_t pal, xrepeat, yrepeat, xpanning, ypanning;
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t lotag, hitag, extra;
|
2007-09-05 21:56:58 +00:00
|
|
|
} walltype;
|
|
|
|
|
|
|
|
//cstat:
|
|
|
|
// bit 0: 1 = Blocking sprite (use with clipmove, getzrange) "B"
|
|
|
|
// bit 1: 1 = transluscence, 0 = normal "T"
|
|
|
|
// bit 2: 1 = x-flipped, 0 = normal "F"
|
|
|
|
// bit 3: 1 = y-flipped, 0 = normal "F"
|
|
|
|
// bits 5-4: 00 = FACE sprite (default) "R"
|
|
|
|
// 01 = WALL sprite (like masked walls)
|
|
|
|
// 10 = FLOOR sprite (parallel to ceilings&floors)
|
|
|
|
// bit 6: 1 = 1-sided sprite, 0 = normal "1"
|
|
|
|
// bit 7: 1 = Real centered centering, 0 = foot center "C"
|
|
|
|
// bit 8: 1 = Blocking sprite (use with hitscan / cliptype 1) "H"
|
|
|
|
// bit 9: 1 = Transluscence reversing, 0 = normal "T"
|
2011-02-13 21:48:22 +00:00
|
|
|
// bit 10: reserved (in use by a renderer hack)
|
|
|
|
// bit 11: 1 = determine shade based only on its own shade member (see CON's spritenoshade command)
|
|
|
|
// bit 12: reserved
|
2009-06-14 13:35:19 +00:00
|
|
|
// bit 13: 1 = does not cast shadow
|
2009-06-14 13:02:10 +00:00
|
|
|
// bit 14: 1 = invisible but casts shadow
|
2007-09-05 21:56:58 +00:00
|
|
|
// bit 15: 1 = Invisible sprite, 0 = not invisible
|
|
|
|
|
|
|
|
//44 bytes
|
2009-07-09 02:29:48 +00:00
|
|
|
typedef struct
|
2007-09-05 21:56:58 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t x, y, z;
|
|
|
|
int16_t cstat, picnum;
|
|
|
|
int8_t shade;
|
2009-01-10 07:38:50 +00:00
|
|
|
uint8_t pal, clipdist, filler;
|
|
|
|
uint8_t xrepeat, yrepeat;
|
2009-01-09 09:29:17 +00:00
|
|
|
int8_t xoffset, yoffset;
|
|
|
|
int16_t sectnum, statnum;
|
|
|
|
int16_t ang, owner, xvel, yvel, zvel;
|
|
|
|
int16_t lotag, hitag, extra;
|
2007-09-05 21:56:58 +00:00
|
|
|
} spritetype;
|
|
|
|
|
2009-07-09 02:29:48 +00:00
|
|
|
typedef struct {
|
2009-01-09 09:29:17 +00:00
|
|
|
uint32_t mdanimtims;
|
|
|
|
int16_t mdanimcur;
|
2010-05-02 23:27:30 +00:00
|
|
|
int16_t angoff, pitch, roll;
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t xoff, yoff, zoff;
|
2009-01-10 07:38:50 +00:00
|
|
|
uint8_t flags;
|
|
|
|
uint8_t xpanning, ypanning;
|
2009-04-24 02:53:50 +00:00
|
|
|
uint8_t filler;
|
|
|
|
float alpha;
|
2008-07-12 10:57:52 +00:00
|
|
|
spritetype *tspr;
|
2009-01-10 07:38:50 +00:00
|
|
|
} spriteext_t;
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2009-07-09 02:29:48 +00:00
|
|
|
typedef struct {
|
2008-05-31 01:57:14 +00:00
|
|
|
float smoothduration;
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t mdcurframe, mdoldframe;
|
|
|
|
int16_t mdsmooth;
|
2009-01-10 07:38:50 +00:00
|
|
|
uint8_t filler[2];
|
|
|
|
} spritesmooth_t;
|
2007-09-05 21:56:58 +00:00
|
|
|
|
|
|
|
#define SPREXT_NOTMD 1
|
|
|
|
#define SPREXT_NOMDANIM 2
|
2007-12-20 19:14:38 +00:00
|
|
|
#define SPREXT_AWAY1 4
|
|
|
|
#define SPREXT_AWAY2 8
|
2008-08-23 23:37:01 +00:00
|
|
|
#define SPREXT_TSPRACCESS 16
|
2008-07-12 10:57:52 +00:00
|
|
|
|
2009-01-10 07:38:50 +00:00
|
|
|
EXTERN spriteext_t *spriteext;
|
|
|
|
EXTERN spritesmooth_t *spritesmooth;
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int32_t guniqhudid;
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2007-09-06 10:43:42 +00:00
|
|
|
EXTERN sectortype *sector;
|
|
|
|
EXTERN walltype *wall;
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int16_t maskwall[MAXWALLSB], maskwallcnt;
|
|
|
|
EXTERN int16_t thewall[MAXWALLSB];
|
2007-09-06 10:43:42 +00:00
|
|
|
EXTERN spritetype *sprite;
|
2010-08-21 07:39:12 +00:00
|
|
|
EXTERN spritetype *tspriteptr[MAXSPRITESONSCREEN + 1];
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int32_t spritesortcnt;
|
2007-09-06 10:43:42 +00:00
|
|
|
EXTERN spritetype *tsprite;
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int32_t xdim, ydim, numpages;
|
|
|
|
EXTERN int32_t yxaspect, viewingrange;
|
2008-02-16 22:27:08 +00:00
|
|
|
EXTERN intptr_t ylookup[MAXYDIM+1];
|
2007-09-05 21:56:58 +00:00
|
|
|
|
|
|
|
#define MAXVALIDMODES 256
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int32_t validmodecnt;
|
2007-09-05 21:56:58 +00:00
|
|
|
struct validmode_t {
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t xdim,ydim;
|
2007-09-05 21:56:58 +00:00
|
|
|
char bpp;
|
|
|
|
char fs; // bit 0 = fullscreen flag
|
|
|
|
char filler[2];
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t extra; // internal use
|
2007-09-05 21:56:58 +00:00
|
|
|
};
|
|
|
|
EXTERN struct validmode_t validmode[MAXVALIDMODES];
|
|
|
|
|
2011-03-23 17:41:01 +00:00
|
|
|
EXTERN int32_t numyaxbunches;
|
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
// Singly-linked list of sectnums grouped by bunches and ceiling (0)/floor (1)
|
|
|
|
// Usage e.g.:
|
|
|
|
// int16_t bunchnum = yax_getbunch(somesector, YAX_CEILING);
|
|
|
|
// Iteration over all sectors whose floor bunchnum equals 'bunchnum' (i.e. "all
|
|
|
|
// floors of the other side"):
|
|
|
|
// for (i=headsectbunch[1][bunchnum]; i!=-1; i=nextsectbunch[1][i])
|
|
|
|
// <do stuff with sector i...>
|
|
|
|
|
|
|
|
EXTERN int16_t headsectbunch[2][YAX_MAXBUNCHES], nextsectbunch[2][MAXSECTORS];
|
|
|
|
#endif
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int16_t numsectors, numwalls;
|
2008-04-10 08:24:06 +00:00
|
|
|
EXTERN char display_mirror;
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN /*volatile*/ int32_t totalclock;
|
|
|
|
EXTERN int32_t numframes, randomseed;
|
|
|
|
EXTERN int16_t sintable[2048];
|
2009-01-10 07:38:50 +00:00
|
|
|
EXTERN uint8_t palette[768];
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int16_t numpalookups;
|
2007-09-05 21:56:58 +00:00
|
|
|
EXTERN char *palookup[MAXPALOOKUPS];
|
|
|
|
EXTERN char parallaxtype, showinvisibility;
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int32_t parallaxyoffs, parallaxyscale;
|
|
|
|
EXTERN int32_t visibility, parallaxvisibility;
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int32_t windowx1, windowy1, windowx2, windowy2;
|
|
|
|
EXTERN int16_t startumost[MAXXDIM], startdmost[MAXXDIM];
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2011-05-12 23:31:13 +00:00
|
|
|
// original multi-psky handling (only one per map)
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int16_t pskyoff[MAXPSKYTILES], pskybits;
|
2011-05-12 23:31:13 +00:00
|
|
|
// new multi-psky -- up to MAXPSKYMULTIS
|
|
|
|
EXTERN int16_t pskynummultis;
|
2011-05-15 22:37:24 +00:00
|
|
|
EXTERN int32_t pskymultiyscale[MAXPSKYMULTIS];
|
2011-05-12 23:31:13 +00:00
|
|
|
EXTERN int16_t pskymultilist[MAXPSKYMULTIS], pskymultibits[MAXPSKYMULTIS];
|
|
|
|
EXTERN int16_t pskymultioff[MAXPSKYMULTIS][MAXPSKYTILES];
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int16_t headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1];
|
|
|
|
EXTERN int16_t prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES];
|
|
|
|
EXTERN int16_t nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int16_t tilesizx[MAXTILES], tilesizy[MAXTILES];
|
2007-09-05 21:56:58 +00:00
|
|
|
EXTERN char picsiz[MAXTILES];
|
|
|
|
EXTERN char walock[MAXTILES];
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int32_t pow2long[32];
|
|
|
|
EXTERN int32_t numtiles, picanm[MAXTILES];
|
2008-02-16 22:27:08 +00:00
|
|
|
EXTERN intptr_t waloff[MAXTILES]; // stores pointers to cache -- SA
|
2007-04-22 03:44:54 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int32_t windowpos, windowx, windowy;
|
2007-09-05 21:56:58 +00:00
|
|
|
|
|
|
|
//These variables are for auto-mapping with the draw2dscreen function.
|
|
|
|
//When you load a new board, these bits are all set to 0 - since
|
|
|
|
//you haven't mapped out anything yet. Note that these arrays are
|
|
|
|
//bit-mapped.
|
|
|
|
//If you want draw2dscreen() to show sprite #54 then you say:
|
|
|
|
// spritenum = 54;
|
|
|
|
// show2dsprite[spritenum>>3] |= (1<<(spritenum&7));
|
|
|
|
//And if you want draw2dscreen() to not show sprite #54 then you say:
|
|
|
|
// spritenum = 54;
|
|
|
|
// show2dsprite[spritenum>>3] &= ~(1<<(spritenum&7));
|
|
|
|
//Automapping defaults to 0 (do nothing). If you set automapping to 1,
|
|
|
|
// then in 3D mode, the walls and sprites that you see will show up the
|
|
|
|
// next time you flip to 2D mode.
|
|
|
|
|
|
|
|
EXTERN char show2dsector[(MAXSECTORS+7)>>3];
|
|
|
|
EXTERN char show2dwall[(MAXWALLS+7)>>3];
|
|
|
|
EXTERN char show2dsprite[(MAXSPRITES+7)>>3];
|
2011-03-23 17:41:01 +00:00
|
|
|
//EXTERN char automapping;
|
2007-09-05 21:56:58 +00:00
|
|
|
|
|
|
|
EXTERN char gotpic[(MAXTILES+7)>>3];
|
|
|
|
EXTERN char gotsector[(MAXSECTORS+7)>>3];
|
|
|
|
|
|
|
|
EXTERN char captureformat;
|
2008-12-23 23:27:53 +00:00
|
|
|
EXTERN char editorcolors[256];
|
|
|
|
|
2009-11-18 01:17:56 +00:00
|
|
|
EXTERN int32_t faketilesiz[MAXTILES];
|
|
|
|
EXTERN char *faketiledata[MAXTILES];
|
|
|
|
|
|
|
|
EXTERN char spritecol2d[MAXTILES][2];
|
|
|
|
extern char vgapal16[4*256];
|
|
|
|
|
2007-09-05 21:56:58 +00:00
|
|
|
extern char vgapalette[5*256];
|
2009-01-09 09:29:17 +00:00
|
|
|
extern uint32_t drawlinepat;
|
2007-09-05 21:56:58 +00:00
|
|
|
|
|
|
|
extern void faketimerhandler(void);
|
|
|
|
|
|
|
|
extern char apptitle[256];
|
|
|
|
typedef struct {
|
2009-01-09 09:29:17 +00:00
|
|
|
char r,g,b,f;
|
2007-09-05 21:56:58 +00:00
|
|
|
} palette_t;
|
|
|
|
extern palette_t curpalette[256], curpalettefaded[256], palfadergb;
|
|
|
|
extern char palfadedelta;
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t dommxoverlay, novoxmips;
|
2010-08-26 15:24:12 +00:00
|
|
|
|
|
|
|
extern float debug1, debug2;
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t tiletovox[MAXTILES];
|
|
|
|
extern int32_t usevoxels, voxscale[MAXVOXELS];
|
2011-03-04 08:50:58 +00:00
|
|
|
|
|
|
|
#ifdef USE_OPENGL
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t usemodels, usehightile;
|
|
|
|
extern int32_t rendmode;
|
2007-09-05 21:56:58 +00:00
|
|
|
#endif
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int32_t h_xsize[MAXTILES], h_ysize[MAXTILES];
|
|
|
|
EXTERN int8_t h_xoffs[MAXTILES], h_yoffs[MAXTILES];
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2011-02-21 23:08:21 +00:00
|
|
|
extern const char *engineerrstr;
|
2007-09-05 21:56:58 +00:00
|
|
|
extern char noclip;
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
EXTERN int32_t editorzrange[2];
|
2008-11-05 11:49:13 +00:00
|
|
|
|
2009-02-19 09:39:19 +00:00
|
|
|
static inline int32_t getrendermode(void)
|
|
|
|
{
|
2011-03-04 08:50:58 +00:00
|
|
|
#ifndef USE_OPENGL
|
2009-02-19 09:39:19 +00:00
|
|
|
return 0;
|
|
|
|
#else
|
|
|
|
return rendmode;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-09-05 21:56:58 +00:00
|
|
|
/*************************************************************************
|
|
|
|
POSITION VARIABLES:
|
|
|
|
|
|
|
|
POSX is your x - position ranging from 0 to 65535
|
|
|
|
POSY is your y - position ranging from 0 to 65535
|
|
|
|
(the length of a side of the grid in EDITBORD would be 1024)
|
|
|
|
POSZ is your z - position (height) ranging from 0 to 65535, 0 highest.
|
|
|
|
ANG is your angle ranging from 0 to 2047. Instead of 360 degrees, or
|
|
|
|
2 * PI radians, I use 2048 different angles, so 90 degrees would
|
|
|
|
be 512 in my system.
|
|
|
|
|
|
|
|
SPRITE VARIABLES:
|
|
|
|
|
|
|
|
EXTERN short headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1];
|
|
|
|
EXTERN short prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES];
|
|
|
|
EXTERN short nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
|
|
|
|
|
|
|
|
Example: if the linked lists look like the following:
|
2009-11-14 02:30:47 +00:00
|
|
|
????????????????
|
2007-09-05 21:56:58 +00:00
|
|
|
Sector lists: Status lists:
|
2009-11-14 02:30:47 +00:00
|
|
|
????????????????J
|
2007-09-05 21:56:58 +00:00
|
|
|
Sector0: 4, 5, 8 Status0: 2, 0, 8
|
|
|
|
Sector1: 16, 2, 0, 7 Status1: 4, 5, 16, 7, 3, 9
|
|
|
|
Sector2: 3, 9
|
2009-11-14 02:30:47 +00:00
|
|
|
????????????????
|
2007-09-05 21:56:58 +00:00
|
|
|
Notice that each number listed above is shown exactly once on both the
|
|
|
|
left and right side. This is because any sprite that exists must
|
|
|
|
be in some sector, and must have some kind of status that you define.
|
|
|
|
|
|
|
|
|
|
|
|
Coding example #1:
|
|
|
|
To go through all the sprites in sector 1, the code can look like this:
|
|
|
|
|
|
|
|
sectnum = 1;
|
|
|
|
i = headspritesect[sectnum];
|
|
|
|
while (i != -1)
|
|
|
|
{
|
|
|
|
nexti = nextspritesect[i];
|
|
|
|
|
|
|
|
//your code goes here
|
|
|
|
//ex: printf("Sprite %d is in sector %d\n",i,sectnum);
|
|
|
|
|
|
|
|
i = nexti;
|
|
|
|
}
|
|
|
|
|
|
|
|
Coding example #2:
|
|
|
|
To go through all sprites with status = 1, the code can look like this:
|
|
|
|
|
|
|
|
statnum = 1; //status 1
|
|
|
|
i = headspritestat[statnum];
|
|
|
|
while (i != -1)
|
|
|
|
{
|
|
|
|
nexti = nextspritestat[i];
|
|
|
|
|
|
|
|
//your code goes here
|
|
|
|
//ex: printf("Sprite %d has a status of 1 (active)\n",i,statnum);
|
|
|
|
|
|
|
|
i = nexti;
|
|
|
|
}
|
|
|
|
|
|
|
|
insertsprite(short sectnum, short statnum);
|
|
|
|
deletesprite(short spritenum);
|
|
|
|
changespritesect(short spritenum, short newsectnum);
|
|
|
|
changespritestat(short spritenum, short newstatnum);
|
|
|
|
|
|
|
|
TILE VARIABLES:
|
|
|
|
NUMTILES - the number of tiles found TILES.DAT.
|
|
|
|
TILESIZX[MAXTILES] - simply the x-dimension of the tile number.
|
|
|
|
TILESIZY[MAXTILES] - simply the y-dimension of the tile number.
|
|
|
|
WALOFF[MAXTILES] - the actual 32-bit offset pointing to the top-left
|
|
|
|
corner of the tile.
|
|
|
|
PICANM[MAXTILES] - flags for animating the tile.
|
|
|
|
|
|
|
|
TIMING VARIABLES:
|
|
|
|
TOTALCLOCK - When the engine is initialized, TOTALCLOCK is set to zero.
|
|
|
|
From then on, it is incremented 120 times a second by 1. That
|
|
|
|
means that the number of seconds elapsed is totalclock / 120.
|
|
|
|
NUMFRAMES - The number of times the draw3dscreen function was called
|
|
|
|
since the engine was initialized. This helps to determine frame
|
|
|
|
rate. (Frame rate = numframes * 120 / totalclock.)
|
|
|
|
|
|
|
|
OTHER VARIABLES:
|
|
|
|
|
|
|
|
STARTUMOST[320] is an array of the highest y-coordinates on each column
|
|
|
|
that my engine is allowed to write to. You need to set it only
|
|
|
|
once.
|
|
|
|
STARTDMOST[320] is an array of the lowest y-coordinates on each column
|
|
|
|
that my engine is allowed to write to. You need to set it only
|
|
|
|
once.
|
|
|
|
SINTABLE[2048] is a sin table with 2048 angles rather than the
|
|
|
|
normal 360 angles for higher precision. Also since SINTABLE is in
|
|
|
|
all integers, the range is multiplied by 16383, so instead of the
|
|
|
|
normal -1<sin(x)<1, the range of sintable is -16383<sintable[]<16383
|
|
|
|
If you use this sintable, you can possibly speed up your code as
|
|
|
|
well as save space in memory. If you plan to use sintable, 2
|
|
|
|
identities you may want to keep in mind are:
|
|
|
|
sintable[ang&2047] = sin(ang * (3.141592/1024)) * 16383
|
|
|
|
sintable[(ang+512)&2047] = cos(ang * (3.141592/1024)) * 16383
|
|
|
|
NUMSECTORS - the total number of existing sectors. Modified every time
|
|
|
|
you call the loadboard function.
|
|
|
|
***************************************************************************/
|
|
|
|
|
2010-05-18 05:14:17 +00:00
|
|
|
typedef struct {
|
|
|
|
int32_t x, y;
|
|
|
|
} vec2_t;
|
|
|
|
|
2009-07-09 02:29:48 +00:00
|
|
|
typedef struct {
|
2009-01-13 12:23:18 +00:00
|
|
|
int32_t x, y, z;
|
|
|
|
} vec3_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
vec3_t pos;
|
2009-01-14 10:40:30 +00:00
|
|
|
int16_t hitsprite, hitwall, hitsect;
|
2009-01-13 12:23:18 +00:00
|
|
|
} hitdata_t;
|
|
|
|
|
2009-07-24 02:31:34 +00:00
|
|
|
#pragma pack(pop)
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t preinitengine(void); // a partial setup of the engine used for launch windows
|
|
|
|
int32_t initengine(void);
|
2007-09-05 21:56:58 +00:00
|
|
|
void uninitengine(void);
|
|
|
|
void initspritelists(void);
|
2011-01-16 00:23:39 +00:00
|
|
|
int32_t loadboard(char *filename, char flags, int32_t *daposx, int32_t *daposy, int32_t *daposz, int16_t *daang, int16_t *dacursectnum);
|
|
|
|
int32_t loadmaphack(const char *filename);
|
|
|
|
void delete_maphack_lights();
|
|
|
|
int32_t clipmapinfo_load(const char *filename);
|
|
|
|
int32_t saveboard(const char *filename, int32_t *daposx, int32_t *daposy, int32_t *daposz, int16_t *daang, int16_t *dacursectnum);
|
|
|
|
int32_t loadpics(const char *filename, int32_t askedsize);
|
2009-01-09 09:29:17 +00:00
|
|
|
void loadtile(int16_t tilenume);
|
2011-01-16 00:23:39 +00:00
|
|
|
int32_t qloadkvx(int32_t voxindex, const char *filename);
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz);
|
|
|
|
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);
|
|
|
|
void makepalookup(int32_t palnum, char *remapbuf, int8_t r, int8_t g, int8_t b, char dastat);
|
2007-09-05 21:56:58 +00:00
|
|
|
void setvgapalette(void);
|
2011-01-27 06:35:52 +00:00
|
|
|
void setbasepaltable(uint8_t **basepaltable, uint8_t basepalcount);
|
|
|
|
void setbrightness(char dabrightness, uint8_t dapalid, char noapply);
|
2007-09-05 21:56:58 +00:00
|
|
|
void setpalettefade(char r, char g, char b, char offset);
|
2009-01-09 09:29:17 +00:00
|
|
|
void squarerotatetile(int16_t tilenume);
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp);
|
2007-09-05 21:56:58 +00:00
|
|
|
void nextpage(void);
|
2010-10-17 14:49:39 +00:00
|
|
|
void setaspect_new();
|
2009-01-09 09:29:17 +00:00
|
|
|
void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2);
|
|
|
|
void setaspect(int32_t daxrange, int32_t daaspect);
|
2007-09-05 21:56:58 +00:00
|
|
|
void flushperms(void);
|
|
|
|
|
2011-02-24 20:40:27 +00:00
|
|
|
void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, char col) ATTRIBUTE((nonnull(1,2)));
|
2010-08-14 21:32:28 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void plotpixel(int32_t x, int32_t y, char col);
|
|
|
|
char getpixel(int32_t x, int32_t y);
|
|
|
|
void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz);
|
2007-09-05 21:56:58 +00:00
|
|
|
void setviewback(void);
|
2009-01-09 09:29:17 +00:00
|
|
|
void preparemirror(int32_t dax, int32_t day, int32_t daz, int16_t daang, int32_t dahoriz, int16_t dawall, int16_t dasector, int32_t *tposx, int32_t *tposy, int16_t *tang);
|
2007-09-05 21:56:58 +00:00
|
|
|
void completemirror(void);
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int32_t dahoriz, int16_t dacursectnum);
|
2007-09-05 21:56:58 +00:00
|
|
|
void drawmasks(void);
|
2009-01-09 09:29:17 +00:00
|
|
|
void clearview(int32_t dacol);
|
|
|
|
void clearallviews(int32_t dacol);
|
|
|
|
void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang);
|
2010-06-22 21:50:01 +00:00
|
|
|
void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, int32_t dastat, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2);
|
2009-01-09 09:29:17 +00:00
|
|
|
void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col);
|
2010-12-19 22:47:10 +00:00
|
|
|
int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize) ATTRIBUTE((nonnull(5)));
|
|
|
|
void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize) ATTRIBUTE((nonnull(5)));
|
2009-01-09 09:29:17 +00:00
|
|
|
|
2010-10-09 22:59:17 +00:00
|
|
|
extern int32_t clipmoveboxtracenum;
|
2010-12-19 22:47:10 +00:00
|
|
|
int32_t clipmove(vec3_t *vect, int16_t *sectnum, int32_t xvect, int32_t yvect, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype) ATTRIBUTE((nonnull(1,2)));
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t clipinsidebox(int32_t x, int32_t y, int16_t wallnum, int32_t walldist);
|
|
|
|
int32_t clipinsideboxline(int32_t x, int32_t y, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t walldist);
|
2010-12-19 22:47:10 +00:00
|
|
|
int32_t pushmove(vec3_t *vect, int16_t *sectnum, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype) ATTRIBUTE((nonnull(1,2)));
|
|
|
|
void getzrange(const vec3_t *vect, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit, int32_t walldist, uint32_t cliptype) ATTRIBUTE((nonnull(1,3,4,5,6)));
|
|
|
|
int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, hitdata_t *hitinfo, uint32_t cliptype) ATTRIBUTE((nonnull(1,6)));
|
2011-03-04 08:50:58 +00:00
|
|
|
int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch) ATTRIBUTE((nonnull(6,7,8)));
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, int32_t y2, int32_t z2, int16_t sect2);
|
2010-12-19 22:47:10 +00:00
|
|
|
void updatesector(int32_t x, int32_t y, int16_t *sectnum) ATTRIBUTE((nonnull(3)));
|
|
|
|
void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum, const uint8_t *excludesectbitmap) ATTRIBUTE((nonnull(3)));
|
|
|
|
void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum) ATTRIBUTE((nonnull(4)));
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t inside(int32_t x, int32_t y, int16_t sectnum);
|
|
|
|
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day);
|
|
|
|
void setfirstwall(int16_t sectnum, int16_t newfirstwall);
|
2011-05-15 22:37:24 +00:00
|
|
|
|
|
|
|
extern const int16_t *chsecptr_onextwall;
|
2011-01-16 00:23:39 +00:00
|
|
|
int32_t checksectorpointer(int16_t i, int16_t sectnum);
|
2009-01-09 09:29:17 +00:00
|
|
|
|
2010-12-19 22:47:10 +00:00
|
|
|
void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) ATTRIBUTE((nonnull(1,2,3)));
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t krand(void);
|
|
|
|
int32_t ksqrt(int32_t num);
|
2009-02-28 07:44:54 +00:00
|
|
|
// int32_t getangle(int32_t xvect, int32_t yvect);
|
|
|
|
|
|
|
|
//
|
|
|
|
// getangle
|
|
|
|
//
|
|
|
|
|
|
|
|
EXTERN int16_t radarang[1280];
|
|
|
|
|
|
|
|
static inline int32_t getangle(int32_t xvect, int32_t yvect)
|
|
|
|
{
|
|
|
|
if ((xvect|yvect) == 0) return(0);
|
2010-05-18 05:14:17 +00:00
|
|
|
if (xvect == 0) return 512+((yvect<0)<<10);
|
|
|
|
if (yvect == 0) return ((xvect<0)<<10);
|
|
|
|
if (xvect == yvect) return 256+((xvect<0)<<10);
|
|
|
|
if (xvect == -yvect) return 768+((xvect>0)<<10);
|
2009-02-28 07:44:54 +00:00
|
|
|
if (klabs(xvect) > klabs(yvect))
|
2010-05-18 05:14:17 +00:00
|
|
|
return ((radarang[640+scale(160,yvect,xvect)]>>6)+((xvect<0)<<10))&2047;
|
|
|
|
return ((radarang[640-scale(160,xvect,yvect)]>>6)+512+((yvect<0)<<10))&2047;
|
2009-02-28 07:44:54 +00:00
|
|
|
}
|
|
|
|
|
2010-12-19 22:47:10 +00:00
|
|
|
void rotatepoint(int32_t xpivot, int32_t ypivot, int32_t x, int32_t y, int16_t daang, int32_t *x2, int32_t *y2) ATTRIBUTE((nonnull(6,7)));
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t lastwall(int16_t point);
|
|
|
|
int32_t nextsectorneighborz(int16_t sectnum, int32_t thez, int16_t topbottom, int16_t direction);
|
|
|
|
int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day);
|
|
|
|
int32_t getflorzofslope(int16_t sectnum, int32_t dax, int32_t day);
|
2010-12-19 22:47:10 +00:00
|
|
|
void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz) ATTRIBUTE((nonnull(4,5)));
|
2009-01-09 09:29:17 +00:00
|
|
|
void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z);
|
|
|
|
void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z);
|
|
|
|
int32_t sectorofwall(int16_t theline);
|
2011-02-10 23:15:02 +00:00
|
|
|
int32_t sectorofwall_noquick(int16_t theline);
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t loopnumofsector(int16_t sectnum, int16_t wallnum);
|
2011-04-14 20:48:08 +00:00
|
|
|
void setslope(int32_t sectnum, int32_t cf, int16_t slope);
|
2009-01-09 09:29:17 +00:00
|
|
|
|
2009-02-28 07:44:54 +00:00
|
|
|
// int32_t insertsprite(int16_t sectnum, int16_t statnum);
|
|
|
|
// int32_t deletesprite(int16_t spritenum);
|
|
|
|
|
|
|
|
//
|
|
|
|
// insertsprite
|
|
|
|
//
|
|
|
|
|
|
|
|
int32_t insertspritesect(int16_t sectnum);
|
|
|
|
int32_t insertspritestat(int16_t statnum);
|
|
|
|
int32_t deletespritesect(int16_t deleteme);
|
|
|
|
int32_t deletespritestat(int16_t deleteme);
|
|
|
|
|
2010-09-27 21:52:04 +00:00
|
|
|
int32_t lineintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_t y2, int32_t z2, int32_t x3,
|
|
|
|
int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz);
|
|
|
|
|
|
|
|
int32_t rayintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy, int32_t vz, int32_t x3,
|
|
|
|
int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz);
|
|
|
|
|
2009-02-28 07:44:54 +00:00
|
|
|
static inline int32_t insertsprite(int16_t sectnum, int16_t statnum)
|
|
|
|
{
|
|
|
|
insertspritestat(statnum);
|
|
|
|
return(insertspritesect(sectnum));
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// deletesprite
|
|
|
|
//
|
|
|
|
static inline int32_t deletesprite(int16_t spritenum)
|
|
|
|
{
|
|
|
|
deletespritestat(spritenum);
|
|
|
|
return(deletespritesect(spritenum));
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t changespritesect(int16_t spritenum, int16_t newsectnum);
|
|
|
|
int32_t changespritestat(int16_t spritenum, int16_t newstatnum);
|
2010-12-19 22:47:10 +00:00
|
|
|
int32_t setsprite(int16_t spritenum, const vec3_t *new) ATTRIBUTE((nonnull(2)));
|
2011-04-09 13:27:08 +00:00
|
|
|
int32_t setspritez(int16_t spritenum, const vec3_t *new) ATTRIBUTE((nonnull(2)));
|
2009-01-09 09:29:17 +00:00
|
|
|
|
2011-03-23 17:41:01 +00:00
|
|
|
void spriteheightofs(int16_t i, int32_t *height, int32_t *zofs);
|
2011-03-02 21:21:47 +00:00
|
|
|
|
2011-03-19 18:07:12 +00:00
|
|
|
int32_t screencapture(const char *filename, char inverseit, const char *versionstr) ATTRIBUTE((nonnull(1)));
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2009-01-13 04:40:56 +00:00
|
|
|
int32_t getclosestcol(int32_t r, int32_t g, int32_t b);
|
|
|
|
|
2007-09-05 21:56:58 +00:00
|
|
|
// PLAG: line utility functions
|
|
|
|
typedef struct s_equation {
|
|
|
|
float a, b, c;
|
|
|
|
} _equation;
|
|
|
|
typedef struct s_point2d {
|
|
|
|
float x, y;
|
|
|
|
} _point2d;
|
2009-05-31 18:10:09 +00:00
|
|
|
int32_t wallvisible(int32_t x, int32_t y, int16_t wallnum);
|
2007-09-05 21:56:58 +00:00
|
|
|
|
|
|
|
#define STATUS2DSIZ 144
|
2009-05-01 06:35:27 +00:00
|
|
|
#define STATUS2DSIZ2 26
|
|
|
|
|
2011-05-22 21:52:22 +00:00
|
|
|
//void qsetmode640350(void);
|
|
|
|
//void qsetmode640480(void);
|
2009-01-09 09:29:17 +00:00
|
|
|
void qsetmodeany(int32_t,int32_t);
|
2007-09-05 21:56:58 +00:00
|
|
|
void clear2dscreen(void);
|
2010-12-05 17:39:52 +00:00
|
|
|
void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride);
|
2010-12-19 22:47:10 +00:00
|
|
|
void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride) ATTRIBUTE((nonnull(1)));
|
2010-11-27 22:12:24 +00:00
|
|
|
int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col);
|
|
|
|
void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col);
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t setrendermode(int32_t renderer);
|
|
|
|
int32_t getrendermode(void);
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2011-03-04 08:50:58 +00:00
|
|
|
#ifdef USE_OPENGL
|
2009-01-09 09:29:17 +00:00
|
|
|
void setrollangle(int32_t rolla);
|
2008-07-24 11:16:20 +00:00
|
|
|
#endif
|
2007-09-05 21:56:58 +00:00
|
|
|
|
|
|
|
// pal: pass -1 to invalidate all palettes for the tile, or >=0 for a particular palette
|
|
|
|
// how: pass -1 to invalidate all instances of the tile in texture memory, or a bitfield
|
|
|
|
// bit 0: opaque or masked (non-translucent) texture, using repeating
|
|
|
|
// bit 1: ignored
|
|
|
|
// bit 2: 33% translucence, using repeating
|
|
|
|
// bit 3: 67% translucence, using repeating
|
|
|
|
// bit 4: opaque or masked (non-translucent) texture, using clamping
|
|
|
|
// bit 5: ignored
|
|
|
|
// bit 6: 33% translucence, using clamping
|
|
|
|
// bit 7: 67% translucence, using clamping
|
|
|
|
// clamping is for sprites, repeating is for walls
|
2009-01-09 09:29:17 +00:00
|
|
|
void invalidatetile(int16_t tilenume, int32_t pal, int32_t how);
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t animateoffs(int16_t tilenum, int16_t fakevar);
|
2007-09-05 21:56:58 +00:00
|
|
|
|
|
|
|
void setpolymost2dview(void); // sets up GL for 2D drawing
|
|
|
|
|
2011-03-23 17:41:01 +00:00
|
|
|
int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen, int32_t tilezoom,
|
|
|
|
int32_t usehitile, uint8_t *loadedhitile);
|
2007-09-05 21:56:58 +00:00
|
|
|
void polymost_glreset(void);
|
2009-01-09 09:29:17 +00:00
|
|
|
void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype);
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2011-03-04 08:50:58 +00:00
|
|
|
#ifdef USE_OPENGL
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t glanisotropy;
|
|
|
|
extern int32_t glusetexcompr;
|
|
|
|
extern int32_t gltexfiltermode;
|
|
|
|
extern int32_t glredbluemode;
|
2009-10-17 09:33:32 +00:00
|
|
|
extern int32_t glusetexcache;
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t glmultisample, glnvmultisamplehint;
|
|
|
|
extern int32_t glwidescreen, glprojectionhacks;
|
|
|
|
extern int32_t gltexmaxsize;
|
2007-09-05 21:56:58 +00:00
|
|
|
void gltexapplyprops (void);
|
2008-11-25 13:06:36 +00:00
|
|
|
void invalidatecache(void);
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t r_detailmapping;
|
|
|
|
extern int32_t r_glowmapping;
|
|
|
|
extern int32_t r_vertexarrays;
|
|
|
|
extern int32_t r_vbos;
|
|
|
|
extern int32_t r_vbocount;
|
|
|
|
extern int32_t r_animsmoothing;
|
|
|
|
extern int32_t r_parallaxskyclamping;
|
|
|
|
extern int32_t r_parallaxskypanning;
|
|
|
|
extern int32_t r_modelocclusionchecking;
|
|
|
|
extern int32_t r_fullbrights;
|
|
|
|
extern int32_t r_downsize;
|
2009-04-30 01:07:08 +00:00
|
|
|
extern int32_t r_downsizevar;
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t mdtims, omdtims;
|
2009-03-27 21:54:55 +00:00
|
|
|
extern int32_t glrendmode;
|
2007-09-05 21:56:58 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void hicinit(void);
|
|
|
|
// effect bitset: 1 = greyscale, 2 = invert
|
2009-01-09 09:29:17 +00:00
|
|
|
void hicsetpalettetint(int32_t palnum, char r, char g, char b, char effect);
|
2007-09-05 21:56:58 +00:00
|
|
|
// flags bitset: 1 = don't compress
|
2011-01-16 00:23:39 +00:00
|
|
|
int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, const char *filen, float alphacut, float xscale, float yscale, float specpower, float specfactor, char flags);
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t hicsetskybox(int32_t picnum, int32_t palnum, char *faces[6]);
|
|
|
|
int32_t hicclearsubst(int32_t picnum, int32_t palnum);
|
|
|
|
|
|
|
|
int32_t Ptile2tile(int32_t tile, int32_t pallet);
|
|
|
|
int32_t md_loadmodel(const char *fn);
|
|
|
|
int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, int32_t flags);
|
2009-02-28 07:44:54 +00:00
|
|
|
// int32_t md_tilehasmodel(int32_t tilenume, int32_t pal);
|
|
|
|
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
extern char defsfilename[BMAX_PATH];
|
|
|
|
extern char *g_defNamePtr;
|
|
|
|
|
2011-07-21 22:39:29 +00:00
|
|
|
extern char **g_defModules;
|
|
|
|
extern int g_defModulesNum;
|
|
|
|
|
2011-03-04 08:50:58 +00:00
|
|
|
#ifdef USE_OPENGL
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
|
2009-02-28 07:44:54 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
// maps build tiles to particular animation frames of a model
|
|
|
|
int32_t modelid;
|
|
|
|
int32_t skinnum;
|
|
|
|
int32_t framenum; // calculate the number from the name when declaring
|
|
|
|
float smoothduration;
|
|
|
|
int32_t next;
|
|
|
|
char pal;
|
|
|
|
} tile2model_t;
|
|
|
|
|
|
|
|
#define EXTRATILES MAXTILES
|
|
|
|
|
|
|
|
EXTERN int32_t mdinited;
|
|
|
|
EXTERN tile2model_t tile2model[MAXTILES+EXTRATILES];
|
|
|
|
|
|
|
|
static inline int32_t md_tilehasmodel(int32_t tilenume,int32_t pal)
|
|
|
|
{
|
|
|
|
if (!mdinited) return -1;
|
|
|
|
return tile2model[Ptile2tile(tilenume,pal)].modelid;
|
|
|
|
}
|
2010-11-23 22:30:27 +00:00
|
|
|
#endif
|
2009-02-28 07:44:54 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, int32_t skinnum, float smoothduration, int32_t pal);
|
|
|
|
int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *frameend, int32_t fps, int32_t flags);
|
2009-03-28 15:19:44 +00:00
|
|
|
int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32_t skinnum, int32_t surfnum, float param, float specpower, float specfactor);
|
2011-03-01 05:52:33 +00:00
|
|
|
int32_t md_definehud (int32_t modelid, int32_t tilex, double xadd, double yadd, double zadd, double angadd, int32_t flags, int32_t fov);
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t md_undefinetile(int32_t tile);
|
|
|
|
int32_t md_undefinemodel(int32_t modelid);
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2011-01-16 00:23:39 +00:00
|
|
|
int32_t loaddefinitionsfile(const char *fn);
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t mapversion; // if loadboard() fails with -2 return, try loadoldboard(). if it fails with -2, board is dodgy
|
|
|
|
int32_t loadoldboard(char *filename, char fromwhere, int32_t *daposx, int32_t *daposy, int32_t *daposz, int16_t *daang, int16_t *dacursectnum);
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2008-08-25 02:12:02 +00:00
|
|
|
// Hash functions
|
2009-01-05 14:43:12 +00:00
|
|
|
|
|
|
|
typedef struct _hashitem // size is 12/24 bits.
|
2008-08-25 02:12:02 +00:00
|
|
|
{
|
2008-12-10 11:36:53 +00:00
|
|
|
char *string;
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t key;
|
2009-01-05 14:43:12 +00:00
|
|
|
struct _hashitem *next;
|
2009-01-10 07:38:50 +00:00
|
|
|
} hashitem_t;
|
2008-08-25 02:12:02 +00:00
|
|
|
|
2009-01-05 14:43:12 +00:00
|
|
|
typedef struct
|
2008-08-25 02:12:02 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t size;
|
2009-01-10 07:38:50 +00:00
|
|
|
hashitem_t **items;
|
|
|
|
} hashtable_t;
|
|
|
|
|
|
|
|
void hash_init(hashtable_t *t);
|
|
|
|
void hash_free(hashtable_t *t);
|
2011-04-17 17:01:20 +00:00
|
|
|
int32_t hash_findcase(const hashtable_t *t, const char *s);
|
|
|
|
int32_t hash_find(const hashtable_t *t, const char *s);
|
2010-08-02 08:13:51 +00:00
|
|
|
void hash_add(hashtable_t *t, const char *s, int32_t key, int32_t replace);
|
2011-04-17 17:01:20 +00:00
|
|
|
void hash_delete(hashtable_t *t, const char *s);
|
2008-08-25 02:12:02 +00:00
|
|
|
|
2009-02-14 14:31:58 +00:00
|
|
|
#ifdef POLYMER
|
|
|
|
# include "polymer.h"
|
2010-06-23 04:20:46 +00:00
|
|
|
#else
|
2011-03-04 08:50:58 +00:00
|
|
|
#ifdef USE_OPENGL
|
2010-06-23 04:20:46 +00:00
|
|
|
# include "polymost.h"
|
|
|
|
#endif
|
2009-02-14 14:31:58 +00:00
|
|
|
#endif
|
|
|
|
|
2007-09-05 21:56:58 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // __build_h__
|