X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosrtxon;a=blobdiff_plain;f=src%2Fparts%2Frtxonoff.c;h=e5424277332213f402feef5fe892fe69aaad0b78;hp=4c5f35e1ea420e6f07a40b03a094c5208fe7afcc;hb=HEAD;hpb=4621a049a4889c5a6845a08e9c0a4d6634ab8556 diff --git a/src/parts/rtxonoff.c b/src/parts/rtxonoff.c index 4c5f35e..e542427 100644 --- a/src/parts/rtxonoff.c +++ b/src/parts/rtxonoff.c @@ -1,36 +1,56 @@ #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 "noise.h" static int init(void); static void destroy(void); static void start(long trans_time); static void draw(void); +static void keypress(int key); static struct screen scr = { "rtxonoff", init, destroy, start, 0, - draw + draw, + keypress }; static float cam_theta = -29, cam_phi = 35; -static float cam_dist = 6; +static float cam_dist = 10; 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]; +#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) { return &scr; @@ -39,12 +59,32 @@ 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