void init(void) { All * a = global_a; all_init(a); land_display_title("Yellow and Dangerous"); reload_fonts(); #line 148 a->up = 0; a->down = 0; a->left = 0; a->right = 0; a->jump = 0; #line 154 a->text = (LandColor) {0, 0, 0, 1}; #line 156 config_controls_read(); #line 158 game_setup(land_display_width(), land_display_height()); #line 160 render_setup(); #line 162 a->show_fps = 0; #line 164 for (int i = 0; i < 10; i += 1) { a->cheatpos [i] = 0; } }
void update(void) { All * a = global_a; #line 175 if (land_was_resized()) { #line 177 viewport_update(game->viewport, land_display_width(), land_display_height()); a->resize_in_ticks = 10; } if (a->resize_in_ticks > 0) { a->resize_in_ticks--; if (a->resize_in_ticks == 0) { reload_fonts(); } } #line 185 if (a->load_after_redraw) { if (a->load_after_redraw == 2) { #line 188 load_level(a->editor || game->record->is_replaying || game->record->is_recording); if (a->find_entrance) { a->find_entrance = 0; if (game->player) { player_find_entrance(& game->player->super); } } #line 193 if (game && game->player) { #line 195 record_load(game->record, game->level, game->player->super.x, game->player->super.y, game->player->super.z); } #line 196 a->load_after_redraw++; } #line 196 return ; } #line 199 config_check_controls(a); #line 201 if (a->title) { title_tick(); } #line 202 else { #line 204 game_tick(game); } }
static void video_update_quality(void) { int vw, vh; video_get_viewport_size(&vw,&vh); float q = (float)vh / SCREEN_H; float fg = q * config_get_float(CONFIG_FG_QUALITY); float bg = q * config_get_float(CONFIG_BG_QUALITY); float text = q * config_get_float(CONFIG_TEXT_QUALITY); log_debug("q:%f, fg:%f, bg:%f, text:%f", q, fg, bg, text); reinit_fbo(&resources.fbo.bg[0], bg, GL_RGB); reinit_fbo(&resources.fbo.bg[1], bg, GL_RGB); reinit_fbo(&resources.fbo.fg[0], fg, GL_RGB); reinit_fbo(&resources.fbo.fg[1], fg, GL_RGB); reinit_fbo(&resources.fbo.rgba[0], fg, GL_RGBA); reinit_fbo(&resources.fbo.rgba[1], fg, GL_RGBA); reload_fonts(text); }
void set_new_video_mode(int fs,int mode) { int i; #ifndef NEW_TEXTURES int alpha; #endif /* NEW_TEXTURES */ full_screen=fs; video_mode=mode; //now, clear all the textures... #ifdef NEW_TEXTURES unload_texture_cache(); #else /* NEW_TEXTURES */ for(i = 0; i < TEXTURE_CACHE_MAX; i++) { if(texture_cache[i].file_name[0]) { glDeleteTextures(1,(GLuint*)&texture_cache[i].texture_id); texture_cache[i].texture_id=0;//force a reload CHECK_GL_ERRORS(); } } #ifndef MAP_EDITOR2 //do the same for the actors textures... for(i=0;i<max_actors;i++) { if(actors_list[i]) { if(actors_list[i]->remapped_colors || actors_list[i]->is_enhanced_model)//if it is not remapable, then it is already in the cache { glDeleteTextures(1,&actors_list[i]->texture_id); actors_list[i]->texture_id=0; CHECK_GL_ERRORS(); } } } #endif #endif /* NEW_TEXTURES */ if (use_vertex_buffers) { e3d_object * obj; #ifdef FASTER_MAP_LOAD for (i = 0; i < cache_e3d->num_items; i++) #else for (i = 0; i < cache_e3d->max_item; i++) #endif { if (!cache_e3d->cached_items[i]) continue; obj= cache_e3d->cached_items[i]->cache_item; free_e3d_va(obj); } CHECK_GL_ERRORS(); } #ifndef NEW_TEXTURES ec_clear_textures(); #endif /* NEW_TEXTURES */ //destroy the current context init_video(); #ifndef WINDOWS // Re-enable window manager events, since the killing of the video // subsystem turns them off. SDL_EventState (SDL_SYSWMEVENT, SDL_ENABLE); #endif resize_root_window(); init_lights(); disable_local_lights(); reset_material(); //reload the cursors load_cursors(); build_cursors(); change_cursor(current_cursor); ec_load_textures(); //now, reload the textures #ifndef NEW_TEXTURES for(i = 0; i < TEXTURE_CACHE_MAX; i++) { if (texture_cache[i].file_name[0] && !texture_cache[i].load_err) { alpha=texture_cache[i].alpha; //our texture was freed, we have to reload it if(alpha<=0) texture_cache[i].texture_id = load_bmp8_color_key (&(texture_cache[i]), alpha); else texture_cache[i].texture_id = load_bmp8_fixed_alpha (&(texture_cache[i]), alpha); } } reload_fonts(); #ifndef MAP_EDITOR2 //do the same for the actors textures... for(i=0;i<max_actors;i++) { if(actors_list[i]) { if(actors_list[i]->remapped_colors)//if it is not remapable, then it is already in the cache { //reload the skin //actors_list[i]->texture_id=load_bmp8_remapped_skin(actors_list[i]->skin_name, // 150,actors_list[i]->skin,actors_list[i]->hair,actors_list[i]->shirt, // actors_list[i]->pants,actors_list[i]->boots); } if(actors_list[i]->is_enhanced_model) { actors_list[i]->texture_id=load_bmp8_enhanced_actor(actors_list[i]->body_parts, 255); } } } #endif #endif /* NEW_TEXTURES */ //it is dependent on the window height... init_hud_interface (HUD_INTERFACE_LAST); new_minute(); set_all_intersect_update_needed(main_bbox_tree); skybox_init_gl(); // resize the EL root windows resize_all_root_windows (window_width, window_height); check_options(); reload_tab_map = 1; #ifdef NEW_CURSOR if (!sdl_cursors) { SDL_ShowCursor(0); SDL_WM_GrabInput(SDL_GRAB_OFF); } #endif // NEW_CURSOR }