| version 1.3 | | version 1.4 |
|---|
| | |
| #include "newmenu.h" | | #include "newmenu.h" |
| //#include "intrface.h" | | //#include "intrface.h" |
| | | |
| | | #include "d_delay.h" |
| | | |
| | | #ifdef OGL |
| | | #define AUTOMAP_DIRECT_RENDER |
| | | #else |
| #define AUTOMAP_NO_PAGING | | #define AUTOMAP_NO_PAGING |
| | | #endif |
| | | |
| void adjust_segment_limit(int SegmentLimit); | | void adjust_segment_limit(int SegmentLimit); |
| void draw_all_edges(); | | void draw_all_edges(); |
| void automap_build_edge_list(); | | void automap_build_edge_list(); |
| | |
| #define ZOOM_SPEED_FACTOR (1500) | | #define ZOOM_SPEED_FACTOR (1500) |
| #define ROT_SPEED_DIVISOR (115000) | | #define ROT_SPEED_DIVISOR (115000) |
| | | |
| | | #ifndef AUTOMAP_DIRECT_RENDER |
| // Screen anvas variables | | // Screen anvas variables |
| static int current_page=0; | | static int current_page=0; |
| static grs_canvas Pages[2]; | | static grs_canvas Pages[2]; |
| | |
| #ifdef AUTOMAP_NO_PAGING | | #ifdef AUTOMAP_NO_PAGING |
| static grs_canvas *OffscreenPage = NULL; | | static grs_canvas *OffscreenPage = NULL; |
| #endif | | #endif |
| | | #endif |
| | | |
| // Flags | | // Flags |
| static int Automap_cheat = 0; // If set, show everything | | static int Automap_cheat = 0; // If set, show everything |
| | |
| } | | } |
| | | |
| grs_canvas *name_canv; | | grs_canvas *name_canv; |
| | | char name_level[128]; |
| | | |
| void draw_player( object * obj ) | | void draw_player( object * obj ) |
| { | | { |
| | |
| vms_vector viewer_position; | | vms_vector viewer_position; |
| g3s_point sphere_point; | | g3s_point sphere_point; |
| | | |
| | | #ifndef AUTOMAP_DIRECT_RENDER |
| #ifndef AUTOMAP_NO_PAGING | | #ifndef AUTOMAP_NO_PAGING |
| current_page ^= 1; | | current_page ^= 1; |
| gr_set_current_canvas(&DrawingPages[current_page]); | | gr_set_current_canvas(&DrawingPages[current_page]); |
| #else | | #else |
| gr_set_current_canvas(&DrawingPages[0]); | | gr_set_current_canvas(&DrawingPages[0]); |
| #endif | | #endif |
| | | #endif |
| | | |
| gr_clear_canvas(0); | | gr_clear_canvas(0); |
| | | |
| | |
| | | |
| g3_end_frame(); | | g3_end_frame(); |
| | | |
| gr_bitmapm(5,5,&name_canv->cv_bitmap); | | // gr_bitmapm(5,5,&name_canv->cv_bitmap); |
| | | gr_set_curfont(GAME_FONT); |
| | | gr_set_fontcolor(BM_XRGB(0,31,0),-1); |
| | | gr_uprintf(5,5,name_level); |
| #ifdef OGL | | #ifdef OGL |
| ogl_swap_buffers(); | | ogl_swap_buffers(); |
| #else | | #else |
| | | #ifndef AUTOMAP_DIRECT_RENDER |
| #ifndef AUTOMAP_NO_PAGING | | #ifndef AUTOMAP_NO_PAGING |
| gr_show_canvas( &Pages[current_page] ); | | gr_show_canvas( &Pages[current_page] ); |
| #else | | #else |
| | |
| // int_gr_update(); | | // int_gr_update(); |
| gr_update(); | | gr_update(); |
| #endif | | #endif |
| | | #else |
| | | gr_update(); |
| | | #endif |
| #endif | | #endif |
| } | | } |
| | | |
| | |
| | | |
| void create_name_canv() | | void create_name_canv() |
| { | | { |
| char name_level[128]; | | |
| | | |
| if (Current_level_num > 0) | | if (Current_level_num > 0) |
| sprintf(name_level, "%s %i: ",TXT_LEVEL, Current_level_num); | | sprintf(name_level, "%s %i: ",TXT_LEVEL, Current_level_num); |
| | |
| void modex_print_message(int x, int y, char *str) | | void modex_print_message(int x, int y, char *str) |
| { | | { |
| | | |
| | | #ifndef AUTOMAP_DIRECT_RENDER |
| #ifndef AUTOMAP_NO_PAGING | | #ifndef AUTOMAP_NO_PAGING |
| int i; | | int i; |
| for (i=0; i<2; i++ ) { | | for (i=0; i<2; i++ ) { |
| | |
| { | | { |
| gr_set_current_canvas(OffscreenPage); | | gr_set_current_canvas(OffscreenPage); |
| #endif | | #endif |
| | | #endif |
| modex_printf(x, y, str, GFONT_MEDIUM_1); | | modex_printf(x, y, str, GFONT_MEDIUM_1); |
| | | #ifndef AUTOMAP_DIRECT_RENDER |
| } | | } |
| | | |
| gr_set_current_canvas(&DrawingPages[current_page]); | | gr_set_current_canvas(&DrawingPages[current_page]); |
| | | #endif |
| } | | } |
| | | |
| extern void GameLoop(int, int ); | | extern void GameLoop(int, int ); |
| | |
| int automap_mode = SM_640x480V; | | int automap_mode = SM_640x480V; |
| int automap_width = 640; | | int automap_width = 640; |
| int automap_height = 480; | | int automap_height = 480; |
| | | int automap_use_game_res=0; |
| | | int nice_automap=0; |
| | | |
| void do_automap( int key_code ) { | | void do_automap( int key_code ) { |
| int done=0; | | int done=0; |
| | |
| int Max_segments_away = 0; | | int Max_segments_away = 0; |
| int SegmentLimit = 1; | | int SegmentLimit = 1; |
| //added on 10/28/98 by adb to fix compile versions | | //added on 10/28/98 by adb to fix compile versions |
| #if !defined (NDEBUG) || !defined(AUTOMAP_NO_PAGING) | | #if !defined (NDEBUG) || (!defined(AUTOMAP_NO_PAGING) && !defined(AUTOMAP_DIRECT_RENDER)) |
| int i; | | int i; |
| #endif | | #endif |
| | | |
| | |
| mprintf( (0, "Num_vertices=%d, Max_edges=%d, (MAX:%d)\n", Num_vertices, Max_edges, MAX_EDGES )); | | mprintf( (0, "Num_vertices=%d, Max_edges=%d, (MAX:%d)\n", Num_vertices, Max_edges, MAX_EDGES )); |
| mprintf( (0, "Allocated %d K for automap edge list\n", (sizeof(Edge_info)+sizeof(short))*Max_edges/1024 )); | | mprintf( (0, "Allocated %d K for automap edge list\n", (sizeof(Edge_info)+sizeof(short))*Max_edges/1024 )); |
| | | |
| | | |
| | | if(automap_use_game_res){ |
| | | automap_width=grd_curscreen->sc_canvas.cv_bitmap.bm_w; |
| | | automap_height=grd_curscreen->sc_canvas.cv_bitmap.bm_h; |
| | | }else{ |
| //edit 4/23/99 Matt Mueller - don't switch res unless we need to | | //edit 4/23/99 Matt Mueller - don't switch res unless we need to |
| if (grd_curscreen->sc_mode != automap_mode) | | if (grd_curscreen->sc_mode != automap_mode) |
| gr_set_mode( automap_mode ); | | gr_set_mode( automap_mode ); |
| else | | else |
| gr_set_current_canvas(NULL); | | gr_set_current_canvas(NULL); |
| //end edit -MM | | //end edit -MM |
| | | } |
| | | |
| gr_palette_clear(); | | gr_palette_clear(); |
| | | |
| | | #ifndef AUTOMAP_DIRECT_RENDER |
| gr_init_sub_canvas(&Pages[0],grd_curcanv,0,0,automap_width,automap_height); | | gr_init_sub_canvas(&Pages[0],grd_curcanv,0,0,automap_width,automap_height); |
| #ifndef AUTOMAP_NO_PAGING | | #ifndef AUTOMAP_NO_PAGING |
| // NOTICE: should be 0,401! FIXME! | | // NOTICE: should be 0,401! FIXME! |
| | |
| } | | } |
| gr_init_sub_canvas(&DrawingPages[0],OffscreenPage,0,0,automap_width,automap_height); | | gr_init_sub_canvas(&DrawingPages[0],OffscreenPage,0,0,automap_width,automap_height); |
| #endif | | #endif |
| | | #endif |
| | | |
| gr_init_bitmap_data (&Automap_background); | | gr_init_bitmap_data (&Automap_background); |
| // pcx_error = pcx_read_bitmap(filename,&Automap_background,BM_LINEAR,NULL); | | // pcx_error = pcx_read_bitmap(filename,&Automap_background,BM_LINEAR,NULL); |
| | |
| // return; | | // return; |
| // } | | // } |
| | | |
| | | #ifndef AUTOMAP_DIRECT_RENDER |
| #ifndef AUTOMAP_NO_PAGING | | #ifndef AUTOMAP_NO_PAGING |
| for (i=0; i<2; i++ ) { | | for (i=0; i<2; i++ ) { |
| gr_set_current_canvas(&Pages[i]); | | gr_set_current_canvas(&Pages[i]); |
| | |
| #endif | | #endif |
| gr_free_bitmap_data (&Automap_background); | | gr_free_bitmap_data (&Automap_background); |
| gr_set_current_canvas(&DrawingPages[current_page]); | | gr_set_current_canvas(&DrawingPages[current_page]); |
| | | #endif |
| automap_build_edge_list(); | | automap_build_edge_list(); |
| | | |
| if ( ViewDist==0 ) | | if ( ViewDist==0 ) |
| | |
| first_time = 0; | | first_time = 0; |
| gr_palette_load( gr_palette ); | | gr_palette_load( gr_palette ); |
| } | | } |
| | | t2 = timer_get_fixed_seconds(); |
| | | while (t2-t1<F1_0/100){//ogl is fast enough that the automap can read the input too fast and you start to turn really slow. So delay a bit (and free up some cpu :) |
| | | if (nice_automap) |
| | | d_delay(1); |
| | | |
| t2 = timer_get_fixed_seconds(); | | t2 = timer_get_fixed_seconds(); |
| | | } |
| if (pause_game) | | if (pause_game) |
| FrameTime=t2-t1; | | FrameTime=t2-t1; |
| t1 = t2; | | t1 = t2; |