raze/source/build/include/clip.h

108 lines
3.4 KiB
C
Raw Normal View History

// "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)
#pragma once
#ifndef clip_h_
#define clip_h_
#define MAXCLIPSECTORS 512
#define MAXCLIPNUM 2048
#define CLIPCURBHEIGHT (1<<8)
typedef struct
{
int32_t x1, y1, x2, y2;
} linetype;
extern int16_t clipsectorlist[MAXCLIPSECTORS];
int clipinsidebox(vec2_t *vect, int wallnum, int walldist);
2020-05-10 07:08:02 +00:00
inline int clipinsidebox(int x, int y, int wall, int dist)
{
vec2_t v = { x, y };
return clipinsidebox(&v, wall, dist);
}
int clipinsideboxline(int x, int y, int x1, int y1, int x2, int y2, int walldist);
extern int32_t clipmoveboxtracenum;
int32_t clipmove(vec3_t *const pos, int *const sectnum, int32_t xvect, int32_t yvect, int32_t const walldist, int32_t const ceildist,
int32_t const flordist, uint32_t const cliptype) ATTRIBUTE((nonnull(1, 2)));
2020-05-06 07:15:15 +00:00
[[deprecated]]
inline int32_t clipmove(vec3_t *const pos, int16_t *const sectnum, int32_t xvect, int32_t yvect, int32_t const walldist, int32_t const ceildist,
int32_t const flordist, uint32_t const cliptype)
{
int sect32 = *sectnum;
int retval = clipmove(pos, &sect32, xvect, yvect, walldist, ceildist, flordist, cliptype);
*sectnum = sect32;
return retval;
}
[[deprecated]]
2020-05-06 07:15:15 +00:00
inline int clipmove(int* x, int* y, int* z, short* sect, int xv, int yv, int wal, int ceil, int flor, int ct)
{
vec3_t xyz = { *x,*y,*z };
int sect32 = *sect;
2020-05-06 07:15:15 +00:00
int retval = clipmove(&xyz, sect, xv, yv, wal, ceil, flor, ct);
*sect = sect32;
2020-05-06 07:15:15 +00:00
*x = xyz.x;
*y = xyz.y;
*z = xyz.z;
return retval;
}
[[deprecated]]
inline int clipmove(int* x, int* y, int* z, int* sect, int xv, int yv, int wal, int ceil, int flor, int ct)
{
vec3_t xyz = { *x,*y,*z };
int retval = clipmove(&xyz, sect, xv, yv, wal, ceil, flor, ct);
*x = xyz.x;
*y = xyz.y;
*z = xyz.z;
return retval;
}
int pushmove(vec3_t *const vect, int16_t *const sectnum, int32_t const walldist, int32_t const ceildist, int32_t const flordist,
uint32_t const cliptype, bool clear = true) ATTRIBUTE((nonnull(1, 2)));
inline int pushmove(vec3_t *const vect, int *const sectnum, int32_t const walldist, int32_t const ceildist, int32_t const flordist,
uint32_t const cliptype, bool clear = true)
{
short sect16 = *sectnum;
auto r = pushmove(vect, &sect16, walldist, ceildist, flordist, cliptype, clear);
*sectnum = sect16;
return r;
}
[[deprecated]]
2020-05-10 18:59:38 +00:00
inline int pushmove(int* x, int* y, int* z, int16_t* const sectnum, int32_t const walldist, int32_t const ceildist, int32_t const flordist,
uint32_t const cliptype, bool clear = true)
{
vec3_t v = { *x,*y,*z };
auto r = pushmove(&v, sectnum, walldist, ceildist, flordist, cliptype, clear);
*x = v.x;
*y = v.y;
*z = v.z;
return r;
}
inline int pushmove(int* x, int* y, int* z, int* const sectnum, int32_t const walldist, int32_t const ceildist, int32_t const flordist,
uint32_t const cliptype, bool clear = true)
{
short sect16 = *sectnum;
vec3_t v = { *x,*y,*z };
auto r = pushmove(&v, &sect16, walldist, ceildist, flordist, cliptype, clear);
*sectnum = sect16;
*x = v.x;
*y = v.y;
*z = v.z;
return r;
}
#endif