X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=vrtris;a=blobdiff_plain;f=src%2Fgamescr.c;h=a55f432657cf7fb2f68236d8ef069d13252c0575;hp=f2a2ee4f3f8921f5e2ed54cd54a86a114160aaf1;hb=7e20f7693be642b006fa6c4d65f6da1b00b0621f;hpb=3bdc1e0adfc4261ffd74e65b094ca3f1a05dc6b6 diff --git a/src/gamescr.c b/src/gamescr.c index f2a2ee4..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); @@ -84,17 +87,24 @@ static const long level_speed[NUM_LEVELS] = { static const float blkcolor[][4] = { {1.0, 0.65, 0.0, 1}, - {0.16, 1.0, 0.0, 1}, + {0.16, 1.0, 0.4, 1}, {0.65, 0.65, 1.0, 1}, - {1.0, 1.0, 0.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.25, 0.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; @@ -116,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) @@ -149,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; @@ -161,15 +172,14 @@ static void update(float dtsec) if(row >= 0) { ptr = pfield + row * PF_COLS; for(i=0; i