X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosrtxon;a=blobdiff_plain;f=src%2Fparts%2Frtxonoff.c;h=e56baeb946172da6b7737b0fe8f57c3dc2c40773;hp=bab4d98fd43b6382048e88f51a09ea7435dd7917;hb=6952fc3d7981a73ffbabeca5dca741fd790949cc;hpb=584c6161bb6f3f548d5e27bb7d6895a81375881e diff --git a/src/parts/rtxonoff.c b/src/parts/rtxonoff.c index bab4d98..e56baeb 100644 --- a/src/parts/rtxonoff.c +++ b/src/parts/rtxonoff.c @@ -1,14 +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 "noise.h" static int init(void); static void destroy(void); @@ -33,6 +37,16 @@ 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; @@ -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