summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2009-09-10 20:28:59 +0000
committerSimon Howard2009-09-10 20:28:59 +0000
commit100b658b470ecaf9ff5e2c3407bfff224e91fb01 (patch)
treeb04f71ab6203c38f7a5f9039c8ad0b69ac280848 /src
parentba1accec2394c6ee70c5c79a42827099ef20e638 (diff)
parentbe3bba2a1cf9551778683e25f61bffc7c187f93c (diff)
downloadchocolate-doom-100b658b470ecaf9ff5e2c3407bfff224e91fb01.tar.gz
chocolate-doom-100b658b470ecaf9ff5e2c3407bfff224e91fb01.tar.bz2
chocolate-doom-100b658b470ecaf9ff5e2c3407bfff224e91fb01.zip
Merge from trunk.
Subversion-branch: /branches/opl-branch Subversion-revision: 1662
Diffstat (limited to 'src')
-rw-r--r--src/i_main.c4
-rw-r--r--src/i_sdlsound.c7
-rw-r--r--src/i_video.c65
-rw-r--r--src/w_file_win32.c2
4 files changed, 46 insertions, 32 deletions
diff --git a/src/i_main.c b/src/i_main.c
index 03f8a5ac..cdfb531a 100644
--- a/src/i_main.c
+++ b/src/i_main.c
@@ -47,7 +47,7 @@ static void LockCPUAffinity(void)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-typedef BOOL WINAPI (*SetAffinityFunc)(HANDLE hProcess, DWORD_PTR mask);
+typedef BOOL (WINAPI *SetAffinityFunc)(HANDLE hProcess, DWORD mask);
// This is a bit more complicated than it really needs to be. We really
// just need to call the SetProcessAffinityMask function, but that
@@ -74,7 +74,7 @@ static void LockCPUAffinity(void)
// Find the SetProcessAffinityMask function.
- SetAffinity = GetProcAddress(kernel32_dll, "SetProcessAffinityMask");
+ SetAffinity = (SetAffinityFunc)GetProcAddress(kernel32_dll, "SetProcessAffinityMask");
// If the function was not found, we are on an old (Win9x) system
// that doesn't have this function. That's no problem, because
diff --git a/src/i_sdlsound.c b/src/i_sdlsound.c
index bb8229e4..ea5c92a5 100644
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -275,12 +275,15 @@ static boolean LoadSoundLump(int sound,
uint32_t *length,
byte **data_ref)
{
+ int lumplen;
+ byte *data;
+
// Load the sound
*lumpnum = S_sfx[sound].lumpnum;
*data_ref = W_CacheLumpNum(*lumpnum, PU_STATIC);
- int lumplen = W_LumpLength(*lumpnum);
- byte *data = *data_ref;
+ lumplen = W_LumpLength(*lumpnum);
+ data = *data_ref;
// Ensure this is a valid sound
diff --git a/src/i_video.c b/src/i_video.c
index 3412051b..582a7fa7 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -50,6 +50,9 @@
#include "w_wad.h"
#include "z_zone.h"
+#define LOADING_DISK_W 16
+#define LOADING_DISK_H 16
+
// Non aspect ratio-corrected modes (direct multiples of 320x200)
static screen_mode_t *screen_modes[] = {
@@ -145,7 +148,6 @@ boolean screenvisible;
// restored by EndRead
static byte *disk_image = NULL;
-static int disk_image_w, disk_image_h;
static byte *saved_background;
static boolean window_focused;
@@ -258,6 +260,8 @@ static void LoadDiskImage(void)
patch_t *disk;
char *disk_name;
int y;
+ int xoffset = SCREENWIDTH - LOADING_DISK_W;
+ int yoffset = SCREENHEIGHT - LOADING_DISK_H;
char buf[20];
SDL_VideoDriverName(buf, 15);
@@ -278,19 +282,20 @@ static void LoadDiskImage(void)
disk = W_CacheLumpName(disk_name, PU_STATIC);
- V_DrawPatch(0, 0, 0, disk);
- disk_image_w = SHORT(disk->width);
- disk_image_h = SHORT(disk->height);
+ // Draw the disk to the screen:
+
+ V_DrawPatch(SCREENWIDTH - LOADING_DISK_W,
+ SCREENHEIGHT - LOADING_DISK_H,
+ 0, disk);
- disk_image = Z_Malloc(disk_image_w * disk_image_h, PU_STATIC, NULL);
- saved_background = Z_Malloc(disk_image_w * disk_image_h, PU_STATIC, NULL);
+ disk_image = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H, PU_STATIC, NULL);
+ saved_background = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H, PU_STATIC, NULL);
- for (y=0; y<disk_image_h; ++y)
+ for (y=0; y<LOADING_DISK_H; ++y)
{
- memcpy(disk_image + disk_image_w * y,
- screens[0] + SCREENWIDTH * y,
- disk_image_w);
- memset(screens[0] + SCREENWIDTH * y, 0, disk_image_w);
+ memcpy(disk_image + LOADING_DISK_W * y,
+ screens[0] + SCREENWIDTH * (y + yoffset) + xoffset,
+ LOADING_DISK_W);
}
W_ReleaseLumpName(disk_name);
@@ -731,6 +736,9 @@ static void UpdateRect(int x1, int y1, int x2, int y2)
void I_BeginRead(void)
{
+ byte *screenloc = screens[0]
+ + (SCREENHEIGHT - LOADING_DISK_H) * SCREENWIDTH
+ + (SCREENWIDTH - LOADING_DISK_W);
int y;
if (!initialised || disk_image == NULL)
@@ -738,25 +746,27 @@ void I_BeginRead(void)
// save background and copy the disk image in
- for (y=0; y<disk_image_h; ++y)
+ for (y=0; y<LOADING_DISK_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,
+ memcpy(saved_background + y * LOADING_DISK_W,
screenloc,
- disk_image_w);
- memcpy(screenloc, disk_image + y * disk_image_w, disk_image_w);
+ LOADING_DISK_W);
+ memcpy(screenloc,
+ disk_image + y * LOADING_DISK_W,
+ LOADING_DISK_W);
+
+ screenloc += SCREENWIDTH;
}
- UpdateRect(SCREENWIDTH - disk_image_w, SCREENHEIGHT - disk_image_h,
+ UpdateRect(SCREENWIDTH - LOADING_DISK_W, SCREENHEIGHT - LOADING_DISK_H,
SCREENWIDTH, SCREENHEIGHT);
}
void I_EndRead(void)
{
+ byte *screenloc = screens[0]
+ + (SCREENHEIGHT - LOADING_DISK_H) * SCREENWIDTH
+ + (SCREENWIDTH - LOADING_DISK_W);
int y;
if (!initialised || disk_image == NULL)
@@ -764,17 +774,16 @@ void I_EndRead(void)
// save background and copy the disk image in
- for (y=0; y<disk_image_h; ++y)
+ for (y=0; y<LOADING_DISK_H; ++y)
{
- byte *screenloc =
- screens[0]
- + (SCREENHEIGHT - 1 - disk_image_h + y) * SCREENWIDTH
- + (SCREENWIDTH - 1 - disk_image_w);
+ memcpy(screenloc,
+ saved_background + y * LOADING_DISK_W,
+ LOADING_DISK_W);
- memcpy(screenloc, saved_background + y * disk_image_w, disk_image_w);
+ screenloc += SCREENWIDTH;
}
- UpdateRect(SCREENWIDTH - disk_image_w, SCREENHEIGHT - disk_image_h,
+ UpdateRect(SCREENWIDTH - LOADING_DISK_W, SCREENHEIGHT - LOADING_DISK_H,
SCREENWIDTH, SCREENHEIGHT);
}
diff --git a/src/w_file_win32.c b/src/w_file_win32.c
index ec17cf6c..9e5d963f 100644
--- a/src/w_file_win32.c
+++ b/src/w_file_win32.c
@@ -28,6 +28,8 @@
#ifdef _WIN32
+#include <stdio.h>
+
#define WIN32_LEAN_AND_MEAN
#include <windows.h>