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"
|
|
|
|
|
2008-12-02 10:44:39 +00:00
|
|
|
#define CULL_OFFSET 384
|
|
|
|
#define CULL_DELAY 2
|
|
|
|
#define MAXCULLCHECKS 1024
|
|
|
|
|
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;
|
2008-12-02 10:44:39 +00:00
|
|
|
|
|
|
|
#define PI 3.14159265358979323
|
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
|
|
|
};
|
2008-12-02 10:44:39 +00:00
|
|
|
#define numglfiltermodes 6
|
|
|
|
extern struct glfiltermodes glfiltermodes[numglfiltermodes];
|
|
|
|
|
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);
|
2010-05-25 10:56:00 +00:00
|
|
|
void polymost_cachesync(void);
|
2008-12-02 10:44:39 +00:00
|
|
|
|
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-02 23:27:30 +00:00
|
|
|
extern hashtable_t h_texcache;
|
2010-05-25 10:56:00 +00:00
|
|
|
extern uint8_t *memcachedata;
|
|
|
|
extern int32_t memcachesize;
|
|
|
|
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-10 23:43:18 +00:00
|
|
|
//extern texcacheindex *firstcacheindex;
|
|
|
|
//extern texcacheindex *curcacheindex;
|
2009-04-23 07:09:24 +00:00
|
|
|
extern texcacheindex *cacheptrs[MAXTILES<<1];
|
2012-01-12 20:47:41 +00:00
|
|
|
//extern int32_t numcacheentries;
|
2008-12-02 10:44:39 +00:00
|
|
|
|
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;
|
|
|
|
|
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-03-04 20:13:34 +00:00
|
|
|
extern double gyxscale, gxyaspect, /*gviewxrange,*/ ghalfx, grhalfxdown10 /*, ghoriz*/;
|
2009-04-24 02:53:50 +00:00
|
|
|
|
2011-07-24 18:40:10 +00:00
|
|
|
#define FOGSCALE 0.0000768
|
2009-08-28 23:08:00 +00:00
|
|
|
|
2009-04-11 18:01:39 +00:00
|
|
|
extern float fogresult, fogcol[4], fogtable[4*MAXPALOOKUPS];
|
|
|
|
|
2009-04-16 06:41:24 +00:00
|
|
|
static inline void fogcalc(const int32_t shade, const int32_t vis, const int32_t pal)
|
|
|
|
{
|
2011-07-24 15:15:57 +00:00
|
|
|
float f;
|
|
|
|
|
|
|
|
if (r_usenewshading)
|
|
|
|
{
|
|
|
|
f = 0.9f * shade;
|
|
|
|
f = (vis > 239) ? (float)(gvisibility*((vis-240+f))) :
|
|
|
|
(float)(gvisibility*(vis+16+f));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
f = (shade < 0) ? shade * 3.5f : shade * .66f;
|
|
|
|
f = (vis > 239) ? (float)(gvisibility*((vis-240+f)/(klabs(vis-256)))) :
|
|
|
|
(float)(gvisibility*(vis+16+f));
|
|
|
|
}
|
2009-04-16 06:41:24 +00:00
|
|
|
|
2011-05-12 23:31:13 +00:00
|
|
|
if (f < 0.001f)
|
|
|
|
f = 0.001f;
|
|
|
|
else if (f > 100.0f)
|
|
|
|
f = 100.0f;
|
2011-07-24 15:15:57 +00:00
|
|
|
|
2011-05-12 23:31:13 +00:00
|
|
|
fogresult = f;
|
2009-04-16 06:41:24 +00:00
|
|
|
|
2009-08-28 23:08:00 +00:00
|
|
|
Bmemcpy(fogcol, &fogtable[pal<<2], sizeof(fogcol));
|
2009-04-16 06:41:24 +00:00
|
|
|
}
|
|
|
|
|
2009-04-11 18:01:39 +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
|