Merge remote-tracking branch 'origin/master' into sdl2-branch
This commit is contained in:
commit
a44cef9789
9 changed files with 143 additions and 59 deletions
|
|
@ -8,9 +8,7 @@ include ../config.make
|
|||
|
||||
DOC_FILES += README.Strife NOT-BUGS
|
||||
|
||||
# Build so that the package will work on older versions.
|
||||
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.4
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.7
|
||||
|
||||
STAGING_DIR=staging
|
||||
DMG=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).dmg
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ char wadfile[1024]; // primary wad file
|
|||
char mapdir[1024]; // directory of development maps
|
||||
|
||||
int show_endoom = 1;
|
||||
int show_diskicon = 1;
|
||||
|
||||
|
||||
void D_ConnectNetGame(void);
|
||||
|
|
@ -215,7 +216,7 @@ void D_Display (void)
|
|||
break;
|
||||
if (automapactive)
|
||||
AM_Drawer ();
|
||||
if (wipe || (viewheight != SCREENHEIGHT && fullscreen) || disk_indicator == disk_dirty)
|
||||
if (wipe || (viewheight != SCREENHEIGHT && fullscreen))
|
||||
redrawsbar = true;
|
||||
if (inhelpscreensstate && !inhelpscreens)
|
||||
redrawsbar = true; // just put away the help screen
|
||||
|
|
@ -329,6 +330,27 @@ void D_Display (void)
|
|||
} while (!done);
|
||||
}
|
||||
|
||||
static void EnableLoadingDisk(void)
|
||||
{
|
||||
char *disk_lump_name;
|
||||
|
||||
if (show_diskicon)
|
||||
{
|
||||
if (M_CheckParm("-cdrom") > 0)
|
||||
{
|
||||
disk_lump_name = DEH_String("STCDROM");
|
||||
}
|
||||
else
|
||||
{
|
||||
disk_lump_name = DEH_String("STDISK");
|
||||
}
|
||||
|
||||
V_EnableLoadingDisk(disk_lump_name,
|
||||
SCREENWIDTH - LOADING_DISK_W,
|
||||
SCREENHEIGHT - LOADING_DISK_H);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Add configuration file variable bindings.
|
||||
//
|
||||
|
|
@ -428,7 +450,7 @@ void D_DoomLoop (void)
|
|||
I_GraphicsCheckCommandLine();
|
||||
I_SetGrabMouseCallback(D_GrabMouseCallback);
|
||||
I_InitGraphics();
|
||||
V_EnableLoadingDisk(SCREENWIDTH - LOADING_DISK_W, SCREENHEIGHT - LOADING_DISK_H);
|
||||
EnableLoadingDisk();
|
||||
|
||||
TryRunTics();
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "m_config.h"
|
||||
#include "m_misc.h"
|
||||
#include "tables.h"
|
||||
#include "v_diskicon.h"
|
||||
#include "v_video.h"
|
||||
#include "w_wad.h"
|
||||
#include "z_zone.h"
|
||||
|
|
@ -98,15 +99,6 @@ int usemouse = 1;
|
|||
|
||||
int png_screenshots = 0;
|
||||
|
||||
// Display disk activity indicator.
|
||||
|
||||
int show_diskicon = 1;
|
||||
|
||||
// Only display the disk icon if more then this much bytes have been read
|
||||
// during the previous tic.
|
||||
|
||||
int diskicon_readbytes = 0;
|
||||
|
||||
// Screen width and height, from configuration file.
|
||||
|
||||
int window_width = SCREENWIDTH * 2;
|
||||
|
|
@ -663,6 +655,9 @@ void I_FinishUpdate (void)
|
|||
I_VideoBuffer[ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
|
||||
}
|
||||
|
||||
// Draw disk icon before blit, if necessary.
|
||||
V_DrawDiskIcon();
|
||||
|
||||
if (palette_to_set)
|
||||
{
|
||||
SDL_SetPaletteColors(screenbuffer->format->palette, palette, 0, 256);
|
||||
|
|
@ -696,6 +691,9 @@ void I_FinishUpdate (void)
|
|||
// Draw!
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
// Restore background and undo the disk indicator, if it was drawn.
|
||||
V_RestoreDiskBackground();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,4 @@ extern int screen_height;
|
|||
extern int fullscreen;
|
||||
extern int aspect_ratio_correct;
|
||||
|
||||
extern int show_diskicon;
|
||||
extern int diskicon_readbytes;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -238,13 +238,6 @@ static void AdvancedDisplayConfig(TXT_UNCAST_ARG(widget),
|
|||
&show_endoom));
|
||||
}
|
||||
|
||||
if (gamemission == doom || gamemission == strife)
|
||||
{
|
||||
TXT_AddWidget(window,
|
||||
TXT_NewCheckBox("Show disk activity indicator",
|
||||
&show_diskicon));
|
||||
}
|
||||
|
||||
TXT_AddWidget(window,
|
||||
TXT_NewCheckBox("Save screenshots in PNG format",
|
||||
&png_screenshots));
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ char wadfile[1024]; // primary wad file
|
|||
char mapdir[1024]; // directory of development maps
|
||||
|
||||
int show_endoom = 1;
|
||||
int show_diskicon = 1;
|
||||
int graphical_startup = 1;
|
||||
|
||||
// If true, startup has completed and the main game loop has started.
|
||||
|
|
@ -302,7 +303,7 @@ void D_Display (void)
|
|||
// see if the border needs to be updated to the screen
|
||||
if (gamestate == GS_LEVEL && !automapactive && scaledviewwidth != 320)
|
||||
{
|
||||
if (menuactive || menuactivestate || !viewactivestate || disk_indicator == disk_dirty)
|
||||
if (menuactive || menuactivestate || !viewactivestate)
|
||||
{
|
||||
borderdrawcount = 3;
|
||||
popupactivestate = false;
|
||||
|
|
@ -513,7 +514,10 @@ void D_DoomLoop (void)
|
|||
I_InitGraphics();
|
||||
}
|
||||
|
||||
V_EnableLoadingDisk(SCREENWIDTH - LOADING_DISK_W, 0);
|
||||
if (show_diskicon)
|
||||
{
|
||||
V_EnableLoadingDisk("STDISK", SCREENWIDTH - LOADING_DISK_W, 3);
|
||||
}
|
||||
I_SetGrabMouseCallback(D_GrabMouseCallback);
|
||||
|
||||
V_RestoreBuffer();
|
||||
|
|
|
|||
119
src/v_diskicon.c
119
src/v_diskicon.c
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "deh_str.h"
|
||||
#include "i_swap.h"
|
||||
#include "i_video.h"
|
||||
#include "m_argv.h"
|
||||
#include "v_video.h"
|
||||
#include "w_wad.h"
|
||||
|
|
@ -25,37 +27,116 @@
|
|||
|
||||
#include "v_diskicon.h"
|
||||
|
||||
// disk image patch (either STDISK or STCDROM)
|
||||
// Only display the disk icon if more then this much bytes have been read
|
||||
// during the previous tic.
|
||||
|
||||
static patch_t *disk;
|
||||
static const int diskicon_threshold = 20*1024;
|
||||
|
||||
// Two buffers: disk_data contains the data representing the disk icon
|
||||
// (raw, not a patch_t) while saved_background is an equivalently-sized
|
||||
// buffer where we save the background data while the disk is on screen.
|
||||
static byte *disk_data;
|
||||
static byte *saved_background;
|
||||
|
||||
static int loading_disk_xoffs = 0;
|
||||
static int loading_disk_yoffs = 0;
|
||||
|
||||
disk_indicator_e disk_indicator = disk_off;
|
||||
// Number of bytes read since the last call to V_DrawDiskIcon().
|
||||
static size_t recent_bytes_read = 0;
|
||||
static boolean disk_drawn;
|
||||
|
||||
void V_EnableLoadingDisk(int xoffs, int yoffs)
|
||||
static void CopyRegion(byte *dest, int dest_pitch,
|
||||
byte *src, int src_pitch,
|
||||
int w, int h)
|
||||
{
|
||||
char *disk_name;
|
||||
byte *s, *d;
|
||||
int y;
|
||||
|
||||
s = src; d = dest;
|
||||
for (y = 0; y < h; ++y)
|
||||
{
|
||||
memcpy(d, s, w);
|
||||
s += src_pitch;
|
||||
d += dest_pitch;
|
||||
}
|
||||
}
|
||||
|
||||
static void SaveDiskData(char *disk_lump, int xoffs, int yoffs)
|
||||
{
|
||||
byte *tmpscreen;
|
||||
patch_t *disk;
|
||||
|
||||
// Allocate a complete temporary screen where we'll draw the patch.
|
||||
tmpscreen = Z_Malloc(SCREENWIDTH * SCREENHEIGHT, PU_STATIC, NULL);
|
||||
memset(tmpscreen, 0, SCREENWIDTH * SCREENHEIGHT);
|
||||
V_UseBuffer(tmpscreen);
|
||||
|
||||
// Buffer where we'll save the disk data.
|
||||
disk_data = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H, PU_STATIC, NULL);
|
||||
|
||||
// Draw the patch and save the result to disk_data.
|
||||
disk = W_CacheLumpName(disk_lump, PU_STATIC);
|
||||
V_DrawPatch(loading_disk_xoffs, loading_disk_yoffs, disk);
|
||||
CopyRegion(disk_data, LOADING_DISK_W,
|
||||
tmpscreen + yoffs * SCREENWIDTH + xoffs, SCREENWIDTH,
|
||||
LOADING_DISK_W, LOADING_DISK_H);
|
||||
W_ReleaseLumpName(disk_lump);
|
||||
|
||||
V_RestoreBuffer();
|
||||
Z_Free(tmpscreen);
|
||||
}
|
||||
|
||||
void V_EnableLoadingDisk(char *lump_name, int xoffs, int yoffs)
|
||||
{
|
||||
loading_disk_xoffs = xoffs;
|
||||
loading_disk_yoffs = yoffs;
|
||||
|
||||
if (M_CheckParm("-cdrom") > 0)
|
||||
disk_name = DEH_String("STCDROM");
|
||||
else
|
||||
disk_name = DEH_String("STDISK");
|
||||
|
||||
disk = W_CacheLumpName(disk_name, PU_STATIC);
|
||||
saved_background = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H, PU_STATIC,
|
||||
NULL);
|
||||
SaveDiskData(lump_name, xoffs, yoffs);
|
||||
}
|
||||
|
||||
void V_BeginRead(void)
|
||||
void V_BeginRead(size_t nbytes)
|
||||
{
|
||||
if (disk == NULL)
|
||||
return;
|
||||
|
||||
// Draw the disk to the screen
|
||||
V_DrawPatch(loading_disk_xoffs, loading_disk_yoffs, disk);
|
||||
|
||||
disk_indicator = disk_dirty;
|
||||
recent_bytes_read += nbytes;
|
||||
}
|
||||
|
||||
static byte *DiskRegionPointer(void)
|
||||
{
|
||||
return I_VideoBuffer
|
||||
+ loading_disk_yoffs * SCREENWIDTH
|
||||
+ loading_disk_xoffs;
|
||||
}
|
||||
|
||||
void V_DrawDiskIcon(void)
|
||||
{
|
||||
if (disk_data != NULL && recent_bytes_read > diskicon_threshold)
|
||||
{
|
||||
// Save the background behind the disk before we draw it.
|
||||
CopyRegion(saved_background, LOADING_DISK_W,
|
||||
DiskRegionPointer(), SCREENWIDTH,
|
||||
LOADING_DISK_W, LOADING_DISK_H);
|
||||
|
||||
// Write the disk to the screen buffer.
|
||||
CopyRegion(DiskRegionPointer(), SCREENWIDTH,
|
||||
disk_data, LOADING_DISK_W,
|
||||
LOADING_DISK_W, LOADING_DISK_H);
|
||||
disk_drawn = true;
|
||||
}
|
||||
|
||||
recent_bytes_read = 0;
|
||||
}
|
||||
|
||||
void V_RestoreDiskBackground(void)
|
||||
{
|
||||
if (disk_drawn)
|
||||
{
|
||||
// Restore the background.
|
||||
CopyRegion(DiskRegionPointer(), SCREENWIDTH,
|
||||
saved_background, LOADING_DISK_W,
|
||||
LOADING_DISK_W, LOADING_DISK_H);
|
||||
|
||||
disk_drawn = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,16 +24,9 @@
|
|||
#define LOADING_DISK_W 16
|
||||
#define LOADING_DISK_H 16
|
||||
|
||||
typedef enum
|
||||
{
|
||||
disk_off,
|
||||
disk_on,
|
||||
disk_dirty
|
||||
} disk_indicator_e;
|
||||
|
||||
extern disk_indicator_e disk_indicator;
|
||||
|
||||
extern void V_EnableLoadingDisk (int xoffs, int yoffs);
|
||||
extern void V_BeginRead (void);
|
||||
extern void V_EnableLoadingDisk(char *lump_name, int xoffs, int yoffs);
|
||||
extern void V_BeginRead(size_t nbytes);
|
||||
extern void V_DrawDiskIcon(void);
|
||||
extern void V_RestoreDiskBackground(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -348,9 +348,7 @@ void W_ReadLump(lumpindex_t lump, void *dest)
|
|||
|
||||
l = lumpinfo[lump];
|
||||
|
||||
diskicon_readbytes += l->size;
|
||||
|
||||
disk_indicator = disk_on;
|
||||
V_BeginRead(l->size);
|
||||
|
||||
c = W_Read(l->wad_file, l->position, dest, l->size);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue