Browse Source

Merge dx.cpp

pull/90/head
Anders Jenbo 7 years ago
parent
commit
897c090338
  1. 4
      Source/palette.cpp
  2. 2
      SourceX/DiabloUI/diabloui.cpp
  3. 28
      SourceX/dx.cpp

4
Source/palette.cpp

@ -229,8 +229,8 @@ void SetFadeLevel(DWORD fadeval)
// Workaround for flickering mouse in caves https://github.com/diasurgical/devilutionX/issues/7 // Workaround for flickering mouse in caves https://github.com/diasurgical/devilutionX/issues/7
SrcRect.left = 64; SrcRect.left = 64;
SrcRect.top = 160; SrcRect.top = 160;
SrcRect.right = 640 + 64; SrcRect.right = BUFFER_WIDTH;
SrcRect.bottom = 480 + 160; // menu isn't offset so make sure we copy all of it SrcRect.bottom = BUFFER_HEIGHT; // menu isn't offset so make sure we copy all of it
lpDDSPrimary->BltFast(0, 0, lpDDSBackBuf, &SrcRect, DDBLTFAST_WAIT); lpDDSPrimary->BltFast(0, 0, lpDDSBackBuf, &SrcRect, DDBLTFAST_WAIT);
lpDDSPrimary->Unlock(NULL); lpDDSPrimary->Unlock(NULL);
} }

2
SourceX/DiabloUI/diabloui.cpp

