// Draw everything void draw_all_objects( int* room_display_lists, float lid_degrees, float* dancer_angles, float dancer_angle,float dancer_y, float door_angle ) { // int* room_display_lists = all_display_lists[0]; // Room walls and door draw_room(room_display_lists, door_angle); // Box and dancer glPushMatrix(); // glTranslatef(0,2.6001,1.7); glTranslatef(-2,2.1+.001,-1); draw_box(room_display_lists ,lid_degrees); glPopMatrix(); glPushMatrix(); glTranslatef(-2,dancer_y,-2.7); draw_dancer(room_display_lists, dancer_angles, dancer_angle); glPopMatrix(); // Furniture glPushMatrix(); glTranslatef(-2,-1,-2.7); draw_table(room_display_lists); glPopMatrix(); glPushMatrix(); glTranslatef(5,-2.05,0); draw_one_legged_table(room_display_lists); glPopMatrix(); glPushMatrix(); glTranslatef(4.5,-2,-2.5); glRotatef(-90,0,1,0); draw_chair(room_display_lists); glPopMatrix(); glPushMatrix(); glTranslatef(0,-2,0); draw_stool(room_display_lists); glPopMatrix(); // Lights // lamp glPushMatrix(); glTranslatef(-3,-1.5,0); draw_lamp(room_display_lists); glPopMatrix(); // wall light glPushMatrix(); glTranslatef(4,2,-5); glRotatef(-90,0,1,0); draw_wall_light(room_display_lists); glPopMatrix(); }
void draw_hokum_virtual_cockpit_lamps (void) { ASSERT (virtual_cockpit_inst3d); draw_lamp (hokum_lamps.master_caution, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__022); draw_lamp (hokum_lamps.left_engine_fire, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__019); draw_lamp (hokum_lamps.apu_fire, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__020); draw_lamp (hokum_lamps.right_engine_fire, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__021); draw_lamp (hokum_lamps.fire_extinguiser, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__018); draw_lamp (hokum_lamps.hydraulic_pressure, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__003); draw_lamp (hokum_lamps.oil_pressure, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__004); draw_lamp (hokum_lamps.oil_temperature, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__005); draw_lamp (hokum_lamps.overtorque, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__000); draw_lamp (hokum_lamps.rotor_rpm, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__001); draw_lamp (hokum_lamps.fuel_low, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__002); draw_lamp (hokum_lamps.rotor_brake, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__006); draw_lamp (hokum_lamps.wheel_brake, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__007); draw_lamp (hokum_lamps.navigation_lights, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__008); draw_lamp (hokum_lamps.hover_hold, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__009); draw_lamp (hokum_lamps.altitude_hold, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__010); draw_lamp (hokum_lamps.auto_pilot, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__011); draw_lamp (hokum_lamps.radar, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__012); draw_lamp (hokum_lamps.laser, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__013); draw_lamp (hokum_lamps.radar_jammer, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__014); draw_lamp (hokum_lamps.ir_jammer, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__015); draw_lamp (hokum_lamps.auto_counter_measures, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__016); draw_lamp (hokum_lamps.ase_auto_page, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__017); draw_lamp (hokum_lamps.gear_damaged, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__024); draw_lamp (hokum_lamps.gear_status, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__023); draw_lamp (hokum_lamps.gear_red, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_GEAR__029); draw_lamp (hokum_lamps.pilot_lh_mfd_focus, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__025); draw_lamp (hokum_lamps.pilot_rh_mfd_focus, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__026); draw_lamp (hokum_lamps.co_pilot_lh_mfd_focus, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__027); draw_lamp (hokum_lamps.co_pilot_rh_mfd_focus, TEXTURE_ANIMATION_INDEX_HOKUM_COCKPIT_LAMP__028); }
void draw_comanche_virtual_cockpit_lamps (void) { ASSERT (virtual_cockpit_inst3d); draw_lamp (comanche_lamps.master_caution, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__000); draw_lamp (comanche_lamps.left_engine_ignition, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__024); draw_lamp (comanche_lamps.apu_ignition, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__025); draw_lamp (comanche_lamps.right_engine_ignition, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__026); draw_lamp (comanche_lamps.left_engine_fire, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__001); draw_lamp (comanche_lamps.apu_fire, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__002); draw_lamp (comanche_lamps.right_engine_fire, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__003); draw_lamp (comanche_lamps.left_engine_fire_extinguiser, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__019); draw_lamp (comanche_lamps.right_engine_fire_extinguiser, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__020); draw_lamp (comanche_lamps.hydraulic_pressure, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__021); draw_lamp (comanche_lamps.oil_pressure, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__022); draw_lamp (comanche_lamps.oil_temperature, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__023); draw_lamp (comanche_lamps.overtorque, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__010); draw_lamp (comanche_lamps.rotor_rpm, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__011); draw_lamp (comanche_lamps.fuel_low, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__012); draw_lamp (comanche_lamps.rotor_brake, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__004); draw_lamp (comanche_lamps.wheel_brake, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__005); draw_lamp (comanche_lamps.navigation_lights, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__006); draw_lamp (comanche_lamps.hover_hold, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__008); draw_lamp (comanche_lamps.altitude_hold, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__042); draw_lamp (comanche_lamps.auto_pilot, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__009); draw_lamp (comanche_lamps.radar, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__013); draw_lamp (comanche_lamps.laser, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__014); draw_lamp (comanche_lamps.radar_jammer, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__015); draw_lamp (comanche_lamps.ir_jammer, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__016); draw_lamp (comanche_lamps.auto_counter_measures, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__017); draw_lamp (comanche_lamps.ase_auto_page, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__018); draw_lamp (comanche_lamps.config_stub_wings, TEXTURE_ANIMATION_INDEX_GENERIC_LAMP__036); draw_lamp (comanche_lamps.config_bay_doors, TEXTURE_ANIMATION_INDEX_GENERIC_LAMP__037); draw_lamp (comanche_lamps.config_gear, TEXTURE_ANIMATION_INDEX_GENERIC_LAMP__038); draw_lamp (comanche_lamps.config_gun, TEXTURE_ANIMATION_INDEX_GENERIC_LAMP__039); draw_lamp (comanche_lamps.gear_damaged, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__029); draw_lamp (comanche_lamps.gear_status, TEXTURE_ANIMATION_INDEX_66_GEAR_LIGHT_034); draw_lamp (comanche_lamps.gear_status, TEXTURE_ANIMATION_INDEX_66_GEAR_LIGHT_035); draw_lamp (comanche_lamps.gear_red, TEXTURE_ANIMATION_INDEX_66_GEAR_LAMP__040); draw_lamp (comanche_lamps.gear_red, TEXTURE_ANIMATION_INDEX_66_GEAR_LAMP__041); draw_lamp (comanche_lamps.gear_transition, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__027); draw_lamp (comanche_lamps.gear_transition, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__028); draw_lamp (comanche_lamps.pilot_lh_main_mfd_focus, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__030); draw_lamp (comanche_lamps.pilot_rh_main_mfd_focus, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__031); draw_lamp (comanche_lamps.co_pilot_lh_main_mfd_focus, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__032); draw_lamp (comanche_lamps.co_pilot_rh_main_mfd_focus, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__033); }
/** Main program flow */ int main() { initialize(); /* Shaders */ shader_container = new Shader("shader.vert", "shader.frag"); shader_lamp = new Shader("shader.vert", "lamp.frag"); /* Generate Opengl objects */ GLuint VBO; glGenBuffers(1, &VBO); /* VAO for the container */ GLuint vao_container; glGenVertexArrays(1, &vao_container); glBindVertexArray(vao_container); // Bind VBO glBindBuffer(GL_ARRAY_BUFFER, VBO); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); // Partial update example: //float data = 1.0f; //glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(GLfloat), &data); // Link vertex attributes (Important!) glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), (GLvoid*)0); glEnableVertexAttribArray(0); glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), (GLvoid*)(3 * sizeof(GLfloat))); glEnableVertexAttribArray(1); //glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); /* VAO for the light */ GLuint vao_light; glGenVertexArrays(1, &vao_light); glBindVertexArray(vao_light); // No need to feed data this time glBindBuffer(GL_ARRAY_BUFFER, VBO); // Only position data glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), (GLvoid*)0); glEnableVertexAttribArray(0); glBindVertexArray(0); /* Render loop */ while (!glfwWindowShouldClose(window)) { /* Check and call events */ glfwPollEvents(); /* Render */ // Reset screen glClearColor(0.2f, 0.3f, 0.3f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); draw_container(vao_container, shader_container); draw_lamp(vao_light, shader_lamp); /* Swap the buffers */ glfwSwapBuffers(window); } glfwTerminate(); delete shader_container; delete shader_lamp; return 0; }
void draw_default_indicator_lamps_3d (void) { unsigned char *sprite_data, *mask_data; int X_ORG; int Y_ORG; base_cockpit_graphics_file = GRAPHICS_COCKPITS_APACHE_LEVEL1_BASE; sprite_data = get_graphics_file_data (base_cockpit_graphics_file + GRAPHICS_COCKPITS_APACHE_SPRITES); mask_data = get_graphics_file_data (base_cockpit_graphics_file + GRAPHICS_COCKPITS_APACHE_SPRITES_MASK); //find out where the lamps are in 3d, tranform with pilot viewpoint, convert to pixels depending on resolution, use center of cockpit lock_screen (active_screen); X_ORG = 225; Y_ORG = 470; X_ORG = (int)((virtual_cockpit_inst3d->vp.x*0.4+0.5)*300); draw_lamp (default_lamps.indicator_lamp_1, X_ORG + 7, Y_ORG + 4, 7, 4, 19, 19, 0); X_ORG += 20; draw_lamp (default_lamps.indicator_lamp_2, X_ORG + 27, Y_ORG + 4, 27, 4, 18, 19, 13); X_ORG += 20; draw_lamp (default_lamps.indicator_lamp_3, X_ORG + 47, Y_ORG + 5, 47, 5, 18, 18, 25); X_ORG += 20; draw_lamp (default_lamps.indicator_lamp_4, X_ORG + 66, Y_ORG + 5, 66, 5, 18, 18, 38); X_ORG += 20; draw_lamp (default_lamps.indicator_lamp_5, X_ORG + 86, Y_ORG + 5, 86, 5, 18, 18, 51); X_ORG += 20; draw_lamp (default_lamps.indicator_lamp_6, X_ORG + 106, Y_ORG + 5, 106, 5, 18, 18, 64); X_ORG += 20; draw_lamp (default_lamps.indicator_lamp_7, X_ORG + 125, Y_ORG + 5, 125, 5, 18, 18, 76); X_ORG += 20; draw_lamp (default_lamps.indicator_lamp_8, X_ORG + 144, Y_ORG + 5, 144, 5, 19, 18, 89); X_ORG += 20; draw_lamp (default_lamps.indicator_lamp_9, X_ORG + 164, Y_ORG + 4, 164, 4, 19, 19, 102); X_ORG = 164; Y_ORG = 408; draw_lamp (default_lamps.engine_1_fire , X_ORG + 10, Y_ORG + 12, 10, 102, 26, 27, 0); X_ORG += 27; draw_lamp (default_lamps.apu_fire , X_ORG + 42, Y_ORG + 12, 42, 102, 26, 27, 13); X_ORG += 27; draw_lamp (default_lamps.engine_2_fire , X_ORG + 75, Y_ORG + 12, 75, 102, 26, 27, 25); X_ORG = 72; Y_ORG = 375; draw_lamp (default_lamps.armament_lamp_1 , X_ORG + 9, Y_ORG + 7, 9, 327, 22, 23, 0); X_ORG += 23; draw_lamp (default_lamps.armament_lamp_2 , X_ORG + 31, Y_ORG + 7, 31, 327, 22, 23, 13); X_ORG = 305; Y_ORG = 283; draw_lamp (default_lamps.mfd_lamp_1 , X_ORG + 3, Y_ORG + 3, 3, 183, 24, 22, 0); Y_ORG += 23; draw_lamp (default_lamps.mfd_lamp_2 , X_ORG + 3, Y_ORG + 25, 3, 205, 24, 21, 13); unlock_screen (active_screen); }
void draw_default_mfd_lamps (cockpit_panels panel) { unsigned char *sprite_data, *mask_data; sprite_data = get_graphics_file_data (base_cockpit_graphics_file + GRAPHICS_COCKPITS_APACHE_SPRITES); mask_data = get_graphics_file_data (base_cockpit_graphics_file + GRAPHICS_COCKPITS_APACHE_SPRITES_MASK); if (test_cockpit_instruments) { static float timer = 0.0; timer += get_delta_time (); default_lamps.mfd_lamp_1 = 0; default_lamps.mfd_lamp_2 = 0; if (timer < (ONE_SECOND * 1.0)) { } else if (timer < (ONE_SECOND * 2.0)) { default_lamps.mfd_lamp_1 = 1; } else if (timer < (ONE_SECOND * 3.0)) { default_lamps.mfd_lamp_2 = 1; } else if (timer < (ONE_SECOND * 4.0)) { default_lamps.mfd_lamp_1 = 1; default_lamps.mfd_lamp_2 = 1; } else { timer = 0.0; } } switch (panel) { //////////////////////////////////////// case COCKPIT_PANEL_DOWN20_LEFT30: //////////////////////////////////////// { #define X_ORG (577) #define Y_ORG (309) draw_lamp (default_lamps.mfd_lamp_1 , X_ORG + 11, Y_ORG + 7, 51, 187, 31, 29, 0); // (100% alpha) draw_lamp (default_lamps.mfd_lamp_2 , X_ORG + 7, Y_ORG + 30, 47, 210, 29, 30, 13); // (95% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_DOWN20_AHEAD: //////////////////////////////////////// { #define X_ORG (305) #define Y_ORG (283) draw_lamp (default_lamps.mfd_lamp_1 , X_ORG + 3, Y_ORG + 3, 3, 183, 24, 22, 0); // (100% alpha) draw_lamp (default_lamps.mfd_lamp_2 , X_ORG + 3, Y_ORG + 25, 3, 205, 24, 21, 13); // (95% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_DOWN20_RIGHT30: //////////////////////////////////////// { #define X_ORG (17) #define Y_ORG (311) draw_lamp (default_lamps.mfd_lamp_1 , X_ORG + 3, Y_ORG + 3, 93, 183, 33, 31, 0); // (100% alpha) draw_lamp (default_lamps.mfd_lamp_2 , X_ORG + 8, Y_ORG + 27, 98, 207, 33, 31, 13); // (95% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_SPECIAL_APACHE_LHS_MFD: //////////////////////////////////////// { #define X_ORG (536) #define Y_ORG (9) draw_lamp (default_lamps.mfd_lamp_1 , X_ORG + 2, Y_ORG + 8, 142, 188, 63, 56, 0); // (100% alpha) draw_lamp (default_lamps.mfd_lamp_2 , X_ORG + 2, Y_ORG + 64, 142, 244, 63, 56, 13); // (95% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_SPECIAL_APACHE_RHS_MFD: //////////////////////////////////////// { #define X_ORG (35) #define Y_ORG (11) draw_lamp (default_lamps.mfd_lamp_1 , X_ORG + 4, Y_ORG + 8, 214, 188, 63, 56, 0); // (100% alpha) draw_lamp (default_lamps.mfd_lamp_2 , X_ORG + 4, Y_ORG + 64, 214, 244, 63, 56, 13); // (95% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// default: //////////////////////////////////////// { debug_fatal (lamp_error); break; } } }
void draw_default_armament_lamps (cockpit_panels panel) { unsigned char *sprite_data, *mask_data; sprite_data = get_graphics_file_data (base_cockpit_graphics_file + GRAPHICS_COCKPITS_APACHE_SPRITES); mask_data = get_graphics_file_data (base_cockpit_graphics_file + GRAPHICS_COCKPITS_APACHE_SPRITES_MASK); if (test_cockpit_instruments) { static float timer = 0.0; timer += get_delta_time (); default_lamps.armament_lamp_1 = 0; default_lamps.armament_lamp_2 = 0; if (timer < (ONE_SECOND * 1.0)) { } else if (timer < (ONE_SECOND * 2.0)) { default_lamps.armament_lamp_1 = 1; } else if (timer < (ONE_SECOND * 3.0)) { default_lamps.armament_lamp_2 = 1; } else if (timer < (ONE_SECOND * 4.0)) { default_lamps.armament_lamp_1 = 1; default_lamps.armament_lamp_2 = 1; } else { timer = 0.0; } } switch (panel) { //////////////////////////////////////// case COCKPIT_PANEL_DOWN20_LEFT60: //////////////////////////////////////// { #define X_ORG (613) #define Y_ORG (395) draw_lamp (default_lamps.armament_lamp_1 , X_ORG + 4, Y_ORG + 8, 134, 328, 23, 31, 0); // (100% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_DOWN20_LEFT30: //////////////////////////////////////// { #define X_ORG (339) #define Y_ORG (347) draw_lamp (default_lamps.armament_lamp_1 , X_ORG + 4, Y_ORG + 6, 74, 325, 23, 25, 0); // (100% alpha) draw_lamp (default_lamps.armament_lamp_2 , X_ORG + 23, Y_ORG + 13, 93, 332, 23, 25, 13); // (95% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_DOWN20_AHEAD: //////////////////////////////////////// { #define X_ORG (72) #define Y_ORG (375) draw_lamp (default_lamps.armament_lamp_1 , X_ORG + 9, Y_ORG + 7, 9, 327, 22, 23, 0); // (100% alpha) draw_lamp (default_lamps.armament_lamp_2 , X_ORG + 31, Y_ORG + 7, 31, 327, 22, 23, 13); // (95% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_SPECIAL_APACHE_LHS_MFD: //////////////////////////////////////// { #define X_ORG (0) #define Y_ORG (277) draw_lamp (default_lamps.armament_lamp_2 , X_ORG + 4, Y_ORG + 4, 164, 324, 64, 59, 13); // (95% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// default: //////////////////////////////////////// { debug_fatal (lamp_error); break; } } }
void draw_default_fire_detector_lamps (cockpit_panels panel) { unsigned char *sprite_data, *mask_data; sprite_data = get_graphics_file_data (base_cockpit_graphics_file + GRAPHICS_COCKPITS_APACHE_SPRITES); mask_data = get_graphics_file_data (base_cockpit_graphics_file + GRAPHICS_COCKPITS_APACHE_SPRITES_MASK); if (test_cockpit_instruments) { static float timer = 0.0; timer += get_delta_time (); default_lamps.engine_1_fire = 0; default_lamps.apu_fire = 0; default_lamps.engine_2_fire = 0; if (timer < (ONE_SECOND * 1.0)) { } else if (timer < (ONE_SECOND * 2.0)) { default_lamps.engine_1_fire = 1; } else if (timer < (ONE_SECOND * 3.0)) { default_lamps.apu_fire = 1; } else if (timer < (ONE_SECOND * 4.0)) { default_lamps.engine_2_fire = 1; } else if (timer < (ONE_SECOND * 5.0)) { default_lamps.engine_1_fire = 1; default_lamps.apu_fire = 1; default_lamps.engine_2_fire = 1; } else { timer = 0.0; } } switch (panel) { //////////////////////////////////////// case COCKPIT_PANEL_LEVEL_LEFT30: //////////////////////////////////////// { #define X_ORG (461) #define Y_ORG (417) draw_lamp (default_lamps.engine_1_fire , X_ORG + 11, Y_ORG + 5, 371, 95, 26, 28, 0); // (100% alpha) draw_lamp (default_lamps.apu_fire , X_ORG + 45, Y_ORG + 10, 405, 100, 26, 29, 13); // (95% alpha) draw_lamp (default_lamps.engine_2_fire , X_ORG + 82, Y_ORG + 16, 442, 106, 26, 29, 25); // (90% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_LEVEL_AHEAD: //////////////////////////////////////// { #define X_ORG (164) #define Y_ORG (408) draw_lamp (default_lamps.engine_1_fire , X_ORG + 10, Y_ORG + 12, 10, 102, 26, 27, 0); // (100% alpha) draw_lamp (default_lamps.apu_fire , X_ORG + 42, Y_ORG + 12, 42, 102, 26, 27, 13); // (95% alpha) draw_lamp (default_lamps.engine_2_fire , X_ORG + 75, Y_ORG + 12, 75, 102, 26, 27, 25); // (90% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_DOWN20_LEFT30: //////////////////////////////////////// { #define X_ORG (446) #define Y_ORG (214) draw_lamp (default_lamps.engine_1_fire , X_ORG + 16, Y_ORG + 7, 256, 97, 26, 27, 0); // (100% alpha) draw_lamp (default_lamps.apu_fire , X_ORG + 48, Y_ORG + 12, 288, 102, 26, 27, 13); // (95% alpha) draw_lamp (default_lamps.engine_2_fire , X_ORG + 82, Y_ORG + 18, 322, 108, 26, 27, 25); // (90% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_DOWN20_AHEAD: //////////////////////////////////////// { #define X_ORG (172) #define Y_ORG (213) draw_lamp (default_lamps.engine_1_fire , X_ORG + 9, Y_ORG + 5, 129, 95, 26, 27, 0); // (100% alpha) draw_lamp (default_lamps.apu_fire , X_ORG + 40, Y_ORG + 5, 160, 95, 26, 27, 13); // (95% alpha) draw_lamp (default_lamps.engine_2_fire , X_ORG + 70, Y_ORG + 5, 190, 95, 26, 27, 25); // (90% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// default: //////////////////////////////////////// { debug_fatal (lamp_error); break; } } }
void draw_default_indicator_lamps (cockpit_panels panel) { unsigned char *sprite_data, *mask_data; sprite_data = get_graphics_file_data (base_cockpit_graphics_file + GRAPHICS_COCKPITS_APACHE_SPRITES); mask_data = get_graphics_file_data (base_cockpit_graphics_file + GRAPHICS_COCKPITS_APACHE_SPRITES_MASK); if (test_cockpit_instruments) { static float timer = 0.0; default_lamps.indicator_lamp_1 = 0; default_lamps.indicator_lamp_2 = 0; default_lamps.indicator_lamp_3 = 0; default_lamps.indicator_lamp_4 = 0; default_lamps.indicator_lamp_5 = 0; default_lamps.indicator_lamp_6 = 0; default_lamps.indicator_lamp_7 = 0; default_lamps.indicator_lamp_8 = 0; default_lamps.indicator_lamp_9 = 0; timer += get_delta_time (); if (timer < (ONE_SECOND * 1.0)) { } else if (timer < (ONE_SECOND * 2.0)) { default_lamps.indicator_lamp_1 = 1; } else if (timer < (ONE_SECOND * 3.0)) { default_lamps.indicator_lamp_2 = 1; } else if (timer < (ONE_SECOND * 4.0)) { default_lamps.indicator_lamp_3 = 1; } else if (timer < (ONE_SECOND * 5.0)) { default_lamps.indicator_lamp_4 = 1; } else if (timer < (ONE_SECOND * 6.0)) { default_lamps.indicator_lamp_5 = 1; } else if (timer < (ONE_SECOND * 7.0)) { default_lamps.indicator_lamp_6 = 1; } else if (timer < (ONE_SECOND * 8.0)) { default_lamps.indicator_lamp_7 = 1; } else if (timer < (ONE_SECOND * 9.0)) { default_lamps.indicator_lamp_8 = 1; } else if (timer < (ONE_SECOND * 10.0)) { default_lamps.indicator_lamp_9 = 1; } else if (timer < (ONE_SECOND * 11.0)) { default_lamps.indicator_lamp_1 = 1; default_lamps.indicator_lamp_2 = 1; default_lamps.indicator_lamp_3 = 1; default_lamps.indicator_lamp_4 = 1; default_lamps.indicator_lamp_5 = 1; default_lamps.indicator_lamp_6 = 1; default_lamps.indicator_lamp_7 = 1; default_lamps.indicator_lamp_8 = 1; default_lamps.indicator_lamp_9 = 1; } else { timer = 0.0; } } switch (panel) { //////////////////////////////////////// case COCKPIT_PANEL_LEVEL_LEFT30: //////////////////////////////////////// { #define X_ORG (524) #define Y_ORG (378) draw_lamp (default_lamps.indicator_lamp_1, X_ORG + 9, Y_ORG + 5, 9, 45, 22, 21, 0); // (100% alpha) draw_lamp (default_lamps.indicator_lamp_2, X_ORG + 32, Y_ORG + 8, 32, 48, 22, 22, 13); // (95% alpha) draw_lamp (default_lamps.indicator_lamp_3, X_ORG + 55, Y_ORG + 11, 55, 51, 23, 22, 25); // (90% alpha) draw_lamp (default_lamps.indicator_lamp_4, X_ORG + 79, Y_ORG + 14, 79, 54, 24, 22, 38); // (85% alpha) draw_lamp (default_lamps.indicator_lamp_5, X_ORG + 104, Y_ORG + 16, 104, 56, 12, 22, 51); // (80% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_LEVEL_AHEAD: //////////////////////////////////////// { #define X_ORG (225) #define Y_ORG (370) draw_lamp (default_lamps.indicator_lamp_1, X_ORG + 7, Y_ORG + 4, 7, 4, 19, 19, 0); // (100% alpha) draw_lamp (default_lamps.indicator_lamp_2, X_ORG + 27, Y_ORG + 4, 27, 4, 18, 19, 13); // (95% alpha) draw_lamp (default_lamps.indicator_lamp_3, X_ORG + 47, Y_ORG + 5, 47, 5, 18, 18, 25); // (90% alpha) draw_lamp (default_lamps.indicator_lamp_4, X_ORG + 66, Y_ORG + 5, 66, 5, 18, 18, 38); // (85% alpha) draw_lamp (default_lamps.indicator_lamp_5, X_ORG + 86, Y_ORG + 5, 86, 5, 18, 18, 51); // (80% alpha) draw_lamp (default_lamps.indicator_lamp_6, X_ORG + 106, Y_ORG + 5, 106, 5, 18, 18, 64); // (75% alpha) draw_lamp (default_lamps.indicator_lamp_7, X_ORG + 125, Y_ORG + 5, 125, 5, 18, 18, 76); // (70% alpha) draw_lamp (default_lamps.indicator_lamp_8, X_ORG + 144, Y_ORG + 5, 144, 5, 19, 18, 89); // (65% alpha) draw_lamp (default_lamps.indicator_lamp_9, X_ORG + 164, Y_ORG + 4, 164, 4, 19, 19, 102); // (60% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_LEVEL_RIGHT30: //////////////////////////////////////// { #define X_ORG (0) #define Y_ORG (380) draw_lamp (default_lamps.indicator_lamp_5, X_ORG + 0, Y_ORG + 14, 120, 54, 12, 22, 51); // (80% alpha) draw_lamp (default_lamps.indicator_lamp_6, X_ORG + 13, Y_ORG + 12, 133, 52, 24, 22, 64); // (75% alpha) draw_lamp (default_lamps.indicator_lamp_7, X_ORG + 38, Y_ORG + 8, 158, 48, 23, 23, 76); // (70% alpha) draw_lamp (default_lamps.indicator_lamp_8, X_ORG + 62, Y_ORG + 6, 182, 46, 22, 22, 89); // (65% alpha) draw_lamp (default_lamps.indicator_lamp_9, X_ORG + 85, Y_ORG + 3, 205, 43, 22, 21, 102); // (60% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_DOWN20_LEFT30: //////////////////////////////////////// { #define X_ORG (512) #define Y_ORG (174) draw_lamp (default_lamps.indicator_lamp_1, X_ORG + 13, Y_ORG + 12, 393, 12, 23, 20, 0); // (100% alpha) draw_lamp (default_lamps.indicator_lamp_2, X_ORG + 34, Y_ORG + 14, 414, 14, 24, 21, 13); // (95% alpha) draw_lamp (default_lamps.indicator_lamp_3, X_ORG + 56, Y_ORG + 17, 436, 17, 25, 21, 25); // (90% alpha) draw_lamp (default_lamps.indicator_lamp_4, X_ORG + 79, Y_ORG + 20, 459, 20, 25, 21, 38); // (85% alpha) draw_lamp (default_lamps.indicator_lamp_5, X_ORG + 103, Y_ORG + 23, 483, 23, 25, 21, 51); // (80% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_DOWN20_AHEAD: //////////////////////////////////////// { #define X_ORG (229) #define Y_ORG (173) draw_lamp (default_lamps.indicator_lamp_1, X_ORG + 6, Y_ORG + 5, 196, 5, 18, 17, 0); // (100% alpha) draw_lamp (default_lamps.indicator_lamp_2, X_ORG + 25, Y_ORG + 5, 215, 5, 18, 17, 13); // (95% alpha) draw_lamp (default_lamps.indicator_lamp_3, X_ORG + 44, Y_ORG + 5, 234, 5, 18, 17, 25); // (90% alpha) draw_lamp (default_lamps.indicator_lamp_4, X_ORG + 63, Y_ORG + 5, 253, 5, 18, 17, 38); // (85% alpha) draw_lamp (default_lamps.indicator_lamp_5, X_ORG + 82, Y_ORG + 5, 272, 5, 18, 17, 51); // (80% alpha) draw_lamp (default_lamps.indicator_lamp_6, X_ORG + 101, Y_ORG + 5, 291, 5, 18, 17, 64); // (75% alpha) draw_lamp (default_lamps.indicator_lamp_7, X_ORG + 120, Y_ORG + 5, 310, 5, 18, 17, 76); // (70% alpha) draw_lamp (default_lamps.indicator_lamp_8, X_ORG + 139, Y_ORG + 5, 329, 5, 18, 17, 89); // (65% alpha) draw_lamp (default_lamps.indicator_lamp_9, X_ORG + 158, Y_ORG + 5, 348, 5, 18, 17, 102); // (60% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// case COCKPIT_PANEL_DOWN20_RIGHT30: //////////////////////////////////////// { #define X_ORG (0) #define Y_ORG (177) draw_lamp (default_lamps.indicator_lamp_5, X_ORG + 0, Y_ORG + 20, 510, 20, 25, 21, 51); // (80% alpha) draw_lamp (default_lamps.indicator_lamp_6, X_ORG + 24, Y_ORG + 17, 534, 17, 25, 21, 64); // (75% alpha) draw_lamp (default_lamps.indicator_lamp_7, X_ORG + 48, Y_ORG + 14, 558, 14, 23, 21, 76); // (70% alpha) draw_lamp (default_lamps.indicator_lamp_8, X_ORG + 70, Y_ORG + 12, 580, 12, 24, 20, 89); // (65% alpha) draw_lamp (default_lamps.indicator_lamp_9, X_ORG + 92, Y_ORG + 8, 602, 8, 23, 21, 102); // (60% alpha) #undef X_ORG #undef Y_ORG break; } //////////////////////////////////////// default: //////////////////////////////////////// { debug_fatal (lamp_error); break; } } }
void draw_kiowa_virtual_cockpit_lamps (void) { ASSERT (virtual_cockpit_inst3d); draw_lamp (kiowa_lamps.master_caution, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__000); draw_lamp (kiowa_lamps.engine_ignition, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__024); draw_lamp (kiowa_lamps.apu_ignition, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__025); draw_lamp (kiowa_lamps.engine_fire, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__001); draw_lamp (kiowa_lamps.apu_fire, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__002); draw_lamp (kiowa_lamps.engine_fire_extinguiser, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__019); draw_lamp (kiowa_lamps.hydraulic_pressure, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__021); draw_lamp (kiowa_lamps.oil_pressure, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__022); draw_lamp (kiowa_lamps.oil_temperature, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__023); draw_lamp (kiowa_lamps.overtorque, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__010); draw_lamp (kiowa_lamps.rotor_rpm, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__011); draw_lamp (kiowa_lamps.fuel_low, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__012); draw_lamp (kiowa_lamps.rotor_brake, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__004); draw_lamp (kiowa_lamps.navigation_lights, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__006); draw_lamp (kiowa_lamps.hover_hold, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__008); draw_lamp (kiowa_lamps.altitude_hold, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__042); draw_lamp (kiowa_lamps.auto_pilot, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__009); draw_lamp (kiowa_lamps.laser, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__014); draw_lamp (kiowa_lamps.ir_jammer, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__016); draw_lamp (kiowa_lamps.auto_counter_measures, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__017); draw_lamp (kiowa_lamps.ase_auto_page, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__018); draw_lamp (kiowa_lamps.co_pilot_main_mfd_focus, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__030); draw_lamp (kiowa_lamps.pilot_main_mfd_focus, TEXTURE_ANIMATION_INDEX_COCKPIT_LAMP__031); }