X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=vrtris;a=blobdiff_plain;f=src%2Fgamescr.c;h=a55f432657cf7fb2f68236d8ef069d13252c0575;hp=4fd0b2ba8738025cf8cf081cb86ac7ae2efe2249;hb=7e20f7693be642b006fa6c4d65f6da1b00b0621f;hpb=49c9842d3766ebb1b3a67f41774c188e7bc1ae95 diff --git a/src/gamescr.c b/src/gamescr.c index 4fd0b2b..a55f432 100644 --- a/src/gamescr.c +++ b/src/gamescr.c @@ -9,6 +9,9 @@ #include "blocks.h" #include "logger.h" +int init_starfield(void); +void draw_starfield(void); + static int init(void); static void cleanup(void); static void start(void); @@ -82,9 +85,26 @@ static const long level_speed[NUM_LEVELS] = { 167, 151, 134, 117, 107, 98, 88, 79, 69, 60, 50 }; +static const float blkcolor[][4] = { + {1.0, 0.65, 0.0, 1}, + {0.16, 1.0, 0.4, 1}, + {0.65, 0.65, 1.0, 1}, + {1.0, 0.9, 0.1, 1}, + {0.0, 1.0, 1.0, 1}, + {1.0, 0.5, 1.0, 1}, + {1.0, 0.35, 0.2, 1}, + {0.5, 0.5, 0.5, 1} +}; + +#define GAMEOVER_FILL_RATE 50 + static int init(void) { + if(init_starfield() == -1) { + return -1; + } + if(!(blkmesh = cmesh_alloc()) || cmesh_load(blkmesh, "data/noisecube.obj") == -1) { error_log("failed to load block mesh\n"); return -1; @@ -106,6 +126,8 @@ static int init(void) static void cleanup(void) { cmesh_free(blkmesh); + cmesh_free(wellmesh); + glDeleteTextures(1, &tex_well); } static void start(void) @@ -139,10 +161,9 @@ static void update(float dtsec) } dt = time_msec - prev_tick; - /* if(gameover) { int i, row = PF_ROWS - gameover; - int *ptr; + unsigned int *ptr; if(dt < GAMEOVER_FILL_RATE) { return; @@ -151,15 +172,14 @@ static void update(float dtsec) if(row >= 0) { ptr = pfield + row * PF_COLS; for(i=0; i