//-------- Begin of function World::generate_map2 ----------// // void World::generate_map2() { gen_dirt(25,10,15); game.disp_gen_game_status(5); //---------------------------------// plant_init(60, 2); game.disp_gen_game_status(10); //---------------------------------// init_fire(); game.disp_gen_game_status(5); //----- debug code: validate terrain_id -----// #ifdef DEBUG Location* locPtr = loc_matrix; for( int i=0 ; i<MAX_WORLD_X_LOC*MAX_WORLD_Y_LOC ; i++, locPtr++ ) { err_when( locPtr->terrain_id < 1 || locPtr->terrain_id > terrain_res.terrain_count ); } #endif }
int init_subsystems(void) { init_hud(); init_flares(); init_starfield(); init_fire(); init_particles(); init_chunks(); init_video_new_game(); reset_update(); reset_plugins(); init_asteroids(); return (0); }
void DrawSmoke () { int x, y, pixel, pixel2; if (! fire_init_flag) { init_fire (); } draw_bottom_line_of_fire (); for (y = 0; y < (SCRH - 1); y ++) { for (x = 0; x < SCRW; x ++) { pixel = fire_buffer [((y + 1) * SCRW) + x]; if (pixel > 0) { pixel --; } fire_buffer [(y * SCRW) + x] = pixel; } } for (y = 0; y < SCRH; y ++) { for (x = 0; x < SCRW; x ++) { pixel = vidbuffer [(y * SCRW) + x]; pixel2 = (fire_buffer [(y * SCRW) + x] / 8); if (pixel2 > pixel) { vidbuffer [(y * SCRW) + x] = pixel2; } else { vidbuffer [(y * SCRW) + x] = (((pixel + pixel2) / 2) + 1); } } } }
void InitMesh(void) { // free texbinds if(sofatexbind) { glDeleteTextures(1,&sofatexbind); } if(chairtexbind) { glDeleteTextures(1,&chairtexbind); } if(camintexbind) { glDeleteTextures(1,&camintexbind); } //sofa fprintf(stderr,"Initialize default mesh-graphics\n"); create_png_texbind("sofa.png", &sofatexbind, 3, GL_RGB); #ifdef USE_BINDBUFFER glGenBuffers(1, &vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferData(GL_ARRAY_BUFFER, sizeof (struct vertex_struct) * VERTEX_COUNT, vertexs, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); glGenBuffers(1, &vinx); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vinx); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof (indexes[0]) * FACES_COUNT * 3, indexes, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); #endif //chair create_png_texbind("full_symbol.png", &chairtexbind, 4, GL_RGBA); #ifdef USE_BINDBUFFER glGenBuffers(1, &vbo1); glBindBuffer(GL_ARRAY_BUFFER, vbo1); glBufferData(GL_ARRAY_BUFFER, sizeof (struct vertex_struct) * VERTEX1_COUNT, vertexs1, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); glGenBuffers(1, &vinx1); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vinx1); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof (indexes1[0]) * FACES1_COUNT * 3, indexes1, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); #endif //bar table #ifdef USE_BINDBUFFER glGenBuffers(1, &vbo2); glBindBuffer(GL_ARRAY_BUFFER, vbo2); glBufferData(GL_ARRAY_BUFFER, sizeof (struct vertex_struct) * VERTEX2_COUNT, vertexs2, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); glGenBuffers(1, &vinx2); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vinx2); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof (indexes2[0]) * FACES2_COUNT * 3, indexes2, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glGenBuffers(1, &vbo2a); glBindBuffer(GL_ARRAY_BUFFER, vbo2a); glBufferData(GL_ARRAY_BUFFER, sizeof (struct vertex_struct) * VERTEX2a_COUNT, vertexs2a, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); glGenBuffers(1, &vinx2a); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vinx2a); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof (indexes2a[0]) * FACES2a_COUNT * 3, indexes2a, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); #endif //camin create_png_texbind("camin.png", &camintexbind, 4, GL_RGBA); #ifdef USE_BINDBUFFER glGenBuffers(1, &vbo3); glBindBuffer(GL_ARRAY_BUFFER, vbo3); glBufferData(GL_ARRAY_BUFFER, sizeof (struct vertex_struct) * VERTEX3_COUNT, vertexs3, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); glGenBuffers(1, &vinx3); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vinx3); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof (indexes3[0]) * FACES3_COUNT * 3, indexes3, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); #endif //ceiling lamp #ifdef USE_BINDBUFFER glGenBuffers(1, &vbo4); glBindBuffer(GL_ARRAY_BUFFER, vbo4); glBufferData(GL_ARRAY_BUFFER, sizeof (struct vertex_struct) * VERTEX4_COUNT, vertexs4, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); glGenBuffers(1, &vinx4); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vinx4); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof (indexes4[0]) * FACES4_COUNT * 3, indexes4, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); #endif fprintf(stderr,"Initialize default Sofa object\n"); MakeSofa(); fprintf(stderr,"Initialize default Chair object\n"); MakeChair(); fprintf(stderr,"Initialize default Table object\n"); MakeTable(); fprintf(stderr,"Initialize default Fireplace object\n"); MakeCamin(); fprintf(stderr,"Initialize default ceiling-lamp object\n"); MakeLamp(); fprintf(stderr,"Initialize fire object\n"); init_fire(); //initialize the fireflame for the fireplace }