mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-23 20:17:58 -04:00
bring back the flashing disk icon (#35)
* bring back the flashing disk icon (Fixes #13) * further refinements to the disk icon code * get away with only one static variable * add a non hires-scaling variant of V_DrawBlock() * add a comment to the new function prototype
This commit is contained in:
parent
de664b2669
commit
1f41cbee4b
@ -676,6 +676,9 @@ boolean noblit;
|
|||||||
static int in_graphics_mode;
|
static int in_graphics_mode;
|
||||||
static int in_page_flip, in_hires;
|
static int in_page_flip, in_hires;
|
||||||
|
|
||||||
|
static void I_DrawDiskIcon(), I_RestoreDiskBackground();
|
||||||
|
static boolean disk_to_draw;
|
||||||
|
|
||||||
void I_FinishUpdate(void)
|
void I_FinishUpdate(void)
|
||||||
{
|
{
|
||||||
if (noblit || !in_graphics_mode)
|
if (noblit || !in_graphics_mode)
|
||||||
@ -720,6 +723,8 @@ void I_FinishUpdate(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
I_DrawDiskIcon();
|
||||||
|
|
||||||
SDL_BlitSurface(sdlscreen, NULL, argbbuffer, NULL);
|
SDL_BlitSurface(sdlscreen, NULL, argbbuffer, NULL);
|
||||||
|
|
||||||
SDL_UpdateTexture(texture, NULL, argbbuffer->pixels, argbbuffer->pitch);
|
SDL_UpdateTexture(texture, NULL, argbbuffer->pixels, argbbuffer->pitch);
|
||||||
@ -727,6 +732,8 @@ void I_FinishUpdate(void)
|
|||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
|
||||||
|
I_RestoreDiskBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -747,30 +754,26 @@ void I_ReadScreen(byte *scr)
|
|||||||
|
|
||||||
int disk_icon;
|
int disk_icon;
|
||||||
|
|
||||||
#if 0
|
static byte *diskflash, *old_data;
|
||||||
static BITMAP *diskflash, *old_data;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void I_InitDiskFlash(void)
|
static void I_InitDiskFlash(void)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
byte temp[32*32];
|
byte temp[32*32];
|
||||||
|
|
||||||
if (diskflash)
|
if (diskflash)
|
||||||
{
|
{
|
||||||
destroy_bitmap(diskflash);
|
free(diskflash);
|
||||||
destroy_bitmap(old_data);
|
free(old_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
diskflash = create_bitmap_ex(8, 16<<hires, 16<<hires);
|
diskflash = malloc((16<<hires) * (16<<hires) * sizeof(*diskflash));
|
||||||
old_data = create_bitmap_ex(8, 16<<hires, 16<<hires);
|
old_data = malloc((16<<hires) * (16<<hires) * sizeof(*old_data));
|
||||||
|
|
||||||
V_GetBlock(0, 0, 0, 16, 16, temp);
|
V_GetBlock(0, 0, 0, 16, 16, temp);
|
||||||
V_DrawPatchDirect(0, 0, 0, W_CacheLumpName(M_CheckParm("-cdrom") ?
|
V_DrawPatchDirect(0, 0, 0, W_CacheLumpName(M_CheckParm("-cdrom") ?
|
||||||
"STCDROM" : "STDISK", PU_CACHE));
|
"STCDROM" : "STDISK", PU_CACHE));
|
||||||
V_GetBlock(0, 0, 0, 16, 16, diskflash->line[0]);
|
V_GetBlock(0, 0, 0, 16, 16, diskflash);
|
||||||
V_DrawBlock(0, 0, 0, 16, 16, temp);
|
V_DrawBlock(0, 0, 0, 16, 16, temp);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -779,18 +782,19 @@ static void I_InitDiskFlash(void)
|
|||||||
|
|
||||||
void I_BeginRead(void)
|
void I_BeginRead(void)
|
||||||
{
|
{
|
||||||
#if 0
|
disk_to_draw = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void I_DrawDiskIcon(void)
|
||||||
|
{
|
||||||
if (!disk_icon || !in_graphics_mode)
|
if (!disk_icon || !in_graphics_mode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
blit(screen, old_data,
|
if (disk_to_draw)
|
||||||
(SCREENWIDTH-16) << hires,
|
{
|
||||||
scroll_offset + ((SCREENHEIGHT-16)<<hires),
|
V_GetBlock(SCREENWIDTH-16, SCREENHEIGHT-16, 0, 16, 16, old_data);
|
||||||
0, 0, 16 << hires, 16 << hires);
|
V_PutBlock(SCREENWIDTH-16, SCREENHEIGHT-16, 0, 16, 16, diskflash);
|
||||||
|
}
|
||||||
blit(diskflash, screen, 0, 0, (SCREENWIDTH-16) << hires,
|
|
||||||
scroll_offset + ((SCREENHEIGHT-16)<<hires), 16 << hires, 16 << hires);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -799,13 +803,20 @@ void I_BeginRead(void)
|
|||||||
|
|
||||||
void I_EndRead(void)
|
void I_EndRead(void)
|
||||||
{
|
{
|
||||||
#if 0
|
// [FG] posponed to next tic
|
||||||
|
}
|
||||||
|
|
||||||
|
static void I_RestoreDiskBackground(void)
|
||||||
|
{
|
||||||
if (!disk_icon || !in_graphics_mode)
|
if (!disk_icon || !in_graphics_mode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
blit(old_data, screen, 0, 0, (SCREENWIDTH-16) << hires,
|
if (disk_to_draw)
|
||||||
scroll_offset + ((SCREENHEIGHT-16)<<hires), 16 << hires, 16 << hires);
|
{
|
||||||
#endif
|
V_PutBlock(SCREENWIDTH-16, SCREENHEIGHT-16, 0, 16, 16, old_data);
|
||||||
|
|
||||||
|
disk_to_draw = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_SetPalette(byte *palette)
|
void I_SetPalette(byte *palette)
|
||||||
@ -944,6 +955,8 @@ static void I_InitGraphicsMode(void)
|
|||||||
I_Error("Error creating window for video startup: %s",
|
I_Error("Error creating window for video startup: %s",
|
||||||
SDL_GetError());
|
SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_SetWindowTitle(screen, PACKAGE_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SetWindowMinimumSize(screen, v_w, actualheight);
|
SDL_SetWindowMinimumSize(screen, v_w, actualheight);
|
||||||
@ -1078,8 +1091,6 @@ static void I_InitGraphicsMode(void)
|
|||||||
|
|
||||||
V_Init();
|
V_Init();
|
||||||
|
|
||||||
SDL_SetWindowTitle(screen, PACKAGE_STRING);
|
|
||||||
|
|
||||||
UpdateGrab();
|
UpdateGrab();
|
||||||
|
|
||||||
in_graphics_mode = 1;
|
in_graphics_mode = 1;
|
||||||
|
@ -667,6 +667,34 @@ void V_GetBlock(int x, int y, int scrn, int width, int height, byte *dest)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [FG] non hires-scaling variant of V_DrawBlock, used in disk icon drawing
|
||||||
|
|
||||||
|
void V_PutBlock(int x, int y, int scrn, int width, int height, byte *src)
|
||||||
|
{
|
||||||
|
byte *dest;
|
||||||
|
|
||||||
|
#ifdef RANGECHECK
|
||||||
|
if (x<0
|
||||||
|
||x+width >SCREENWIDTH
|
||||||
|
|| y<0
|
||||||
|
|| y+height>SCREENHEIGHT
|
||||||
|
|| (unsigned)scrn>4 )
|
||||||
|
I_Error ("Bad V_DrawBlock");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (hires)
|
||||||
|
y<<=2, x<<=1, width<<=1, height<<=1;
|
||||||
|
|
||||||
|
dest = screens[scrn] + y*SCREENWIDTH+x;
|
||||||
|
|
||||||
|
while (height--)
|
||||||
|
{
|
||||||
|
memcpy (dest, src, width);
|
||||||
|
dest += SCREENWIDTH << hires;
|
||||||
|
src += width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// V_Init
|
// V_Init
|
||||||
//
|
//
|
||||||
|
@ -118,6 +118,10 @@ void V_DrawBlock(int x, int y, int scrn, int width, int height, byte *src);
|
|||||||
|
|
||||||
void V_GetBlock(int x, int y, int scrn, int width, int height, byte *dest);
|
void V_GetBlock(int x, int y, int scrn, int width, int height, byte *dest);
|
||||||
|
|
||||||
|
// [FG] non hires-scaling variant of V_DrawBlock, used in disk icon drawing
|
||||||
|
|
||||||
|
void V_PutBlock(int x, int y, int scrn, int width, int height, byte *src);
|
||||||
|
|
||||||
#define V_MarkRect(x,y,width,height) /* killough 11/98: unused */
|
#define V_MarkRect(x,y,width,height) /* killough 11/98: unused */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user