get the cockpit to show with d2x-gl (actually committed!)
authorChris Taylor <chris@icculus.org>
Sun, 7 Aug 2005 09:58:33 +0000 (09:58 +0000)
committerChris Taylor <chris@icculus.org>
Sun, 7 Aug 2005 09:58:33 +0000 (09:58 +0000)
ChangeLog
arch/ogl/ogl.c
main/game.c
main/gamerend.c

index 57182cd..8a6f1b3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-07  Chris Taylor  <chris@icculus.org>
+
+       * arch/ogl/ogl.c, main/game.c, main/gamerend.c:
+       get the cockpit to show with d2x-gl (actually committed!)
+
 2005-08-06  Chris Taylor  <chris@icculus.org>
 
        * main/automap.c: must_free_canvas isn't used when
index a67cda6..7c31b2b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: ogl.c,v 1.36 2004-11-14 09:50:36 schaffner Exp $ */
+/* $Id: ogl.c,v 1.37 2005-08-07 09:58:33 chris Exp $ */
 /*
  *
  * Graphics support functions for OpenGL.
@@ -1872,7 +1872,7 @@ void ogl_loadtexture(unsigned char *data, int dxo, int dyo, ogl_texture *tex, in
 
 }
 
-unsigned char decodebuf[512*512];
+unsigned char decodebuf[1024*1024];
 
 void ogl_loadbmtexture_f(grs_bitmap *bm, int flags)
 {
index ac6ec92..7c25d1d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: game.c,v 1.41 2005-08-02 06:13:56 chris Exp $ */
+/* $Id: game.c,v 1.42 2005-08-07 09:58:12 chris Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -23,7 +23,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-char game_rcsid[] = "$Id: game.c,v 1.41 2005-08-02 06:13:56 chris Exp $";
+char game_rcsid[] = "$Id: game.c,v 1.42 2005-08-07 09:58:12 chris Exp $";
 #endif
 
 #include <stdio.h>
@@ -162,8 +162,6 @@ int stop_count,start_count;
 int time_stopped,time_started;
 #endif
 
-ubyte * Game_cockpit_copy_code = NULL;
-
 int                    VR_screen_mode                  = 0;
 
 ubyte                  VR_screen_flags = 0;            //see values in screens.h
@@ -357,7 +355,7 @@ extern void newdemo_record_cockpit_change(int);
 //called every time the screen mode or cockpit changes
 void init_cockpit()
 {
-       int minx, maxx, miny, maxy;
+//     int minx, maxx, miny, maxy;
 
        //Initialize the on-screen canvases
 
@@ -374,28 +372,13 @@ void init_cockpit()
        if ( Screen_mode == SCREEN_EDITOR )
                Cockpit_mode = CM_FULL_SCREEN;
 
-#ifdef OGL
-       if (Cockpit_mode == CM_FULL_COCKPIT || Cockpit_mode == CM_REAR_VIEW) {
-               hud_message(MSGC_GAME_FEEDBACK, "Cockpit not available in GL mode");
-               Cockpit_mode = CM_FULL_SCREEN;
-       }
-#endif
-
        gr_set_current_canvas(NULL);
        gr_set_curfont( GAME_FONT );
 
-#ifdef __MSDOS__
-       if (Game_cockpit_copy_code)
-               d_free(Game_cockpit_copy_code);
-       Game_cockpit_copy_code  = NULL;
-#else
-       if (Game_cockpit_copy_code)
-               Game_cockpit_copy_code = 0;
-#endif
-
        switch( Cockpit_mode ) {
        case CM_FULL_COCKPIT:
        case CM_REAR_VIEW: {
+#if 0
                grs_bitmap *bm = &GameBitmaps[cockpit_bitmap[Cockpit_mode+(Current_display_mode?(Num_cockpits/2):0)].index];
 
                PIGGY_PAGE_IN(cockpit_bitmap[Cockpit_mode+(Current_display_mode?(Num_cockpits/2):0)]);
@@ -406,18 +389,12 @@ void init_cockpit()
                bm = &VR_offscreen_buffer->cv_bitmap;
                bm->bm_flags = BM_FLAG_TRANSPARENT;
                gr_ibitblt_find_hole_size ( bm, &minx, &miny, &maxx, &maxy );
-
-#ifndef __MSDOS__
-               gr_ibitblt_create_mask( bm, minx, miny, maxx-minx+1, maxy-miny+1, VR_offscreen_buffer->cv_bitmap.bm_rowsize);
-               Game_cockpit_copy_code  = (ubyte *)(1);
-#else
-               if ( Current_display_mode ) {
-                       Game_cockpit_copy_code  = gr_ibitblt_create_mask_svga( bm, minx, miny, maxx-minx+1, maxy-miny+1, VR_offscreen_buffer->cv_bitmap.bm_rowsize );
-               } else
-                       Game_cockpit_copy_code  = gr_ibitblt_create_mask( bm, minx, miny, maxx-minx+1, maxy-miny+1, VR_offscreen_buffer->cv_bitmap.bm_rowsize );
 #endif
-               bm->bm_flags = 0;               // Clear all flags for offscreen canvas
-               game_init_render_sub_buffers( 0, 0, maxx-minx+1, maxy-miny+1 );
+
+               if (Cockpit_mode == CM_FULL_COCKPIT)
+                       game_init_render_sub_buffers(0, 0, grd_curscreen->sc_w, (grd_curscreen->sc_h*2)/3);
+               else if (Cockpit_mode == CM_REAR_VIEW)
+                       game_init_render_sub_buffers((16*grd_curscreen->sc_w)/640, (89*grd_curscreen->sc_h)/480, (604*grd_curscreen->sc_w)/640, (209*grd_curscreen->sc_h)/480);
                break;
        }
 
@@ -2001,16 +1978,6 @@ void close_game()
 
        restore_effect_bitmap_icons();
 
-#ifdef __MSDOS__
-       if (Game_cockpit_copy_code)     {
-               d_free(Game_cockpit_copy_code);
-               Game_cockpit_copy_code = NULL;
-       }
-#else
-       if (Game_cockpit_copy_code)
-               Game_cockpit_copy_code = 0;
-#endif
-
        if (background_bitmap.bm_data)
                d_free(background_bitmap.bm_data);
 
index 67dcf18..1d6cb5a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: gamerend.c,v 1.19 2005-08-02 06:13:56 chris Exp $ */
+/* $Id: gamerend.c,v 1.20 2005-08-07 09:58:12 chris Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -23,7 +23,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-static char rcsid[] = "$Id: gamerend.c,v 1.19 2005-08-02 06:13:56 chris Exp $";
+static char rcsid[] = "$Id: gamerend.c,v 1.20 2005-08-07 09:58:12 chris Exp $";
 #endif
 
 #include <stdio.h>
@@ -904,9 +904,9 @@ void show_extra_views()
 
 int BigWindowSwitch=0;
 extern int force_cockpit_redraw;
-extern ubyte * Game_cockpit_copy_code;
 
 void draw_guided_crosshair(void);
+void update_cockpits(int force_redraw);
 
 
 //render a frame for the game
@@ -983,8 +983,6 @@ void game_render_frame_mono(void)
        if (!no_draw_hud)
                game_draw_hud_stuff();
 
-       show_extra_views();             //missile view, buddy bot, etc.
-
        if (Game_paused) {              //render pause message over off-screen 3d (to minimize flicker)
                extern char *Pause_msg;
                ubyte *save_data = VR_screen_pages[VR_current_page].cv_bitmap.bm_data;
@@ -995,7 +993,7 @@ void game_render_frame_mono(void)
        }
 
        if ( Game_double_buffer ) {             //copy to visible screen
-               if ( !Game_cockpit_copy_code )  {
+//             if ( !Game_cockpit_copy_code )  {
                        if ( VR_screen_flags&VRF_USE_PAGING )   {       
                                VR_current_page = !VR_current_page;
                                gr_set_current_canvas( &VR_screen_pages[VR_current_page] );
@@ -1012,6 +1010,7 @@ void game_render_frame_mono(void)
                                                &VR_render_sub_buffer[0].cv_bitmap, 
                                                &VR_screen_pages[0].cv_bitmap );
                        }
+#if 0
                } else  {
                        #ifdef __MSDOS__
                                gr_ibitblt( &VR_render_buffer[0].cv_bitmap, &VR_screen_pages[0].cv_bitmap, Game_cockpit_copy_code );
@@ -1019,8 +1018,13 @@ void game_render_frame_mono(void)
                                gr_ibitblt( &VR_render_sub_buffer[0].cv_bitmap, &VR_screen_pages[0].cv_bitmap );
                        #endif
                }
+#endif
        }
 
+       update_cockpits(0);
+
+       show_extra_views();             //missile view, buddy bot, etc.
+
        if (Cockpit_mode==CM_FULL_COCKPIT || Cockpit_mode==CM_STATUS_BAR) {
 
                if ( (Newdemo_state == ND_STATE_PLAYBACK) )
@@ -1269,6 +1273,7 @@ void shrink_window()
 }
 
 int last_drawn_cockpit[2] = { -1, -1 };
+extern void ogl_loadbmtexture(grs_bitmap *bm); 
 
 // This actually renders the new cockpit onto the screen.
 void update_cockpits(int force_redraw)
@@ -1283,7 +1288,6 @@ void update_cockpits(int force_redraw)
        case CM_REAR_VIEW:
                gr_set_current_canvas(&VR_screen_pages[VR_current_page]);
                PIGGY_PAGE_IN(cockpit_bitmap[Cockpit_mode+(Current_display_mode?(Num_cockpits/2):0)]);
-
                gr_ubitmapm(0,0, &GameBitmaps[cockpit_bitmap[Cockpit_mode+(Current_display_mode?(Num_cockpits/2):0)].index]);   
                break;
 
@@ -1336,7 +1340,7 @@ void game_render_frame()
 {
        set_screen_mode( SCREEN_GAME );
 
-       update_cockpits(0);
+//     update_cockpits(0);
 
        play_homing_warning();