forked from archive/yeti3dpro
A bunch of tiny fixes to get it building
This commit is contained in:
parent
8a486ddfea
commit
128fed3ffd
9 changed files with 59 additions and 34 deletions
|
@ -25,6 +25,8 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -47,29 +49,29 @@ typedef unsigned __int64 u64;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
typedef signed char s8;
|
typedef int8_t s8;
|
||||||
typedef signed short s16;
|
typedef int16_t s16;
|
||||||
typedef signed long s32;
|
typedef int32_t s32;
|
||||||
typedef signed __int64 s64;
|
typedef int64_t s64;
|
||||||
|
|
||||||
typedef unsigned char u8;
|
typedef uint8_t u8;
|
||||||
typedef unsigned short u16;
|
typedef uint16_t u16;
|
||||||
typedef unsigned long u32;
|
typedef uint32_t u32;
|
||||||
typedef unsigned __int64 u64;
|
typedef uint64_t u64;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
typedef volatile s8 vs8;
|
typedef volatile s8 vs8;
|
||||||
typedef volatile s16 vs16;
|
typedef volatile s16 vs16;
|
||||||
typedef volatile s32 vs32;
|
typedef volatile s32 vs32;
|
||||||
typedef volatile s64 vs64;
|
typedef volatile s64 vs64;
|
||||||
|
|
||||||
typedef volatile u8 vu8;
|
typedef volatile u8 vu8;
|
||||||
typedef volatile u16 vu16;
|
typedef volatile u16 vu16;
|
||||||
typedef volatile u32 vu32;
|
typedef volatile u32 vu32;
|
||||||
//typedef volatile u64 vu64;
|
typedef volatile u64 vu64;
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ extern "C"{
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
typedef struct rom_cell_t
|
typedef struct rom_cell
|
||||||
{
|
{
|
||||||
u8 swi; // Cell switchs (flags).
|
u8 swi; // Cell switchs (flags).
|
||||||
u8 ent; // Entity Id. Used for setting start locations for entities.
|
u8 ent; // Entity Id. Used for setting start locations for entities.
|
||||||
|
@ -93,7 +93,7 @@ typedef struct rom_cell_t
|
||||||
s8 bos; // Bottom offset.
|
s8 bos; // Bottom offset.
|
||||||
} rom_cell_t;
|
} rom_cell_t;
|
||||||
|
|
||||||
typedef struct cell_t
|
typedef struct cell
|
||||||
{
|
{
|
||||||
u8 swi; // Cell flags.
|
u8 swi; // Cell flags.
|
||||||
u8 ent; // Entity Id. Used for setting start locations for entities.
|
u8 ent; // Entity Id. Used for setting start locations for entities.
|
||||||
|
|
|
@ -37,7 +37,7 @@ extern "C"{
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
#define XDITHER(I) ((((int)&fb[I])>>1)&1)
|
#define XDITHER(I) ((((intptr_t)&fb[I])>>1)&1)
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ void yeti_model_draw(yeti_t* yeti, entity_t* entity)
|
||||||
** merged into one. Since the variable usage of each was similar, I
|
** merged into one. Since the variable usage of each was similar, I
|
||||||
** achieved an overall speed boost.
|
** achieved an overall speed boost.
|
||||||
*/
|
*/
|
||||||
void yeti_quad_draw(yeti_t* yeti, cell_t* basecell, int tid, quad_t quad, int texgen)
|
void yeti_quad_draw(yeti_t* yeti, cell_t* basecell, int tid, quadrangle_t quad, int texgen)
|
||||||
{
|
{
|
||||||
int i, n, v[3];
|
int i, n, v[3];
|
||||||
polyclip_t p, a;
|
polyclip_t p, a;
|
||||||
|
@ -440,7 +440,7 @@ skip_transformation:
|
||||||
** to allow pre-quad effects like liquid and multi-texturing. Slower
|
** to allow pre-quad effects like liquid and multi-texturing. Slower
|
||||||
** processors can bypass the high-end features.
|
** processors can bypass the high-end features.
|
||||||
*/
|
*/
|
||||||
void yeti_quad(yeti_t* yeti, cell_t* basecell, int tid, quad_t quad, int texgen)
|
void yeti_quad(yeti_t* yeti, cell_t* basecell, int tid, quadrangle_t quad, int texgen)
|
||||||
{
|
{
|
||||||
int i, mode;
|
int i, mode;
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ void yeti_draw(yeti_t* yeti)
|
||||||
cell_vis_t vis;
|
cell_vis_t vis;
|
||||||
entity_t* e1;
|
entity_t* e1;
|
||||||
entity_t* e2;
|
entity_t* e2;
|
||||||
quad_t q;
|
quadrangle_t q;
|
||||||
cell_t* camcell;
|
cell_t* camcell;
|
||||||
cell_t* c;
|
cell_t* c;
|
||||||
cell_t* d;
|
cell_t* d;
|
||||||
|
|
|
@ -25,7 +25,7 @@ extern "C"{
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
typedef vec3_t quad_t[4];
|
typedef vec3_t quadrangle_t[4];
|
||||||
|
|
||||||
typedef struct bucket_node_t
|
typedef struct bucket_node_t
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,12 @@ extern "C"{
|
||||||
#define ENTITY_LIGHT 5
|
#define ENTITY_LIGHT 5
|
||||||
#define ENTITY_BLOCKER 255
|
#define ENTITY_BLOCKER 255
|
||||||
|
|
||||||
typedef struct entity_visual_t
|
/* HACK */
|
||||||
|
typedef struct yeti yeti_t;
|
||||||
|
typedef struct entity entity_t;
|
||||||
|
typedef struct cell cell_t;
|
||||||
|
|
||||||
|
typedef struct entity_visual
|
||||||
{
|
{
|
||||||
u8 altpitch:1; // Use alternate pitch rotation.
|
u8 altpitch:1; // Use alternate pitch rotation.
|
||||||
u8 altroll:1; // Use alternate roll rotation.
|
u8 altroll:1; // Use alternate roll rotation.
|
||||||
|
@ -46,7 +51,7 @@ typedef struct entity_visual_t
|
||||||
s16 width; // 8:8 width.
|
s16 width; // 8:8 width.
|
||||||
s16 height; // 8:8 height.
|
s16 height; // 8:8 height.
|
||||||
void* data; // Rendering data. ie: Sprite or model.
|
void* data; // Rendering data. ie: Sprite or model.
|
||||||
void (*ondraw)(struct yeti_t* yeti, struct entity_t* e);
|
void (*ondraw)(yeti_t* yeti, struct entity* e);
|
||||||
} entity_visual_t;
|
} entity_visual_t;
|
||||||
|
|
||||||
typedef struct entity_state_t
|
typedef struct entity_state_t
|
||||||
|
@ -54,9 +59,9 @@ typedef struct entity_state_t
|
||||||
u16 pain;
|
u16 pain;
|
||||||
} entity_state_t;
|
} entity_state_t;
|
||||||
|
|
||||||
typedef struct entity_t
|
typedef struct entity
|
||||||
{
|
{
|
||||||
struct entity_t* next;
|
struct entity* next;
|
||||||
void* tag;
|
void* tag;
|
||||||
|
|
||||||
entity_visual_t visual;
|
entity_visual_t visual;
|
||||||
|
@ -81,12 +86,12 @@ typedef struct entity_t
|
||||||
s16 ry; // View space Y position
|
s16 ry; // View space Y position
|
||||||
s16 rz; // View space Z position
|
s16 rz; // View space Z position
|
||||||
|
|
||||||
void (*ontick)(struct yeti_t* yeti, struct entity_t* e);
|
void (*ontick)(yeti_t* yeti, entity_t* e);
|
||||||
void (*onhit)(struct yeti_t* yeti, struct entity_t* e1, struct entity_t* e2);
|
void (*onhit)(yeti_t* yeti, entity_t* e1, entity_t* e2);
|
||||||
void (*onwall)(struct yeti_t* yeti, struct entity_t* e, struct cell_t* c);
|
void (*onwall)(yeti_t* yeti, entity_t* e, cell_t* c);
|
||||||
} entity_t;
|
} entity_t;
|
||||||
|
|
||||||
typedef void (*entity_behaviour_t)(struct yeti_t* yeti, entity_t* e);
|
typedef void (*entity_behaviour_t)(yeti_t* yeti, entity_t* e);
|
||||||
|
|
||||||
// The maxium number of entities allocated. Instead of increasing this, try
|
// The maxium number of entities allocated. Instead of increasing this, try
|
||||||
// to reuse entities via entity pools.
|
// to reuse entities via entity pools.
|
||||||
|
|
|
@ -153,7 +153,7 @@ void pixel_buffer_draw(
|
||||||
#define AFFINE(I) fb[I] = pixel_converter->item[*tb++];
|
#define AFFINE(I) fb[I] = pixel_converter->item[*tb++];
|
||||||
AFFINE_LOOP()
|
AFFINE_LOOP()
|
||||||
#undef AFFINE
|
#undef AFFINE
|
||||||
video = (u16*)((int)video + pitch);
|
video = (u16*)((intptr_t)video + pitch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,6 +271,24 @@ extern int YetiFrameBufferHeight;
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
#ifdef __SDL__
|
||||||
|
|
||||||
|
#define YETI_RGB555
|
||||||
|
|
||||||
|
#define YETI_VIEWPORT_INTERVAL 35
|
||||||
|
|
||||||
|
#define YETI_FRAMEBUFFER_WIDTH 640
|
||||||
|
#define YETI_FRAMEBUFFER_HEIGHT 480
|
||||||
|
#define YETI_VIEWPORT_X1 0
|
||||||
|
#define YETI_VIEWPORT_Y1 0
|
||||||
|
#define YETI_VIEWPORT_X2 YETI_FRAMEBUFFER_WIDTH
|
||||||
|
#define YETI_VIEWPORT_Y2 YETI_FRAMEBUFFER_HEIGHT
|
||||||
|
#define TEXT_SCALE 2
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
#ifdef YETI_RGB555
|
#ifdef YETI_RGB555
|
||||||
#define RGB_BLEND_MASK 0x7BDE
|
#define RGB_BLEND_MASK 0x7BDE
|
||||||
#define RGB_SET(R,G,B) (((B)<<10)|((G)<<5)|(R))
|
#define RGB_SET(R,G,B) (((B)<<10)|((G)<<5)|(R))
|
||||||
|
|
|
@ -150,7 +150,7 @@ typedef struct visual_t
|
||||||
typedef STATICARRAY(point8_t, YETI_CELL_MAX) cell_vis_t;
|
typedef STATICARRAY(point8_t, YETI_CELL_MAX) cell_vis_t;
|
||||||
typedef STATICARRAY(entity_t* , YETI_BULLET_MAX) bullet_array_t;
|
typedef STATICARRAY(entity_t* , YETI_BULLET_MAX) bullet_array_t;
|
||||||
|
|
||||||
typedef struct yeti_t
|
typedef struct yeti
|
||||||
{
|
{
|
||||||
game_t game;
|
game_t game;
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ typedef struct yeti_t
|
||||||
|
|
||||||
vertex_t verts[YETI_MODEL_VERTEX_MAX];
|
vertex_t verts[YETI_MODEL_VERTEX_MAX];
|
||||||
|
|
||||||
void (*onhit)(struct yeti_t* yeti, struct entity_t* e1, struct entity_t* e2);
|
void (*onhit)(struct yeti* yeti, struct entity* e1, struct entity* e2);
|
||||||
} yeti_t;
|
} yeti_t;
|
||||||
|
|
||||||
#define YETI_BULLET(YETI) ((YETI)->bullets.item[(YETI)->bullets.length++ & YETI_BULLET_MASK])
|
#define YETI_BULLET(YETI) ((YETI)->bullets.item[(YETI)->bullets.length++ & YETI_BULLET_MASK])
|
||||||
|
|
Loading…
Reference in a new issue