foxygit / doom Log in
commit 1a9dc27f4ef6b43316cb263ad15c36f3dde35338
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sat Sep 20 20:41:26 2008 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sat Sep 20 20:41:26 2008 +0000

    Replace all use of screens[0] by I_VideoBuffer.

    Subversion-branch: /branches/raven-branch
    Subversion-revision: 1249
---
 src/doom/am_map.c   |  5 +----
 src/doom/f_finale.c |  4 ++--
 src/doom/f_wipe.c   |  2 +-
 src/doom/g_game.c   |  4 ++--
 src/doom/r_draw.c   |  4 ++--
 src/doom/wi_stuff.c |  2 +-
 src/i_scale.c       |  2 +-
 src/i_video.c       |  1 -
 src/v_video.c       | 47 +++++++++++++++++++++++------------------------
 9 files changed, 33 insertions(+), 38 deletions(-)

diff --git a/src/doom/am_map.c b/src/doom/am_map.c
index e2b84e6d..115a1878 100644
--- a/src/doom/am_map.c
+++ b/src/doom/am_map.c
@@ -288,9 +288,6 @@ cheatseq_t cheat_amap = CHEAT("iddt", 0);
 static boolean stopped = true;

 extern boolean viewactive;
-//extern byte screens[][SCREENWIDTH*SCREENHEIGHT];
-
-

 void
 V_MarkRect
@@ -459,7 +456,7 @@ void AM_initVariables(void)
     static event_t st_notify = { ev_keyup, AM_MSGENTERED, 0, 0 };

     automapactive = true;
-    fb = screens[0];
+    fb = I_VideoBuffer;

     f_oldloc.x = INT_MAX;
     amclock = 0;
diff --git a/src/doom/f_finale.c b/src/doom/f_finale.c
index 974dc32e..586e096d 100644
--- a/src/doom/f_finale.c
+++ b/src/doom/f_finale.c
@@ -246,7 +246,7 @@ void F_TextWrite (void)

     // erase the entire screen to a tiled background
     src = W_CacheLumpName ( finaleflat , PU_CACHE);
-    dest = screens[0];
+    dest = I_VideoBuffer;

     for (y=0 ; y<SCREENHEIGHT ; y++)
     {
@@ -592,7 +592,7 @@ F_DrawPatchCol
     int		count;

     column = (column_t *)((byte *)patch + LONG(patch->columnofs[col]));
-    desttop = screens[0]+x;
+    desttop = I_VideoBuffer + x;

     // step through the posts in a column
     while (column->topdelta != 0xff )
diff --git a/src/doom/f_wipe.c b/src/doom/f_wipe.c
index 83cb8584..efc678ca 100644
--- a/src/doom/f_wipe.c
+++ b/src/doom/f_wipe.c
@@ -283,7 +283,7 @@ wipe_ScreenWipe
     {
 	go = 1;
 	// wipe_scr = (byte *) Z_Malloc(width*height, PU_STATIC, 0); // DEBUG
-	wipe_scr = screens[0];
+	wipe_scr = I_VideoBuffer;
 	(*wipes[wipeno*3])(width, height, ticks);
     }

diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index 221a898a..42587b15 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -305,14 +305,14 @@ void G_DrawMouseSpeedBox(void)
             color = COLOR_BLACK;
         }

-        screens[0][(box_y - 4) * SCREENWIDTH + box_x + x + 1] = color;
+        I_VideoBuffer[(box_y - 4) * SCREENWIDTH + box_x + x + 1] = color;
     }

     // Draw red line

     for (y=box_y - 8; y<box_y; ++y)
     {
-        screens[0][y * SCREENWIDTH + box_x + redline_x] = COLOR_RED;
+        I_VideoBuffer[y * SCREENWIDTH + box_x + redline_x] = COLOR_RED;
     }
 }

diff --git a/src/doom/r_draw.c b/src/doom/r_draw.c
index 58ef41bc..d75aec3b 100644
--- a/src/doom/r_draw.c
+++ b/src/doom/r_draw.c
@@ -791,7 +791,7 @@ R_InitBuffer

     // Preclaculate all row offsets.
     for (i=0 ; i<height ; i++)
