mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- moved some original Raze code out if the Build folder.
This commit is contained in:
parent
fedfc2cfa4
commit
91957e40f1
6 changed files with 80 additions and 82 deletions
|
@ -11,7 +11,6 @@
|
|||
#include "m_alloc.h"
|
||||
#include "intvec.h"
|
||||
#include "m_swap.h"
|
||||
#include "serializer.h"
|
||||
|
||||
////////// Compiler detection //////////
|
||||
|
||||
|
@ -120,14 +119,6 @@ typedef struct {
|
|||
float x, y;
|
||||
} vec2f_t;
|
||||
|
||||
typedef struct MAY_ALIAS {
|
||||
union {
|
||||
struct { int32_t x, y, z; };
|
||||
vec2_t vec2;
|
||||
};
|
||||
} vec3_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
|
@ -161,17 +152,6 @@ static_assert(sizeof(vec3d_t) == sizeof(double) * 3);
|
|||
} while (0)
|
||||
|
||||
|
||||
////////// Data serialization //////////
|
||||
|
||||
inline int32_t B_LITTLE16(int16_t val) { return LittleShort(val); }
|
||||
inline uint32_t B_LITTLE16(uint16_t val) { return LittleShort(val); }
|
||||
|
||||
static FORCE_INLINE void B_BUF32(void * const buf, uint32_t const x) { *(uint32_t *) buf = x; }
|
||||
static FORCE_INLINE uint32_t B_UNBUF32(void const * const buf) { return *(uint32_t const *) buf; }
|
||||
static FORCE_INLINE uint16_t B_UNBUF16(void const * const buf) { return *(uint16_t const *) buf; }
|
||||
|
||||
|
||||
|
||||
////////// Abstract data operations //////////
|
||||
|
||||
using std::min;
|
||||
|
@ -223,33 +203,4 @@ void bfirst_search_try(T *const list, uint8_t *const bitmap, T *const eltnumptr,
|
|||
#define Xrealloc(ptr, size) (M_Realloc(ptr, size))
|
||||
#define Xfree(ptr) (M_Free(ptr))
|
||||
|
||||
////////// Inlined external libraries //////////
|
||||
|
||||
/* End dependence on compat.o object. */
|
||||
|
||||
inline FSerializer& Serialize(FSerializer& arc, const char* key, vec2_t& c, vec2_t* def)
|
||||
{
|
||||
if (def && !memcmp(&c, def, sizeof(c))) return arc;
|
||||
if (arc.BeginObject(key))
|
||||
{
|
||||
arc("x", c.x, def? &def->x : nullptr)
|
||||
("y", c.y, def ? &def->y : nullptr)
|
||||
.EndObject();
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
inline FSerializer& Serialize(FSerializer& arc, const char* key, vec3_t& c, vec3_t* def)
|
||||
{
|
||||
if (def && !memcmp(&c, def, sizeof(c))) return arc;
|
||||
if (arc.BeginObject(key))
|
||||
{
|
||||
arc("x", c.x, def ? &def->x : nullptr)
|
||||
("y", c.y, def ? &def->y : nullptr)
|
||||
("z", c.z, def ? &def->z : nullptr)
|
||||
.EndObject();
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
#endif // compat_h_
|
||||
|
|
|
@ -741,17 +741,17 @@ static md2model_t *md2load(FileReader & fil, const char *filnam)
|
|||
}
|
||||
for (i = head.numtris-1; i>=0; i--)
|
||||
{
|
||||
m->tris[i].v[0] = B_LITTLE16(m->tris[i].v[0]);
|
||||
m->tris[i].v[1] = B_LITTLE16(m->tris[i].v[1]);
|
||||
m->tris[i].v[2] = B_LITTLE16(m->tris[i].v[2]);
|
||||
m->tris[i].u[0] = B_LITTLE16(m->tris[i].u[0]);
|
||||
m->tris[i].u[1] = B_LITTLE16(m->tris[i].u[1]);
|
||||
m->tris[i].u[2] = B_LITTLE16(m->tris[i].u[2]);
|
||||
m->tris[i].v[0] = LittleShort(m->tris[i].v[0]);
|
||||
m->tris[i].v[1] = LittleShort(m->tris[i].v[1]);
|
||||
m->tris[i].v[2] = LittleShort(m->tris[i].v[2]);
|
||||
m->tris[i].u[0] = LittleShort(m->tris[i].u[0]);
|
||||
m->tris[i].u[1] = LittleShort(m->tris[i].u[1]);
|
||||
m->tris[i].u[2] = LittleShort(m->tris[i].u[2]);
|
||||
}
|
||||
for (i = head.numuv-1; i>=0; i--)
|
||||
{
|
||||
m->uv[i].u = B_LITTLE16(m->uv[i].u);
|
||||
m->uv[i].v = B_LITTLE16(m->uv[i].v);
|
||||
m->uv[i].u = LittleShort(m->uv[i].u);
|
||||
m->uv[i].v = LittleShort(m->uv[i].v);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1069,9 +1069,9 @@ static md3model_t *md3load(FileReader & fil)
|
|||
}
|
||||
for (i=s->numframes*s->numverts-1; i>=0; i--)
|
||||
{
|
||||
s->xyzn[i].x = (int16_t)B_LITTLE16((uint16_t)s->xyzn[i].x);
|
||||
s->xyzn[i].y = (int16_t)B_LITTLE16((uint16_t)s->xyzn[i].y);
|
||||
s->xyzn[i].z = (int16_t)B_LITTLE16((uint16_t)s->xyzn[i].z);
|
||||
s->xyzn[i].x = (int16_t)LittleShort((uint16_t)s->xyzn[i].x);
|
||||
s->xyzn[i].y = (int16_t)LittleShort((uint16_t)s->xyzn[i].y);
|
||||
s->xyzn[i].z = (int16_t)LittleShort((uint16_t)s->xyzn[i].z);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
#include "gamefuncs.h"
|
||||
#include "gamestruct.h"
|
||||
#include "intvec.h"
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -258,3 +259,34 @@ void GetFlatSpritePosition(const spritetype* spr, vec2_t pos, vec2_t* out)
|
|||
out[3] = out[0] - sub;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// vector serializers
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FSerializer& Serialize(FSerializer& arc, const char* key, vec2_t& c, vec2_t* def)
|
||||
{
|
||||
if (def && !memcmp(&c, def, sizeof(c))) return arc;
|
||||
if (arc.BeginObject(key))
|
||||
{
|
||||
arc("x", c.x, def ? &def->x : nullptr)
|
||||
("y", c.y, def ? &def->y : nullptr)
|
||||
.EndObject();
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
FSerializer& Serialize(FSerializer& arc, const char* key, vec3_t& c, vec3_t* def)
|
||||
{
|
||||
if (def && !memcmp(&c, def, sizeof(c))) return arc;
|
||||
if (arc.BeginObject(key))
|
||||
{
|
||||
arc("x", c.x, def ? &def->x : nullptr)
|
||||
("y", c.y, def ? &def->y : nullptr)
|
||||
("z", c.z, def ? &def->z : nullptr)
|
||||
.EndObject();
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
class FSerializer;
|
||||
|
||||
struct vec2_16_t
|
||||
{
|
||||
int16_t x, y;
|
||||
|
@ -18,6 +20,28 @@ struct vec2_t
|
|||
vec2_t& operator-=(const vec2_t& other) { x -= other.x; y -= other.y; return *this; };
|
||||
};
|
||||
|
||||
struct vec3_t
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
int32_t x, y, z;
|
||||
};
|
||||
vec2_t vec2;
|
||||
};
|
||||
|
||||
vec3_t() = default;
|
||||
vec3_t(const vec3_t&) = default;
|
||||
vec3_t(int x_, int y_, int z_) : x(x_), y(y_), z(z_) {}
|
||||
vec3_t operator+(const vec3_t& other) const { return { x + other.x, y + other.y, z + other.z }; }
|
||||
vec3_t operator-(const vec3_t& other) const { return { x - other.x, y - other.y, z - other.z }; }
|
||||
vec3_t& operator+=(const vec3_t & other) { x += other.x; y += other.y; z += other.z; return *this; };
|
||||
vec3_t& operator-=(const vec3_t & other) { x -= other.x; y -= other.y; z += other.z; return *this; };
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
|
@ -26,18 +50,6 @@ struct vec2f_t
|
|||
float x, y;
|
||||
};
|
||||
|
||||
struct vec3_t
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
int32_t x, y, z;
|
||||
};
|
||||
vec2_t vec2;
|
||||
};
|
||||
};
|
||||
|
||||
struct vec3_16_t
|
||||
{
|
||||
union
|
||||
|
@ -50,3 +62,6 @@ struct vec3_16_t
|
|||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
FSerializer& Serialize(FSerializer& arc, const char* key, vec2_t& c, vec2_t* def);
|
||||
FSerializer& Serialize(FSerializer& arc, const char* key, vec3_t& c, vec3_t* def);
|
||||
|
|
|
@ -574,8 +574,8 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
|
|||
|
||||
int const nVoxel = tiletovox[pTSprite->picnum];
|
||||
|
||||
if (nVoxel != -1 && ((voxrotate[nVoxel>>3]&pow2char[nVoxel&7]) != 0 || (picanm[nRootTile].extra&7) == 7))
|
||||
pTSprite->ang = (pTSprite->ang+myclock)&2047;
|
||||
if (nVoxel != -1 && ((voxrotate[nVoxel >> 3] & (1 << (nVoxel & 7))) != 0 || (picanm[nRootTile].extra & 7) == 7))
|
||||
pTSprite->ang = (pTSprite->ang + myclock) & 2047;
|
||||
}
|
||||
|
||||
if ((pTSprite->cstat&48) != 48 && hw_models && !(spriteext[nSprite].flags&SPREXT_NOTMD))
|
||||
|
|
|
@ -220,11 +220,11 @@ inline int32_t FIXED(int32_t msw, int32_t lsw)
|
|||
#define SP_TAG10(sp) (LSB_VAR((sp)->owner))
|
||||
#define SP_TAG11(sp) ((sp)->shade)
|
||||
#define SP_TAG12(sp) ((sp)->pal)
|
||||
#define SP_TAG13(sp) B_LITTLE16(*((short*)&(sp)->xoffset))
|
||||
#define SP_TAG14(sp) B_LITTLE16(*((short*)&(sp)->xrepeat))
|
||||
#define SP_TAG13(sp) LittleShort(*((short*)&(sp)->xoffset))
|
||||
#define SP_TAG14(sp) LittleShort(*((short*)&(sp)->xrepeat))
|
||||
#define SP_TAG15(sp) ((sp)->z)
|
||||
#define SET_SP_TAG13(sp,val) (*((short*)&(sp)->xoffset)) = B_LITTLE16((short)val)
|
||||
#define SET_SP_TAG14(sp,val) (*((short*)&(sp)->xrepeat)) = B_LITTLE16((short)val)
|
||||
#define SET_SP_TAG13(sp,val) (*((short*)&(sp)->xoffset)) = LittleShort((short)val)
|
||||
#define SET_SP_TAG14(sp,val) (*((short*)&(sp)->xrepeat)) = LittleShort((short)val)
|
||||
|
||||
#define SPRITE_TAG1(sp) (sprite[sp].hitag)
|
||||
#define SPRITE_TAG2(sp) (sprite[sp].lotag)
|
||||
|
@ -238,11 +238,11 @@ inline int32_t FIXED(int32_t msw, int32_t lsw)
|
|||
#define SPRITE_TAG10(sp) (LSB_VAR(sprite[sp].owner))
|
||||
#define SPRITE_TAG11(sp) (sprite[sp].shade)
|
||||
#define SPRITE_TAG12(sp) (sprite[sp].pal)
|
||||
#define SPRITE_TAG13(sp) B_LITTLE16(*((short*)&sprite[sp].xoffset))
|
||||
#define SPRITE_TAG14(sp) B_LITTLE16(*((short*)&sprite[sp].xrepeat))
|
||||
#define SPRITE_TAG13(sp) LittleShort(*((short*)&sprite[sp].xoffset))
|
||||
#define SPRITE_TAG14(sp) LittleShort(*((short*)&sprite[sp].xrepeat))
|
||||
#define SPRITE_TAG15(sp) (sprite[sp].z)
|
||||
#define SET_SPRITE_TAG13(sp,val) (*((short*)&sprite[sp].xoffset)) = B_LITTLE16((short)val)
|
||||
#define SET_SPRITE_TAG14(sp,val) (*((short*)&sprite[sp].xrepeat)) = B_LITTLE16((short)val)
|
||||
#define SET_SPRITE_TAG13(sp,val) (*((short*)&sprite[sp].xoffset)) = LittleShort((short)val)
|
||||
#define SET_SPRITE_TAG14(sp,val) (*((short*)&sprite[sp].xrepeat)) = LittleShort((short)val)
|
||||
|
||||
// OVER and UNDER water macros
|
||||
#define SpriteInDiveArea(sp) (TEST(sector[(sp)->sectnum].extra, SECTFX_DIVE_AREA) ? true : false)
|
||||
|
|
Loading…
Reference in a new issue