/*****************************************************************************/ /* */ /* Notice: This file contains proprietary and copyrighted materials */ /* of Mobius Codeworks Lrd. Please refer to your */ /* non-disclosure agreement and/or license agreements(s) with */ /* Mobius Codeworks Ltd for use of these materials. */ /* */ /* Copyright (c) 1998 Mobius Codeworks Ltd */ /* */ /****************************************************************************/ /* mapedit.h basic typedefs and protos for mapeditor */ /* James Pitts, Gregory Read. */ /****************************************************************************/ #ifndef MAPEDIT_H #define MAPEDIT_H #include #include #define CHECKFORERRORS(x) { \ long err;\ x;\ if (err = glGetError()){\ char str[80];\ sprintf(str,"Error in WM_CREATE\nglGetError (%d, 0x%x)\n %s %d\n%s\n%s",\ err,err, __FILE__,__LINE__,#x,gluErrorString(err));\ MessageBox (NULL, str, NULL, MB_OK);\ }\ } #define GRIDSIZE 256 #define FALSE 0 extern LRESULT WINAPI MainWndProc( HWND, UINT, WPARAM, LPARAM ); extern LRESULT WINAPI PreviewWndProc( HWND, UINT, WPARAM, LPARAM ); extern LRESULT WINAPI TopWndProc( HWND, UINT, WPARAM, LPARAM ); extern LRESULT WINAPI SideWndProc( HWND, UINT, WPARAM, LPARAM ); extern LRESULT WINAPI FrontWndProc( HWND, UINT, WPARAM, LPARAM ); extern LRESULT WINAPI TextureWndProc( HWND, UINT, WPARAM, LPARAM ); extern void MapTextures(void); extern void bSetupPixelFormat(HDC); extern long LoadTexture (HWND); extern double Face; extern void UpdatemenuItems(); extern void LoadAllTims(char *); extern HANDLE ghInstance; extern HWND hwndStatusBar; extern HWND hwndPreview; extern HWND hwndTop; extern HWND hwndSide; extern HWND hwndToolbox; typedef struct { short vx,vy,vz, pad; } vertex_t; typedef struct { float r; float g; float b; } vertcolor_t; #define TEX 1 #define WIRE 2 #define FLAT 4 typedef struct { double u,v; }uv_t; typedef struct { short u,v; } psxuv_t; typedef struct { long Points; unsigned short p[4]; unsigned char edge[4]; unsigned char rgb[3]; long flags; // 1 Tex, 2 Wire?, 4 Flat Filled long TexId; uv_t uv[4]; } poly_t; typedef struct { char r,g,b,pad; } psxrgb_t; #define MaxX 0 #define MinX 1 #define MaxZ 2 #define MinZ 3 typedef struct map_tag { short Limits[4]; // cartisian limits of this tile unsigned short pLimits[4]; // index to linked tile unsigned short Verts[4]; // index to verts //unsigned short Rgb[4]; // index to rgb colour for each vert unsigned short Flags; // flags for tile unsigned short PvsIndex; psxuv_t uv[4]; short px,py; short cx,cy; void *Prim; // index to polygon primitive psxrgb_t *rgb; } map_t; typedef struct _ENTITYDLGSTRUCT { short x; short y; int mode; int ID; } ENTITYDLGSTRUCT; typedef struct _ENTITYSTRUCT { int ID; char NameDesc[20]; float xpos; float ypos; float zpos; BOOL bIsLight; float rvalue; float gvalue; float bvalue; float intensity; } ENTITYSTRUCT; typedef struct { short x,y,z, Id; char desc[20]; } entity_t; /* map_t.Flags */ #define mTRI 1 // 3 sided poly #define mQUAD 2 // 4 sided poly #define mTRANS 4 // transparent poly #define mTEXTURE 8 // textured poly #define mFLAT 16 // flat horizontal plane. all y equal. #define m16BIT 32 #define m8BIT 64 #define m4BIT 32+64 #define MAXPOLY 2000 #define MAXVERT 8000 #define MAXPVSLIST 180000 #define TILESIZE 600 #define TILEHEIGHT 128 #define MAXTEXTURE 128 extern double tx,ty,tz; extern vertex_t Pos; extern vertex_t PosClamped; /// floor extern vertex_t Verts[MAXVERT]; extern poly_t Polys[MAXPOLY]; extern unsigned long NumVerts; extern unsigned long NumPolys; // colouring extern vertcolor_t FloorVertColors[MAXVERT]; extern vertcolor_t SideVertColors[MAXVERT]; extern void AddQuadXZ(vertex_t *); extern void DrawGrid (HWND); extern long SelectArea; extern RECT HiLight; extern void DrawDragBox (RECT *); extern vertex_t WorkPlane; extern long savex, savey; /// // Typedefs /// typedef struct { long id, flag, pixel; } timfile_t; typedef struct { short cx,cy, cw,ch; } clut_t; typedef struct { short x,y,w,h; } pixel_t; typedef struct{ unsigned char rgb[3]; } rgb_t; typedef struct { short pal[256]; pixel_t p; timfile_t t; clut_t c; unsigned char bitmap[256*256*3]; unsigned char timbmp[256*256]; rgb_t rgb[256]; long TexId; long y; // picker y pos char filename[80]; long ow; // original width of texture }tim_t; #define ME_STYLE (WS_OVERLAPPED| WS_CAPTION | WS_THICKFRAME | \ WS_MAXIMIZEBOX | WS_CLIPSIBLINGS | \ WS_CLIPCHILDREN | WS_CHILD) extern tim_t tim[MAXTEXTURE]; extern tim_t *NextTim; extern tim_t *SelectedTim; extern long NextTexId; extern long ScrollY; //HGLRC hTextureOGL; extern int PreviewPlotMode; extern long MapUpdated; extern void SaveMap (HWND , char *); extern void OpenMap (HWND , char *); extern void ExportToPsx (HWND , char *); extern int SaveInternalMapFmt(char *filename); extern int LoadInternalMapFmt(char *filename); extern int GetMapFileName(HWND hWnd, char *Title, char *thename, int Mode); extern int FindTim(char *); extern int LoadTim(char *); #endif