-	ylookup[i] = screens[0] + (i+viewwindowy)*SCREENWIDTH;
+	ylookup[i] = I_VideoBuffer + (i+viewwindowy)*SCREENWIDTH;
 }


@@ -900,7 +900,7 @@ R_VideoErase
   //  is not optiomal, e.g. byte by byte on
   //  a 32bit CPU, as GNU GCC/Linux libc did
   //  at one point.
-    memcpy (screens[0]+ofs, screens[1]+ofs, count);
+    memcpy(I_VideoBuffer + ofs, screens[1] + ofs, count);
 }


diff --git a/src/doom/wi_stuff.c b/src/doom/wi_stuff.c
index e0e0ad24..85243d84 100644
--- a/src/doom/wi_stuff.c
+++ b/src/doom/wi_stuff.c
@@ -410,7 +410,7 @@ static patch_t**	lnames;

 void WI_slamBackground(void)
 {
-    memcpy(screens[0], screens[1], SCREENWIDTH * SCREENHEIGHT);
+    memcpy(I_VideoBuffer, screens[1], SCREENWIDTH * SCREENHEIGHT);
     V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
 }

diff --git a/src/i_scale.c b/src/i_scale.c
index de6eefc5..a2136d3d 100644
--- a/src/i_scale.c
+++ b/src/i_scale.c
@@ -38,7 +38,7 @@
 #define inline __inline
 #endif

-// Should be screens[0]
+// Should be I_VideoBuffer

 static byte *src_buffer;

diff --git a/src/i_video.c b/src/i_video.c
index ebfadc10..f3be13e9 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1617,7 +1617,6 @@ void I_InitGraphics(void)
                                                     PU_STATIC, NULL);
     }

-    screens[0] = I_VideoBuffer;
     V_RestoreBuffer();

     // "Loading from disk" icon
diff --git a/src/v_video.c b/src/v_video.c
index 5bb1c962..b9ca1645 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -47,11 +47,9 @@
 static byte *dest_screen = NULL;

 // Each screen is [SCREENWIDTH*SCREENHEIGHT];
-byte*				screens[5];
+byte *screens[5];

-int				dirtybox[4];
-
-
+int dirtybox[4];

 // Now where did these came from?
 const byte gammatable[5][256] =
@@ -366,7 +364,7 @@ void V_Init (void)

     for (i=0 ; i<4 ; i++)
     {
-	screens[i + 1] = base + i*SCREENWIDTH*SCREENHEIGHT;
+        screens[i + 1] = base + i*SCREENWIDTH*SCREENHEIGHT;
     }
 }

@@ -478,30 +476,31 @@ void WritePCXfile(char *filename, byte *data,

 void V_ScreenShot (void)
 {
-    int		i;
-    byte*	linear;
-    char	lbmname[12];
-
-    // munge planar buffer to linear
-    linear = screens[2];
-    I_ReadScreen (linear);
+    int i;
+    char lbmname[12];

     // find a file name to save it to
-    strcpy(lbmname,"DOOM00.pcx");
-
+
+    strcpy(lbmname, "DOOM00.pcx");
+
     for (i=0 ; i<=99 ; i++)
     {
-	lbmname[4] = i/10 + '0';
-	lbmname[5] = i%10 + '0';
-	if (!M_FileExists(lbmname))
-	    break;	// file doesn't exist
+        lbmname[4] = i / 10 + '0';
+        lbmname[5] = i % 10 + '0';
+        if (!M_FileExists(lbmname))
+        {
+            break;      // file doesn't exist
+        }
     }
-    if (i==100)
-	I_Error ("V_ScreenShot: Couldn't create a PCX");
-
+
+    if (i == 100)
+    {
+        I_Error ("V_ScreenShot: Couldn't create a PCX");
+    }
+
     // save the pcx file
-    WritePCXfile (lbmname, linear,
-		  SCREENWIDTH, SCREENHEIGHT,
-		  W_CacheLumpName (DEH_String("PLAYPAL"), PU_CACHE));
+    WritePCXfile(lbmname, I_VideoBuffer,
+                 SCREENWIDTH, SCREENHEIGHT,
+                 W_CacheLumpName (DEH_String("PLAYPAL"), PU_CACHE));
 }