[chocolate-doom] 38/83: Only change palette on screen updates

Jonathan Dowland jmtd at moszumanska.debian.org
Mon Jan 30 15:06:24 UTC 2017


This is an automated email from the git hooks/post-receive script.

jmtd pushed a commit to annotated tag chocolate-doom-0.0.1
in repository chocolate-doom.

commit 89ac13b4f2bf950bec584fe8adc4aa1c8748c3e2
Author: Simon Howard <fraggle at gmail.com>
Date:   Sat Aug 6 17:30:30 2005 +0000

    Only change palette on screen updates
    
    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 44
---
 src/i_video.c | 37 ++++++++++++++++++++++++++++---------
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/src/i_video.c b/src/i_video.c
index 0239b96..9b285e3 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.c 40 2005-08-04 22:23:07Z fraggle $
+// $Id: i_video.c 44 2005-08-06 17:30:30Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.14  2005/08/06 17:30:30  fraggle
+// Only change palette on screen updates
+//
 // Revision 1.13  2005/08/04 22:23:07  fraggle
 // Use zone memory function.  Add command line options
 //
@@ -72,7 +75,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_video.c 40 2005-08-04 22:23:07Z fraggle $";
+rcsid[] = "$Id: i_video.c 44 2005-08-06 17:30:30Z fraggle $";
 
 #include <ctype.h>
 #include <SDL.h>
@@ -92,6 +95,10 @@ static SDL_Surface *screen;
 
 #define POINTER_WARP_COUNTDOWN	1
 
+// palette
+static SDL_Color palette[256];
+static boolean palette_to_set;
+
 // Fake mouse handling.
 // This cannot work properly w/o DGA.
 // Needs an invisible mouse cursor at least.
@@ -594,7 +601,15 @@ void I_FinishUpdate (void)
 
     // draw to screen
     
-    SDL_Flip(screen);
+    if (palette_to_set)
+    {
+        SDL_SetColors(screen, palette, 0, 256);
+        palette_to_set = 0;
+    }
+    else
+    {
+        SDL_Flip(screen);
+    }
 }
 
 
@@ -610,19 +625,18 @@ void I_ReadScreen (byte* scr)
 //
 // I_SetPalette
 //
-void I_SetPalette (byte* palette)
+void I_SetPalette (byte *doompalette)
 {
-    SDL_Color sdl_palette[256];
     int i;
 
     for (i=0; i<256; ++i) 
     {
-        sdl_palette[i].r = *palette++;
-        sdl_palette[i].g = *palette++;
-        sdl_palette[i].b = *palette++;
+        palette[i].r = *doompalette++;
+        palette[i].g = *doompalette++;
+        palette[i].b = *doompalette++;
     }
 
-    SDL_SetColors(screen, sdl_palette, 0, 256);
+    palette_to_set = 1;
 }
 
 
@@ -665,6 +679,11 @@ void I_InitGraphics(void)
     SDL_WM_GrabInput(SDL_GRAB_ON);
 
     LoadDiskImage();
+
+    {
+        SDL_Event dummy;
+        while (SDL_PollEvent(&dummy));
+    }
 }
 
 unsigned	exptable[256];

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/chocolate-doom.git



More information about the Pkg-games-commits mailing list