2 enum // hardcoded texture numbers
11 #define MAPVERSION 24 // bump if map format changes, see worldio.cpp
13 struct header
// map file format header
15 char head
[4]; // "OCTA"
16 int version
; // any >8bit quantity is little endian
17 int headersize
; // sizeof(header)
22 int mapprec
, maple
, mapllod
;
26 uchar lerpangle
, lerpsubdiv
, lerpsubdivsize
;
34 enum // cube empty-space materials
36 MAT_AIR
= 0, // the default, fill the empty space with air
37 MAT_WATER
, // fill with water, showing waves at the surface
38 MAT_CLIP
, // collisions always treat cube as solid
39 MAT_GLASS
, // behaves like clip but is blended blueish
40 MAT_NOCLIP
, // collisions always treat cube as empty
41 MAT_LAVA
, // fill with lava
42 MAT_AICLIP
, // clip monsters only
43 MAT_EDIT
// basis for the edit volumes of the above materials
46 #define WATER_AMPLITUDE 0.8f
47 #define WATER_OFFSET 1.1f
51 MATSURF_NOT_VISIBLE
= 0,
56 #define isliquid(mat) ((mat)==MAT_WATER || (mat)==MAT_LAVA)
57 #define isclipped(mat) ((mat) >= MAT_CLIP && (mat) < MAT_NOCLIP)
59 // VVEC_FRAC must be between 0..3
61 #define VVEC_INT (15-VVEC_FRAC)
62 #define VVEC_BITS (VVEC_INT + VVEC_FRAC)
64 #define VVEC_INT_MASK ((1<<(VVEC_INT-1))-1)
65 #define VVEC_INT_COORD(n) (((n)&VVEC_INT_MASK)<<VVEC_FRAC)
70 vvec(short x
, short y
, short z
) : svec(x
, y
, z
) {}
71 vvec(int x
, int y
, int z
) : svec(VVEC_INT_COORD(x
), VVEC_INT_COORD(y
), VVEC_INT_COORD(z
)) {}
72 vvec(const int *i
) : svec(VVEC_INT_COORD(i
[0]), VVEC_INT_COORD(i
[1]), VVEC_INT_COORD(i
[2])) {}
74 void mask(int f
) { f
<<= VVEC_FRAC
; f
|= (1<<VVEC_FRAC
)-1; x
&= f
; y
&= f
; z
&= f
; }
76 ivec
toivec() const { return ivec(x
, y
, z
).div(1<<VVEC_FRAC
); }
77 ivec
toivec(int x
, int y
, int z
) const { ivec t
= toivec(); t
.x
+= x
&~VVEC_INT_MASK
; t
.y
+= y
&~VVEC_INT_MASK
; t
.z
+= z
&~VVEC_INT_MASK
; return t
; }
78 ivec
toivec(const ivec
&o
) const { return toivec(o
.x
, o
.y
, o
.z
); }
80 vec
tovec() const { return vec(x
, y
, z
).div(1<<VVEC_FRAC
); }
81 vec
tovec(int x
, int y
, int z
) const { vec t
= tovec(); t
.x
+= x
&~VVEC_INT_MASK
; t
.y
+= y
&~VVEC_INT_MASK
; t
.z
+= z
&~VVEC_INT_MASK
; return t
; }
82 vec
tovec(const ivec
&o
) const { return tovec(o
.x
, o
.y
, o
.z
); }
85 struct vertexffc
: vvec
{};
86 struct fvertexffc
: vec
{};
87 struct vertexff
: vertexffc
{ short u
, v
; };
88 struct fvertexff
: fvertexffc
{ short u
, v
; };
89 struct vertex
: vertexff
{ bvec n
; };
90 struct fvertex
: fvertexff
{ bvec n
; };
95 (renderpath==R_FIXEDFUNCTION ? \
96 (floatvtx ? (nolights ? sizeof(fvertexffc) : sizeof(fvertexff)) : (nolights ? sizeof(vertexffc) : sizeof(vertexff))) : \
97 (floatvtx ? sizeof(fvertex) : sizeof(vertex)))