ref: 5ed6a965e39051b5b28a33f0fc14045565afc627
parent: 84d4d10702d06bd78a38dc9622c904c36260871c
author: Simon Howard <[email protected]>
date: Sat Sep 24 19:41:07 EDT 2005
Fix "loading" icon for all video modes Subversion-branch: /trunk/chocolate-doom Subversion-revision: 129
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@
Fixes for non-x86 architectures
Fix uac_dead.wad (platform drop on e1m8 should occur when all
bosses die, not just barons)
+ Fix "loading" icon to work for all graphics modes
0.0.3 (2005-09-17):
Mouse acceleration code to emulate the behaviour of old
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: i_video.c 126 2005-09-24 22:04:03Z fraggle $
+// $Id: i_video.c 129 2005-09-24 23:41:07Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.29 2005/09/24 23:41:07 fraggle
+// Fix "loading" icon for all video modes
+//
// Revision 1.28 2005/09/24 22:04:03 fraggle
// Add application icon to running program
//
@@ -124,7 +127,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: i_video.c 126 2005-09-24 22:04:03Z fraggle $";
+rcsid[] = "$Id: i_video.c 129 2005-09-24 23:41:07Z fraggle $";
#include <SDL.h>
#include <ctype.h>
@@ -242,57 +245,6 @@
screenvisible = (state & SDL_APPACTIVE) != 0;
}
-void I_BeginRead(void)
-{
- int y;
-
- if (disk_image == NULL)
- return;
-
- // save background and copy the disk image in
-
- for (y=0; y<disk_image_h; ++y)
- {
- byte *screenloc =
- screens[0]
- + (SCREENHEIGHT - 1 - disk_image_h + y) * SCREENWIDTH
- + (SCREENWIDTH - 1 - disk_image_w);
-
- memcpy(saved_background + y * disk_image_w,
- screenloc,
- disk_image_w);
- memcpy(screenloc, disk_image + y * disk_image_w, disk_image_w);
- }
-
- SDL_UpdateRect(screen,
- screen->w - disk_image_w, screen->h - disk_image_h,
- disk_image_w, disk_image_h);
-}
-
-void I_EndRead(void)
-{
- int y;
-
- if (disk_image == NULL)
- return;
-
- // save background and copy the disk image in
-
- for (y=0; y<disk_image_h; ++y)
- {
- byte *screenloc =
- screens[0]
- + (SCREENHEIGHT - 1 - disk_image_h + y) * SCREENWIDTH
- + (SCREENWIDTH - 1 - disk_image_w);
-
- memcpy(screenloc, saved_background + y * disk_image_w, disk_image_w);
- }
-
- SDL_UpdateRect(screen,
- screen->w - disk_image_w, screen->h - disk_image_h,
- disk_image_w, disk_image_h);
-}
-
static void LoadDiskImage(void)
{
patch_t *disk;
@@ -548,39 +500,21 @@
}
-//
-// I_FinishUpdate
-//
-void I_FinishUpdate (void)
+// Update a small portion of the screen
+
+static void UpdateArea(int x1, int y1, int x2, int y2, boolean always_update)
{
- static int lasttic;
- int tics;
- int i;
- // UNUSED static unsigned char *bigscreen=0;
+ int w = x2 - x1;
+ int h = y2 - y1;
- UpdateGrab();
-
- // Don't update the screen if the window isn't visible.
- // Not doing this breaks under Windows when we alt-tab away
- // while fullscreen.
-
- if (!(SDL_GetAppState() & SDL_APPACTIVE))
- return;
-
- // draws little dots on the bottom of the screen
- if (devparm)
+ if (palette_to_set && !always_update)
{
+ // If we have a palette to set, the only way to update is to
+ // update the entire screen
+ // If we are only updating part of the screen (disk icon), we
+ // cannot update the screen
- i = I_GetTime();
- tics = i - lasttic;
- lasttic = i;
- if (tics > 20) tics = 20;
-
- for (i=0 ; i<tics*2 ; i+=2)
- screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff;
- for ( ; i<20*2 ; i+=2)
- screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
-
+ return;
}
if (screenmultiply == 1 && !native_surface)
@@ -591,13 +525,13 @@
SDL_LockSurface(screen);
- bufp = screens[0];
- screenp = (byte *) screen->pixels;
pitch = screen->pitch;
+ bufp = screens[0] + y1 * SCREENWIDTH + x1;
+ screenp = (byte *) screen->pixels + y1 * pitch + x1;
- for (y=0; y<SCREENHEIGHT; ++y)
+ for (y=y1; y<y2; ++y)
{
- memcpy(screenp, bufp, SCREENWIDTH);
+ memcpy(screenp, bufp, w);
screenp += pitch;
bufp += SCREENWIDTH;
}
@@ -615,12 +549,12 @@
SDL_LockSurface(screen);
- bufp = screens[0];
- screenp = (byte *) screen->pixels;
- screenp2 = ((byte *) screen->pixels) + screen->pitch;
pitch = screen->pitch * 2;
+ bufp = screens[0] + y1 * SCREENWIDTH + x1;
+ screenp = (byte *) screen->pixels + (y1 * pitch) + (x1 * 2);
+ screenp2 = screenp + screen->pitch;
- for (y=0; y<SCREENHEIGHT; ++y)
+ for (y=y1; y<y2; ++y)
{
byte *sp, *sp2, *bp;
sp = screenp;
@@ -627,7 +561,7 @@
sp2 = screenp2;
bp = bufp;
- for (x=0; x<SCREENWIDTH; ++x)
+ for (x=x1; x<x2; ++x)
{
*sp2++ = *bp;
*sp2++ = *bp;
@@ -651,8 +585,101 @@
}
else
{
- SDL_Flip(screen);
+ SDL_UpdateRect(screen,
+ x1 * screenmultiply,
+ y1 * screenmultiply,
+ (x2-x1) * screenmultiply,
+ (y2-y1) * screenmultiply);
}
+}
+
+void I_BeginRead(void)
+{
+ int y;
+
+ if (disk_image == NULL)
+ return;
+
+ // save background and copy the disk image in
+
+ for (y=0; y<disk_image_h; ++y)
+ {
+ byte *screenloc =
+ screens[0]
+ + (SCREENHEIGHT - 1 - disk_image_h + y) * SCREENWIDTH
+ + (SCREENWIDTH - 1 - disk_image_w);
+
+ memcpy(saved_background + y * disk_image_w,
+ screenloc,
+ disk_image_w);
+ memcpy(screenloc, disk_image + y * disk_image_w, disk_image_w);
+ }
+
+ UpdateArea(SCREENWIDTH - disk_image_w, SCREENHEIGHT - disk_image_h,
+ SCREENWIDTH, SCREENHEIGHT,
+ false);
+}
+
+void I_EndRead(void)
+{
+ int y;
+
+ if (disk_image == NULL)
+ return;
+
+ // save background and copy the disk image in
+
+ for (y=0; y<disk_image_h; ++y)
+ {
+ byte *screenloc =
+ screens[0]
+ + (SCREENHEIGHT - 1 - disk_image_h + y) * SCREENWIDTH
+ + (SCREENWIDTH - 1 - disk_image_w);
+
+ memcpy(screenloc, saved_background + y * disk_image_w, disk_image_w);
+ }
+
+ UpdateArea(SCREENWIDTH - disk_image_w, SCREENHEIGHT - disk_image_h,
+ SCREENWIDTH, SCREENHEIGHT,
+ false);
+}
+
+//
+// I_FinishUpdate
+//
+void I_FinishUpdate (void)
+{
+ static int lasttic;
+ int tics;
+ int i;
+ // UNUSED static unsigned char *bigscreen=0;
+
+ UpdateGrab();
+
+ // Don't update the screen if the window isn't visible.
+ // Not doing this breaks under Windows when we alt-tab away
+ // while fullscreen.
+
+ if (!(SDL_GetAppState() & SDL_APPACTIVE))
+ return;
+
+ // draws little dots on the bottom of the screen
+ if (devparm)
+ {
+
+ i = I_GetTime();
+ tics = i - lasttic;
+ lasttic = i;
+ if (tics > 20) tics = 20;
+
+ for (i=0 ; i<tics*2 ; i+=2)
+ screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff;
+ for ( ; i<20*2 ; i+=2)
+ screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
+
+ }
+
+ UpdateArea(0, 0, SCREENWIDTH, SCREENHEIGHT, true);
}