X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosrtxon;a=blobdiff_plain;f=src%2Fparts%2Frtxonoff.c;h=e5424277332213f402feef5fe892fe69aaad0b78;hp=0f44854001262a995cd65c664d285ead66974806;hb=d7444ccbe3cb732d7259f134ee5a21d24160cc56;hpb=ac1dd983cb211904ca6c74ca28ceb5e83aa09527 diff --git a/src/parts/rtxonoff.c b/src/parts/rtxonoff.c index 0f44854..e542427 100644 --- a/src/parts/rtxonoff.c +++ b/src/parts/rtxonoff.c @@ -1,15 +1,18 @@ #include #include #include +#include +#include #include "demo.h" #include "3dgfx.h" #include "screen.h" #include "cfgopt.h" #include "polyfill.h" #include "imago2.h" +#include "util.h" #include "gfxutil.h" #include "mesh.h" -#include "bsptree.h" +#include "noise.h" static int init(void); static void destroy(void); @@ -29,13 +32,24 @@ static struct screen scr = { static float cam_theta = -29, cam_phi = 35; static float cam_dist = 10; -static int use_bsp = 1; - static const char *car_fname[2] = {"data/ldiablo.obj", 0}; static const char *cartex_fname[2] = {"data/ldiablo.png", 0}; static struct g3d_mesh mesh_car[2]; static struct pimage tex_car[2]; -static struct bsptree bsp_car[2]; + +#define BGCOL_SIZE 128 +#define BGOFFS_SIZE 1024 +static uint16_t bgcol[BGCOL_SIZE]; +static uint16_t bgcol_mir[BGCOL_SIZE]; +static int bgoffs[BGOFFS_SIZE]; +static const int colzen[] = {98, 64, 192}; +static const int colhor[] = {128, 80, 64}; +static const int colmnt[] = {16, 9, 24}; +static uint16_t mountcol, mountcol_mir; + +static int shading = G3D_TEX_GOURAUD; +static int do_clip = 1; + struct screen *rtxonoff_screen(void) { @@ -45,6 +59,25 @@ struct screen *rtxonoff_screen(void) static int init(void) { int i; + int col[3]; + + mountcol = PACK_RGB16(colmnt[0], colmnt[1], colmnt[2]); + mountcol_mir = PACK_RGB16(colmnt[0] / 2, colmnt[1] / 2, colmnt[2] / 2); + + for(i=0; i> 8); + col[1] = colhor[1] + ((colzen[1] - colhor[1]) * t >> 8); + col[2] = colhor[2] + ((colzen[2] - colhor[2]) * t >> 8); + bgcol[i] = PACK_RGB16(col[0], col[1], col[2]); + bgcol_mir[i] = PACK_RGB16(col[0] / 2, col[1] / 2, col[2] / 2); + } + + for(i=0; i fb_height) hory = fb_height; + + if(hory > 0) { + fbptr = fb_pixels + (hory - 1) * fb_width; + cidx = offs; + i = 0; + while(fbptr >= fb_pixels) { + pcol = bgcol[cidx < 0 ? 0 : (cidx >= BGCOL_SIZE ? BGCOL_SIZE - 1 : cidx)]; + for(j=0; j= BGCOL_SIZE ? BGCOL_SIZE - 1 : cidx)]; + for(j=0; j