Browse Source

Small tweaks: made background black to cover up seams, defined a few flags

unrollquadloop
Nico de Poel 3 years ago
parent
commit
8b34fb1950
  1. 6
      display.c
  2. 18
      ps1bsp.h
  3. BIN
      test.ps1bsp
  4. 7
      world.h

6
display.c

@ -76,7 +76,7 @@ void display_init()
FntLoad(960, 0); FntLoad(960, 0);
// Open up a test font text stream // Open up a test font text stream
FntOpen(0, 16, SCREENWIDTH, screenHeight, 0, 512);
FntOpen(8, 16, SCREENWIDTH, screenHeight, 0, 512);
} }
void display_reset(int mode, u_char interlaced, u_char widescreen, int *outScreenHeight) void display_reset(int mode, u_char interlaced, u_char widescreen, int *outScreenHeight)
@ -140,8 +140,8 @@ void display_reset(int mode, u_char interlaced, u_char widescreen, int *outScree
disp[0].screen.h = disp[1].screen.h = screenHeight; disp[0].screen.h = disp[1].screen.h = screenHeight;
// Set and enable clear color // Set and enable clear color
setRGB0(&draw[0], 49, 77, 121);
setRGB0(&draw[1], 49, 77, 121);
setRGB0(&draw[0], 0, 0, 0);
setRGB0(&draw[1], 0, 0, 0);
draw[0].isbg = 1; draw[0].isbg = 1;
draw[0].dtd = 1; draw[0].dtd = 1;
draw[1].isbg = 1; draw[1].isbg = 1;

18
ps1bsp.h

@ -57,6 +57,7 @@ typedef struct
} ps1bsp_vertex_t; } ps1bsp_vertex_t;
// Texture UV and lighting data for a vertex on a particular polygon. // Texture UV and lighting data for a vertex on a particular polygon.
// TODO: break up into poly vertex (index + uv) and surface vertex (index + light) shared between polygons.
typedef struct typedef struct
{ {
unsigned short index; unsigned short index;
@ -83,6 +84,20 @@ typedef struct
unsigned char b : 5; unsigned char b : 5;
} ps1bsp_facevertex_t; } ps1bsp_facevertex_t;
#define SURF_PLANEBACK 0x2
#define SURF_DRAWSKY 0x4
#define SURF_DRAWSPRITE 0x8
#define SURF_DRAWTURB 0x10
#define SURF_DRAWTILED 0x20
#define SURF_DRAWBACKGROUND 0x40
#define SURF_UNDERWATER 0x80
#define SURF_NOTEXTURE 0x100
#define SURF_DRAWFENCE 0x200
#define SURF_DRAWLAVA 0x400
#define SURF_DRAWSLIME 0x800
#define SURF_DRAWTELE 0x1000
#define SURF_DRAWWATER 0x2000
// High quality: Face -> polygons -> polygon vertex indices (index + UV + light) -> vertices // High quality: Face -> polygons -> polygon vertex indices (index + UV + light) -> vertices
// Low quality: Face -> face vertex indices (index + color) -> vertices // Low quality: Face -> face vertex indices (index + color) -> vertices
typedef struct typedef struct
@ -99,14 +114,13 @@ typedef struct
unsigned char numFaceVertices; unsigned char numFaceVertices;
unsigned char textureId; unsigned char textureId;
unsigned short flags;
// Used for backface culling // Used for backface culling
SVECTOR center; SVECTOR center;
// Which frame was this face last drawn on? Used to check if this face should be drawn. // Which frame was this face last drawn on? Used to check if this face should be drawn.
u_long drawFrame; u_long drawFrame;
u_short pad; // For 32-bit alignment
} ps1bsp_face_t; } ps1bsp_face_t;
typedef struct typedef struct

BIN
test.ps1bsp

7
world.h

@ -39,6 +39,13 @@ typedef struct
u_char *visData; u_char *visData;
} world_t; } world_t;
#define CONTENTS_EMPTY -1
#define CONTENTS_SOLID -2
#define CONTENTS_WATER -3
#define CONTENTS_SLIME -4
#define CONTENTS_LAVA -5
#define CONTENTS_SKY -6
void world_load(const u_long *data, world_t *world); void world_load(const u_long *data, world_t *world);
void world_draw(const world_t *world); void world_draw(const world_t *world);

Loading…
Cancel
Save