2008-12-03 11:05:16 +00:00
|
|
|
#ifndef _polymost_h_
|
|
|
|
# define _polymost_h_
|
2006-08-30 23:32:39 +00:00
|
|
|
|
2011-03-04 08:50:58 +00:00
|
|
|
#ifdef USE_OPENGL
|
2006-08-30 23:32:39 +00:00
|
|
|
|
2009-08-09 05:32:17 +00:00
|
|
|
#include "hightile.h"
|
|
|
|
|
2012-10-01 17:52:22 +00:00
|
|
|
#define MODEL_OCCLUSION_CHECKING
|
|
|
|
|
|
|
|
#ifdef MODEL_OCCLUSION_CHECKING
|
|
|
|
# define CULL_OFFSET 384
|
|
|
|
# define CULL_DELAY 2
|
|
|
|
# define MAXCULLCHECKS 1024
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t lastcullcheck;
|
2008-12-02 10:44:39 +00:00
|
|
|
extern char cullmodel[MAXSPRITES];
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t cullcheckcnt;
|
2012-10-01 17:52:22 +00:00
|
|
|
#endif
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2010-01-16 20:17:33 +00:00
|
|
|
extern char TEXCACHEFILE[BMAX_PATH];
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
typedef struct { char r, g, b, a; } coltype;
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t rendmode;
|
2008-12-02 10:44:39 +00:00
|
|
|
extern float gtang;
|
|
|
|
extern float glox1, gloy1;
|
|
|
|
extern double gxyaspect, grhalfxdown10x;
|
|
|
|
extern double gcosang, gsinang, gcosang2, gsinang2;
|
2009-04-11 18:01:39 +00:00
|
|
|
extern double gchang, gshang, gctang, gstang, gvisibility;
|
2008-12-02 10:44:39 +00:00
|
|
|
|
|
|
|
struct glfiltermodes {
|
2011-02-21 23:08:21 +00:00
|
|
|
const char *name;
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t min,mag;
|
2006-08-30 23:32:39 +00:00
|
|
|
};
|
2012-10-01 17:52:25 +00:00
|
|
|
#define NUMGLFILTERMODES 6
|
|
|
|
extern struct glfiltermodes glfiltermodes[NUMGLFILTERMODES];
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2012-01-12 20:47:41 +00:00
|
|
|
//void phex(char v, char *s);
|
2009-01-09 09:29:17 +00:00
|
|
|
void uploadtexture(int32_t doalloc, int32_t xsiz, int32_t ysiz, int32_t intexfmt, int32_t texfmt, coltype *pic, int32_t tsizx, int32_t tsizy, int32_t dameth);
|
|
|
|
void polymost_drawsprite(int32_t snum);
|
|
|
|
void polymost_drawmaskwall(int32_t damaskwallcnt);
|
|
|
|
void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
2010-06-22 21:50:01 +00:00
|
|
|
int8_t dashade, char dapalnum, int32_t dastat, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, int32_t uniqid);
|
2009-01-09 09:29:17 +00:00
|
|
|
void polymost_fillpolygon(int32_t npoints);
|
2008-12-02 10:44:39 +00:00
|
|
|
void polymost_initosdfuncs(void);
|
|
|
|
void polymost_drawrooms(void);
|
|
|
|
|
|
|
|
void polymost_glinit(void);
|
|
|
|
void polymost_glreset(void);
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void gltexinvalidate(int32_t dapicnum, int32_t dapalnum, int32_t dameth);
|
2008-12-02 10:44:39 +00:00
|
|
|
void gltexinvalidateall(void);
|
|
|
|
void gltexinvalidate8(void);
|
2010-05-18 05:14:17 +00:00
|
|
|
int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize);
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2009-02-02 01:49:14 +00:00
|
|
|
extern float curpolygonoffset;
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t cachefilehandle;
|
2008-12-02 10:44:39 +00:00
|
|
|
extern FILE *cacheindexptr;
|
2010-05-25 10:56:00 +00:00
|
|
|
extern int32_t cachepos;
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2008-12-13 07:23:13 +00:00
|
|
|
struct cacheitem_t
|
2008-12-02 10:44:39 +00:00
|
|
|
{
|
|
|
|
char name[BMAX_PATH];
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t offset;
|
|
|
|
int32_t len;
|
2008-12-13 07:23:13 +00:00
|
|
|
struct cacheitem_t *next;
|
2008-12-02 10:44:39 +00:00
|
|
|
};
|
|
|
|
|
2008-12-13 07:23:13 +00:00
|
|
|
typedef struct cacheitem_t texcacheindex;
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2009-12-15 05:53:15 +00:00
|
|
|
#define TEXCACHEMAGIC "QLZ1"
|
|
|
|
|
2012-01-12 20:47:41 +00:00
|
|
|
int32_t dxtfilter(int32_t fil, const texcachepicture *pict, const char *pic, void *midbuf, char *packbuf, uint32_t miplen);
|
|
|
|
int32_t dedxtfilter(int32_t fil, const texcachepicture *pict, char *pic, void *midbuf, char *packbuf, int32_t ispacked);
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2012-01-12 20:47:41 +00:00
|
|
|
void writexcache(const char *fn, int32_t len, int32_t dameth, char effect, texcacheheader *head);
|
|
|
|
int32_t polymost_trytexcache(const char *fn, int32_t len, int32_t dameth, char effect,
|
|
|
|
texcacheheader *head, int32_t modelp);
|
2008-12-02 10:44:39 +00:00
|
|
|
|
|
|
|
extern float shadescale;
|
2011-03-17 23:37:38 +00:00
|
|
|
extern int32_t shadescale_unbounded;
|
2008-12-02 10:44:39 +00:00
|
|
|
extern float alphahackarray[MAXTILES];
|
2006-08-30 23:32:39 +00:00
|
|
|
|
2011-07-24 15:15:57 +00:00
|
|
|
extern int32_t r_usenewshading;
|
|
|
|
|
2012-12-14 19:28:01 +00:00
|
|
|
static inline float getshadefactor(int32_t shade)
|
|
|
|
{
|
|
|
|
int32_t shadebound = (shadescale_unbounded || shade>=numshades) ? numshades : numshades-1;
|
|
|
|
float clamped_shade = min(max(shade*shadescale, 0), shadebound);
|
|
|
|
return ((float)(numshades-clamped_shade))/(float)numshades;
|
|
|
|
}
|
|
|
|
|
2006-08-30 23:32:39 +00:00
|
|
|
typedef struct pthtyp_t
|
|
|
|
{
|
|
|
|
struct pthtyp_t *next;
|
2009-01-09 09:29:17 +00:00
|
|
|
uint32_t glpic;
|
|
|
|
int16_t picnum;
|
2006-08-30 23:32:39 +00:00
|
|
|
char palnum;
|
|
|
|
char effects;
|
|
|
|
char flags; // 1 = clamped (dameth&4), 2 = hightile, 4 = skybox face, 8 = hasalpha, 16 = hasfullbright, 128 = invalidated
|
|
|
|
char skyface;
|
|
|
|
hicreplctyp *hicr;
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
uint16_t sizx, sizy;
|
2006-08-30 23:32:39 +00:00
|
|
|
float scalex, scaley;
|
|
|
|
struct pthtyp_t *ofb; // only fullbright
|
2007-01-29 01:18:16 +00:00
|
|
|
} pthtyp;
|
|
|
|
|
2012-01-12 20:47:41 +00:00
|
|
|
pthtyp *gltexcache(int32_t dapicnum, int32_t dapalnum, int32_t dameth);
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t globalnoeffect;
|
|
|
|
extern int32_t drawingskybox;
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2012-12-14 19:28:09 +00:00
|
|
|
extern double gyxscale, gxyaspect, ghalfx, grhalfxdown10;
|
2009-04-24 02:53:50 +00:00
|
|
|
|
2008-12-02 10:44:39 +00:00
|
|
|
#endif
|
2008-05-05 09:05:07 +00:00
|
|
|
|
2008-12-03 11:05:16 +00:00
|
|
|
#endif
|