void draw_scene() { CHECK_GL_ERRORS(); glClearColor(skybox_fog_color[0], skybox_fog_color[1], skybox_fog_color[2], 0.0); if(!shadows_on || !have_stencil)glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT); else glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); if (!have_display) { new_zoom_level = zoom_level; // No scrolling when switching modes... if (quickbar_relocatable && quickbar_win >= 0) // Hack { if (get_show_window (quickbar_win) && windows_list.window[quickbar_win].cur_x < window_width - hud_x && window_height - windows_list.window[quickbar_win].cur_y > hud_y) hide_window (quickbar_win); } } glLoadIdentity (); // Reset The Matrix Enter2DMode (); display_windows (1); // Have to draw the dragged item *after* all windows glColor3f(1.0f,1.0f,1.0f); if (item_dragged != -1) drag_item (item_dragged, 0, 0); else if (use_item != -1 && current_cursor == CURSOR_USE_WITEM) drag_item (use_item, 0, 1); else if (storage_item_dragged != -1) drag_item (storage_item_dragged, 1, 0); draw_special_cursors(); Leave2DMode (); if(elwin_mouse >= 0) { if (current_cursor != elwin_mouse) change_cursor(elwin_mouse); elwin_mouse = -1; } SDL_GL_SwapBuffers(); CHECK_GL_ERRORS(); /* start or stop the harvesting effect depending on harvesting state */ check_harvesting_effect(); if (draw_delay > 0) { SDL_Delay (draw_delay); draw_delay = 0; } }
int display_browser_handler(window_info *win) { //title bar //draw_menu_title_bar(browser_menu_x,browser_menu_y-16,browser_menu_x_len); // window drawing glEnable(GL_BLEND); glBlendFunc(GL_ONE,GL_SRC_ALPHA); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); glColor3f(0.77f,0.57f,0.39f); glBegin(GL_LINES); //scroll bar if(!mc){ glVertex3i(win->len_x-20,20,0); glVertex3i(win->len_x-20,400,0); } if(cd!=-1){ glVertex3i(win->len_x-15,30,0); glVertex3i(win->len_x-10,25,0); glVertex3i(win->len_x-10,25,0); glVertex3i(win->len_x-5,30,0); glVertex3i(win->len_x-15,385,0); glVertex3i(win->len_x-10,390,0); glVertex3i(win->len_x-10,390,0); glVertex3i(win->len_x-5,385,0); //separators glVertex3i(0+200,0,0); glVertex3i(0+200,0+400,0); glVertex3i(0,0+200,0); glVertex3i(0+400,0+200,0); } glEnd(); glEnable(GL_TEXTURE_2D); // The X if(!mc){ draw_string(win->len_x-16,160,(unsigned char *)"B",1); draw_string(win->len_x-16,180,(unsigned char *)"A",1); draw_string(win->len_x-16,200,(unsigned char *)"C",1); draw_string(win->len_x-16,220,(unsigned char *)"K",1); } draw_string(0+win->len_x-16,0+2,(unsigned char *)"X",1); if(cd==-1){ //display dir select menu int i,x=0,y=2; if(mc==1){ for(i=0;i<=cc;i++){ draw_string(x+2,0+y,(unsigned char *)Cat[i].Name,1); y+=18; if(y>=398){ x=210; y=2; } } }else{ for(i=0;i<Cat[ccat].ns;i++){ draw_string(x+2,0+y,(unsigned char *)Cat[ccat].Sub[i]->DirName,1); y+=18; if(y>=398){ x=210; y=2; } } } }else{ // display specified dir int i=cp,valid_object=0; float tz=zoom_level; char fn[256]; // Prepare to render Leave2DMode(); glEnable(GL_CULL_FACE); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); if(have_multitexture && clouds_shadows){ //bind the detail texture glActiveTextureARB(GL_TEXTURE1_ARB); glEnable(GL_TEXTURE_2D); #ifdef NEW_TEXTURES bind_texture_unbuffered(ground_detail_text); #else /* NEW_TEXTURES */ glBindTexture(GL_TEXTURE_2D, texture_cache[ground_detail_text].texture_id); #endif /* NEW_TEXTURES */ glActiveTextureARB(GL_TEXTURE0_ARB); glEnable(GL_TEXTURE_2D); } // Now we draw the 4 objects zoom_level=3.0; window_resize(); glRotatef(-60, 1.0f, 0.0f, 0.0f); glRotatef(0, 0.0f, 0.0f, 1.0f); glRotatef(45, 0.0f, 0.0f, 1.0f); glViewport(win->pos_x,window_height-win->pos_y-150,200,150); glClearStencil(0); glClear (GL_DEPTH_BUFFER_BIT); #ifdef LINUX strcpy(fn,exec_path); #else //Fedora: don't ask me why, if you use exec_path, e3d files are not found strcpy(fn,"."/*exec_path*/); #endif strcat(fn,Dir[cd].Files[i]); valid_object=setobject(0,fn,Dir[cd].xrot[i],Dir[cd].yrot[i],Dir[cd].zrot[i]); if(valid_object){ glPushMatrix(); glScalef(Dir[cd].size[i],Dir[cd].size[i],Dir[cd].size[i]); draw_3d_object(&o3d[0]); glPopMatrix(); } if(i+1<Dir[cd].nf){ glViewport(win->pos_x+200,window_height-win->pos_y-150,200,150); glClearStencil(0); glClear (GL_DEPTH_BUFFER_BIT); #ifdef LINUX strcpy(fn,exec_path); #else //Fedora: don't ask me why, if you use exec_path, e3d files are not found strcpy(fn,"."/*exec_path*/); #endif strcat(fn,Dir[cd].Files[i+1]); valid_object=setobject(1,fn,Dir[cd].xrot[i+1],Dir[cd].yrot[i+1],Dir[cd].zrot[i+1]); if(valid_object){ glPushMatrix(); glScalef(Dir[cd].size[i+1],Dir[cd].size[i+1],Dir[cd].size[i+1]); draw_3d_object(&o3d[1]); glPopMatrix(); } } if(i+2<Dir[cd].nf){ glViewport(win->pos_x,window_height-win->pos_y-350,200,150); glClearStencil(0); glClear (GL_DEPTH_BUFFER_BIT); #ifdef LINUX strcpy(fn,exec_path); #else //Fedora: don't ask me why, if you use exec_path, e3d files are not found strcpy(fn,"."/*exec_path*/); #endif strcat(fn,Dir[cd].Files[i+2]); valid_object=setobject(2,fn,Dir[cd].xrot[i+2],Dir[cd].yrot[i+2],Dir[cd].zrot[i+2]); if(valid_object){ glPushMatrix(); glScalef(Dir[cd].size[i+2],Dir[cd].size[i+2],Dir[cd].size[i+2]); draw_3d_object(&o3d[2]); glPopMatrix(); } } if(i+3<Dir[cd].nf){ glViewport(win->pos_x+200,window_height-win->pos_y-350,200,150); glClearStencil(0); glClear (GL_DEPTH_BUFFER_BIT); #ifdef LINUX strcpy(fn,exec_path); #else //Fedora: don't ask me why, if you use exec_path, e3d files are not found strcpy(fn,"."/*exec_path*/); #endif strcat(fn,Dir[cd].Files[i+3]); valid_object=setobject(3,fn,Dir[cd].xrot[i+3],Dir[cd].yrot[i+3],Dir[cd].zrot[i+3]); if(valid_object){ glPushMatrix(); glScalef(Dir[cd].size[i+3],Dir[cd].size[i+3],Dir[cd].size[i+3]); draw_3d_object(&o3d[3]); glPopMatrix(); } } zoom_level=tz; window_resize(); // Back to normal glViewport(0,0,window_width,window_height); glDisable(GL_CULL_FACE); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); if(have_multitexture && clouds_shadows) { //disable the second texture unit glActiveTextureARB(GL_TEXTURE1_ARB); glDisable(GL_TEXTURE_2D); glActiveTextureARB(GL_TEXTURE0_ARB); } Enter2DMode(); CHECK_GL_ERRORS(); // Object names draw_string(win->pos_x+2,win->pos_y+200-18,(unsigned char *)Dir[cd].Names[i],1); draw_string(win->pos_x+2,win->pos_y+400-18,(unsigned char *)Dir[cd].Names[i+2],1); draw_string(win->pos_x+202,win->pos_y+200-18,(unsigned char *)Dir[cd].Names[i+1],1); draw_string(win->pos_x+202,win->pos_y+400-18,(unsigned char *)Dir[cd].Names[i+3],1); } return 1; }
void draw_scene() { CHECK_GL_ERRORS(); glClearColor(skybox_fog_color[0], skybox_fog_color[1], skybox_fog_color[2], 0.0); if(!shadows_on || !have_stencil)glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT); else glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); if (!have_display) { // No scrolling when switching modes... new_zoom_level = zoom_level; // Hide the moveable hud windows if they are not on the bottom or side hud bar hide_moved_hud_windows(); } glLoadIdentity (); // Reset The Matrix Enter2DMode (); display_windows (1); // Have to draw the dragged item *after* all windows glColor3f(1.0f,1.0f,1.0f); if (item_dragged != -1) drag_item (item_dragged, 0, 0); else if (use_item != -1 && current_cursor == CURSOR_USE_WITEM) drag_item (use_item, 0, 1); else if (storage_item_dragged != -1) drag_item (storage_item_dragged, 1, 0); draw_special_cursors(); Leave2DMode (); if(elwin_mouse >= 0) { if (current_cursor != elwin_mouse) change_cursor(elwin_mouse); elwin_mouse = -1; } SDL_GL_SwapBuffers(); CHECK_GL_ERRORS(); /* stuff to do not every frame, twice a second is fine */ { static Uint32 last_half_second_timer = 0; static int first_time = 1; Uint32 current_time = SDL_GetTicks(); if (first_time) { last_half_second_timer = current_time; first_time = 0; } if ((current_time - last_half_second_timer) > 500u) { /* start or stop the harvesting effect depending on harvesting state */ check_harvesting_effect(); /* check for and possibly do auto save */ auto_save_local_and_server(); /* action on afk state changes */ check_afk_state(); /* the timer in the hud */ update_hud_timer(); /* check if we need to do buff duration requests */ check_then_do_buff_duration_request(); /* check if we are doing a server connection test */ check_if_testing_server_connection(); /* until next time */ last_half_second_timer = current_time; } } if (draw_delay > 0) { SDL_Delay (draw_delay); draw_delay = 0; } }