@ -515,7 +515,7 @@ BOOL UiCreatePlayerDescription(_uiheroinfo *info, DWORD mode, char *desc)
void DrawArt(int screenX, int screenY, Art *art, int nFrame, int drawW) void DrawArt(int screenX, int screenY, Art *art, int nFrame, int drawW)
{ {
BYTE *src = (BYTE *)art->data + (art->width * art->height * nFrame); BYTE *src = (BYTE *)art->data + (art->width * art->height * nFrame);
BYTE *dst = &gpBuffer[screenX + 64 + (screenY + 160) * 768]; BYTE *dst = &gpBuffer[screenX + 64 + (screenY + 160) * BUFFER_WIDTH];
drawW = drawW ? drawW : art->width; drawW = drawW ? drawW : art->width;
for (int i = 0; i < art->height && i + screenY < SCREEN_HEIGHT; i++, src += art->width, dst += ROW_PITCH) { for (int i = 0; i < art->height && i + screenY < SCREEN_HEIGHT; i++, src += art->width, dst += ROW_PITCH) {

28
SourceX/dx.cpp

@ -1,5 +1,5 @@
#include "devilution.h" #include "diablo.h"
#include "DiabloUI/diabloui.h" #include "../3rdParty/Storm/Source/storm.h"
#include "miniwin/ddraw.h" #include "miniwin/ddraw.h"
namespace dvl { namespace dvl {
@ -52,7 +52,9 @@ void dx_init(HWND hWnd)
#endif #endif
#endif #endif
#ifndef _DEBUG
fullscreen = true; fullscreen = true;
#endif
if (!fullscreen) { if (!fullscreen) {
#ifdef __cplusplus #ifdef __cplusplus
hDDVal = lpDDInterface->SetCooperativeLevel(hWnd, 0 | 0); hDDVal = lpDDInterface->SetCooperativeLevel(hWnd, 0 | 0);
@ -60,7 +62,7 @@ void dx_init(HWND hWnd)
hDDVal = lpDDInterface->lpVtbl->SetCooperativeLevel(lpDDInterface, hWnd, DDSCL_NORMAL | DDSCL_ALLOWREBOOT); hDDVal = lpDDInterface->lpVtbl->SetCooperativeLevel(lpDDInterface, hWnd, DDSCL_NORMAL | DDSCL_ALLOWREBOOT);
#endif #endif
if (hDDVal == 1) { if (hDDVal == 1) {
MI_Dummy(0); // v5 TriggerBreak();
} else if (hDDVal != DVL_S_OK) { } else if (hDDVal != DVL_S_OK) {
ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Diablo\\Direct\\dx.cpp", 155); ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Diablo\\Direct\\dx.cpp", 155);
} }
@ -72,22 +74,22 @@ void dx_init(HWND hWnd)
hDDVal = lpDDInterface->lpVtbl->SetCooperativeLevel(lpDDInterface, hWnd, DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT | DDSCL_FULLSCREEN); hDDVal = lpDDInterface->lpVtbl->SetCooperativeLevel(lpDDInterface, hWnd, DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT | DDSCL_FULLSCREEN);
#endif #endif
if (hDDVal == 1) { if (hDDVal == 1) {
MI_Dummy(0); // v5 TriggerBreak();
} else if (hDDVal != DVL_S_OK) { } else if (hDDVal != DVL_S_OK) {
ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Src\\Diablo\\Source\\dx.cpp", 170); ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Src\\Diablo\\Source\\dx.cpp", 170);
} }
#ifdef __cplusplus #ifdef __cplusplus
hDDVal = lpDDInterface->SetDisplayMode(640, 480, 8); hDDVal = lpDDInterface->SetDisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP);
#else #else
hDDVal = lpDDInterface->lpVtbl->SetDisplayMode(lpDDInterface, SCREEN_WIDTH, SCREEN_HEIGHT, 8); hDDVal = lpDDInterface->lpVtbl->SetDisplayMode(lpDDInterface, SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP);
#endif #endif
if (hDDVal != DVL_S_OK) { if (hDDVal != DVL_S_OK) {
winw = GetSystemMetrics(DVL_SM_CXSCREEN); winw = GetSystemMetrics(DVL_SM_CXSCREEN);
winh = GetSystemMetrics(DVL_SM_CYSCREEN); winh = GetSystemMetrics(DVL_SM_CYSCREEN);
#ifdef __cplusplus #ifdef __cplusplus
hDDVal = lpDDInterface->SetDisplayMode(winw, winh, 8); hDDVal = lpDDInterface->SetDisplayMode(winw, winh, SCREEN_BPP);
#else #else
hDDVal = lpDDInterface->lpVtbl->SetDisplayMode(lpDDInterface, winw, winh, 8); hDDVal = lpDDInterface->lpVtbl->SetDisplayMode(lpDDInterface, winw, winh, SCREEN_BPP);
#endif #endif
if (hDDVal != DVL_S_OK) { if (hDDVal != DVL_S_OK) {
ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Src\\Diablo\\Source\\dx.cpp", 183); ErrDlg(IDD_DIALOG1, hDDVal, "C:\\Src\\Diablo\\Source\\dx.cpp", 183);
@ -124,7 +126,7 @@ void dx_create_back_buffer()
#ifdef __cplusplus #ifdef __cplusplus
error_code = lpDDSPrimary->Lock(NULL, &ddsd, 0 | 0, NULL); error_code = lpDDSPrimary->Lock(NULL, &ddsd, 0 | 0, NULL);
#else #else
error_code = lpDDSPrimary->lpVtbl->Lock(lpDDSPrimary, NULL, &ddsd, 0 | 0, NULL); error_code = lpDDSPrimary->lpVtbl->Lock(lpDDSPrimary, NULL, &ddsd, DDLOCK_WRITEONLY | DDLOCK_WAIT, NULL);
#endif #endif
if (error_code == DVL_S_OK) { if (error_code == DVL_S_OK) {
#ifdef __cplusplus #ifdef __cplusplus
@ -140,12 +142,12 @@ void dx_create_back_buffer()
} }
memset(&ddsd, 0, sizeof(ddsd)); memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwWidth = 768; ddsd.dwWidth = BUFFER_WIDTH;
ddsd.lPitch = 768; ddsd.lPitch = BUFFER_WIDTH;
ddsd.dwSize = sizeof(ddsd); ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = 0 | 0 | 0 | 0 | 0; ddsd.dwFlags = 0 | 0 | 0 | 0 | 0;
ddsd.ddsCaps.dwCaps = 0 | 0; ddsd.ddsCaps.dwCaps = 0 | 0;
ddsd.dwHeight = 656; ddsd.dwHeight = BUFFER_HEIGHT;
ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat); ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
#ifdef __cplusplus #ifdef __cplusplus
error_code = lpDDSPrimary->GetPixelFormat(&ddsd.ddpfPixelFormat); error_code = lpDDSPrimary->GetPixelFormat(&ddsd.ddpfPixelFormat);
@ -233,7 +235,7 @@ void lock_buf_priv()
#ifdef __cplusplus #ifdef __cplusplus
error_code = lpDDSBackBuf->Lock(NULL, &ddsd, 0, NULL); error_code = lpDDSBackBuf->Lock(NULL, &ddsd, 0, NULL);
#else #else
error_code = lpDDSBackBuf->lpVtbl->Lock(lpDDSBackBuf, NULL, &ddsd, 0, NULL); error_code = lpDDSBackBuf->lpVtbl->Lock(lpDDSBackBuf, NULL, &ddsd, DDLOCK_WAIT, NULL);
#endif #endif
if (error_code != DVL_S_OK) if (error_code != DVL_S_OK)
DDErrMsg(error_code, 235, "C:\\Src\\Diablo\\Source\\dx.cpp"); DDErrMsg(error_code, 235, "C:\\Src\\Diablo\\Source\\dx.cpp");

Loading…
Cancel
Save