2018-11-05 07:28:01 +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 (jf@jonof.id.au)
|
|
|
|
// by the EDuke32 team (development@voidpoint.com)
|
|
|
|
|
2016-06-21 00:33:30 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifndef clip_h_
|
|
|
|
#define clip_h_
|
|
|
|
|
2017-06-07 05:13:54 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-03-19 17:07:41 +00:00
|
|
|
#define MAXCLIPNUM 2048
|
2016-06-21 00:33:35 +00:00
|
|
|
|
2016-06-21 00:33:30 +00:00
|
|
|
#ifdef HAVE_CLIPSHAPE_FEATURE
|
|
|
|
|
|
|
|
#define CM_MAX 256 // must be a power of 2
|
|
|
|
|
|
|
|
// sectoidx bits
|
|
|
|
#undef CM_NONE
|
|
|
|
#define CM_NONE (CM_MAX<<1)
|
|
|
|
#define CM_SOME (CM_NONE-1)
|
|
|
|
#define CM_OUTER (CM_MAX) // sector surrounds clipping sector
|
|
|
|
|
|
|
|
// sprite -> sector tag mappings
|
|
|
|
#define CM_XREPEAT floorpal
|
|
|
|
#define CM_YREPEAT floorxpanning
|
|
|
|
#define CM_XOFFSET ceilingshade
|
|
|
|
#define CM_YOFFSET floorshade
|
|
|
|
#define CM_CSTAT hitag
|
|
|
|
#define CM_ANG extra
|
|
|
|
#define CM_FLOORZ(Sec) (*(int32_t *)§or[Sec].ceilingxpanning) // ceilingxpanning,ceilingypanning,floorpicnum
|
|
|
|
#define CM_CEILINGZ(Sec) (*(int32_t *)§or[Sec].visibility) // visibility,fogpal,lotag
|
|
|
|
|
|
|
|
// backup of original normalized coordinates
|
|
|
|
#define CM_WALL_X(Wal) (*(int32_t *)&wall[Wal].picnum) // picnum, overpicnum
|
|
|
|
#define CM_WALL_Y(Wal) (*(int32_t *)&wall[Wal].lotag) // lotag, hitag
|
|
|
|
|
|
|
|
// don't rotate when applying clipping, for models with rotational symmetry
|
|
|
|
#define CM_NOROT(Spri) (sprite[Spri].cstat&2)
|
|
|
|
#define CM_NOROTS(Sect) (sector[Sect].CM_CSTAT&2)
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int16_t qbeg, qend; // indices into sectq
|
|
|
|
int16_t picnum, next;
|
|
|
|
int32_t maxdist;
|
|
|
|
} clipinfo_t;
|
|
|
|
|
|
|
|
extern clipinfo_t clipinfo[CM_MAX];
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int16_t numsectors, numwalls;
|
2016-06-21 00:33:58 +00:00
|
|
|
usectortype *sector;
|
|
|
|
uwalltype *wall;
|
2016-06-21 00:33:30 +00:00
|
|
|
} mapinfo_t;
|
|
|
|
|
|
|
|
extern mapinfo_t origmapinfo, clipmapinfo;
|
|
|
|
|
2018-04-12 21:03:47 +00:00
|
|
|
extern void engineInitClipMaps();
|
2016-06-21 00:33:35 +00:00
|
|
|
extern int32_t quickloadboard;
|
|
|
|
extern int16_t *sectq;
|
|
|
|
extern int16_t pictoidx[MAXTILES]; // maps tile num to clipinfo[] index
|
|
|
|
extern int16_t clipspritelist[MAXCLIPNUM];
|
2018-04-12 21:03:47 +00:00
|
|
|
extern void engineSetClipMap(mapinfo_t *bak, mapinfo_t *newmap);
|
2018-10-16 06:09:20 +00:00
|
|
|
extern int32_t clipsprite_try(uspritetype const * spr, int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax);
|
|
|
|
extern int32_t clipsprite_initindex(int32_t curidx, uspritetype const * curspr, int32_t *clipsectcnt, const vec3_t *vect);
|
2016-06-21 00:33:35 +00:00
|
|
|
|
|
|
|
#endif // HAVE_CLIPSHAPE_FEATURE
|
2016-06-21 00:33:30 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int32_t x1, y1, x2, y2;
|
|
|
|
} linetype;
|
|
|
|
|
|
|
|
extern linetype clipit[MAXCLIPNUM];
|
|
|
|
|
|
|
|
extern int16_t clipnum;
|
|
|
|
extern int32_t clipsectnum, origclipsectnum, clipspritenum;
|
|
|
|
extern int16_t clipsectorlist[MAXCLIPNUM], origclipsectorlist[MAXCLIPNUM];
|
|
|
|
|
2016-08-27 01:41:33 +00:00
|
|
|
int clipinsidebox(vec2_t *vect, int wallnum, int walldist);
|
|
|
|
int clipinsideboxline(int x, int y, int x1, int y1, int x2, int y2, int walldist);
|
2016-06-21 00:33:30 +00:00
|
|
|
|
|
|
|
extern int32_t clipmoveboxtracenum;
|
|
|
|
|
2018-10-16 06:09:20 +00:00
|
|
|
int32_t clipmove(vec3_t *pos, int16_t *sectnum, int32_t xvect, int32_t yvect, int32_t walldist, int32_t ceildist,
|
2016-06-21 00:33:35 +00:00
|
|
|
int32_t flordist, uint32_t cliptype) ATTRIBUTE((nonnull(1, 2)));
|
|
|
|
int32_t clipmovex(vec3_t *pos, int16_t *sectnum, int32_t xvect, int32_t yvect, int32_t walldist, int32_t ceildist,
|
|
|
|
int32_t flordist, uint32_t cliptype, uint8_t noslidep) ATTRIBUTE((nonnull(1, 2)));
|
|
|
|
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)));
|
2016-06-21 00:33:30 +00:00
|
|
|
|
2017-06-07 05:13:54 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-12-26 06:02:01 +00:00
|
|
|
#endif
|