From 58c03018033b62705982fe82987f71c53a3f994b Mon Sep 17 00:00:00 2001 From: Troye Date: Fri, 5 May 2023 17:16:37 -0500 Subject: [PATCH 1/5] fix sliders; fix times fmv thingy; --- CHANGELOG.md | 13 +++++++++++++ TOMB4/game/gameflow.cpp | 2 ++ TOMB4/specific/drawbars.cpp | 8 ++++---- TOMB4/specific/winmain.cpp | 2 ++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dcd2edd..8c1a7749 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # tomb4 changelog +## Unreleased + +### Original bug fixes + + +### tomb4 bug fixes + +- Fix volume bars drawing on certain GPUs. +- Fix FMV message with the Times level. + +### new tomb4 features + + ## [2.2.0](https://github.com/Trxyebeep/TOMB4/tree/V2.2.0) (May. 5 2023) ### Original bug fixes diff --git a/TOMB4/game/gameflow.cpp b/TOMB4/game/gameflow.cpp index 72f825dc..89f7bfaa 100644 --- a/TOMB4/game/gameflow.cpp +++ b/TOMB4/game/gameflow.cpp @@ -932,8 +932,10 @@ void DoTitle(uchar Name, uchar Audio) bUseSpotCam = 0; bDisableLaraControl = 0; +#ifndef TIMES_LEVEL if (gfLevelComplete == 1 && gfStatus != 2) PlayFmvNow(12); +#endif if (gfStatus != 4) RenderLoadPic(0); diff --git a/TOMB4/specific/drawbars.cpp b/TOMB4/specific/drawbars.cpp index 04ac0125..39083d37 100644 --- a/TOMB4/specific/drawbars.cpp +++ b/TOMB4/specific/drawbars.cpp @@ -491,15 +491,15 @@ void DoSlider(long x, long y, long width, long height, long pos, long c1, long c tex.v3 = V + 0.01F; tex.u4 = 0; tex.v4 = V + 0.01F; - DrawColoredRect(sx, sy, sx + w, sy + h, f_mznear, c1, c1, c2, c2, &tex); - DrawColoredRect(sx, sy + h, sx + w, sy + (h * 2), f_mznear, c2, c2, c1, c1, &tex); + DrawColoredRect(sx, sy, sx + w, sy + h, f_mznear + 2, c1, c1, c2, c2, &tex); + DrawColoredRect(sx, sy + h, sx + w, sy + (h * 2), f_mznear + 2, c2, c2, c1, c1, &tex); tex.tpage = 0; - DrawColoredRect(sx - 1, sy - 1, sx + w + 1, sy + (h * 2) + 1, f_mznear + 2, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, &tex); + DrawColoredRect(sx - 1, sy - 1, sx + w + 1, sy + (h * 2) + 1, f_mznear + 4, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, &tex); w = pos * w / 100; tex.drawtype = 2; - DrawColoredRect(sx, sy, sx + w + 1, sy + (h * 2), f_mznear - 1, c3, c3, c3, c3, &tex); + DrawColoredRect(sx, sy, sx + w + 1, sy + (h * 2), f_mznear + 1, c3, c3, c3, c3, &tex); } void S_InitLoadBar(long maxpos) diff --git a/TOMB4/specific/winmain.cpp b/TOMB4/specific/winmain.cpp index 414334e9..5df0880c 100644 --- a/TOMB4/specific/winmain.cpp +++ b/TOMB4/specific/winmain.cpp @@ -533,6 +533,7 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmd LoadSettings(); } +#ifndef TIMES_LEVEL if (!fmvs_disabled) { if (!LoadBinkStuff()) @@ -541,6 +542,7 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmd fmvs_disabled = 1; } } +#endif SetWindowPos(App.hWnd, 0, App.dx.rScreen.left, App.dx.rScreen.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); desktop = GetDesktopWindow(); From 95d2281e3e4e73d918b8cafd30b3b97e300ddd6f Mon Sep 17 00:00:00 2001 From: Troye Date: Sat, 6 May 2023 03:04:07 -0500 Subject: [PATCH 2/5] fix slider pos --- CHANGELOG.md | 1 + TOMB4/specific/drawbars.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c1a7749..dee1969a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### tomb4 bug fixes - Fix volume bars drawing on certain GPUs. +- Fix volume bars screen position. - Fix FMV message with the Times level. ### new tomb4 features diff --git a/TOMB4/specific/drawbars.cpp b/TOMB4/specific/drawbars.cpp index 39083d37..61ece5ca 100644 --- a/TOMB4/specific/drawbars.cpp +++ b/TOMB4/specific/drawbars.cpp @@ -475,7 +475,7 @@ void DoSlider(long x, long y, long width, long height, long pos, long c1, long c clipflags[2] = 0; clipflags[3] = 0; - sx = (float)GetFixedScale(x); + sx = (float)x * (float)phd_winxmax / 640.0F; sy = (float)y; w = (float)GetFixedScale(width); h = (float)GetFixedScale(height >> 1); From 64d5415688b20a7d6ef476b8145e4b04b8ff7d6b Mon Sep 17 00:00:00 2001 From: Troye Date: Sat, 6 May 2023 03:12:53 -0500 Subject: [PATCH 3/5] add times note to usage guide; --- USING.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/USING.md b/USING.md index 86bb6b9d..03872de5 100644 --- a/USING.md +++ b/USING.md @@ -21,6 +21,14 @@ 4. Unzip the archive and copy over the contents to you TR4 folder, overwrite when prompted. 5. Enjoy! +### The Times Exclusive level support: +*The Times Exclusive level support has been added since V2.2.0* + +Download the archive provided in the releases section, it contains a playable package that contains everything you need to play the level, +including a modified tomb4 executable made specifically for this level. + +**Do NOT use the modified executable with the base game, and do NOT use the base game's executable with the Times level.** + ------------------------ ## New options menu: From 260e285bf20621b175901ca4b307a591dc87ed62 Mon Sep 17 00:00:00 2001 From: Troye Date: Sat, 6 May 2023 03:25:58 -0500 Subject: [PATCH 4/5] use DX flags --- TOMB4/global/types.h | 11 +++++++++++ TOMB4/specific/drawbars.cpp | 2 +- TOMB4/specific/dxshell.cpp | 39 ++++++++++++++++++------------------- TOMB4/specific/fmv.cpp | 4 ++-- TOMB4/specific/output.cpp | 6 +++--- TOMB4/specific/registry.cpp | 10 +++++----- TOMB4/specific/texture.cpp | 2 +- TOMB4/specific/winmain.cpp | 10 +++++----- 8 files changed, 47 insertions(+), 37 deletions(-) diff --git a/TOMB4/global/types.h b/TOMB4/global/types.h index 013579f6..dc969761 100644 --- a/TOMB4/global/types.h +++ b/TOMB4/global/types.h @@ -57,6 +57,17 @@ typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned long ulong; +enum DX_FLAGS +{ + DXF_NONE = 0x0, + DXF_FULLSCREEN = 0x1, + DXF_WINDOWED = 0x2, + DXF_ZBUFFER = 0x10, + DXF_FPUSETUP = 0x20, + DXF_NOFREE = 0x40, + DXF_HWR = 0x80 +}; + enum carried_weapon_flags { W_NONE = 0x0, diff --git a/TOMB4/specific/drawbars.cpp b/TOMB4/specific/drawbars.cpp index 61ece5ca..24e9dda0 100644 --- a/TOMB4/specific/drawbars.cpp +++ b/TOMB4/specific/drawbars.cpp @@ -512,7 +512,7 @@ void S_LoadBar() { long x, y, w, h; - if (gfCurrentLevel || App.dx.Flags & 0x80) + if (gfCurrentLevel || App.dx.Flags & DXF_HWR) { _BeginScene(); InitBuckets(); diff --git a/TOMB4/specific/dxshell.cpp b/TOMB4/specific/dxshell.cpp index 598e5ac4..192d4f68 100644 --- a/TOMB4/specific/dxshell.cpp +++ b/TOMB4/specific/dxshell.cpp @@ -531,10 +531,10 @@ HRESULT DXShowFrame() DXAttempt(G_dxptr->lpBackBuffer->Restore()); } - if (!(App.dx.Flags & 0x82)) + if (!(App.dx.Flags & (DXF_HWR | DXF_WINDOWED))) return 0; - if (G_dxptr->Flags & 2) + if (G_dxptr->Flags & DXF_WINDOWED) return DXAttempt(G_dxptr->lpPrimaryBuffer->Blt(&G_dxptr->rScreen, G_dxptr->lpBackBuffer, &G_dxptr->rViewport, DDBLT_WAIT, 0)); else return DXAttempt(G_dxptr->lpPrimaryBuffer->Flip(0, DDFLIP_WAIT)); @@ -544,7 +544,7 @@ void DXMove(long x, long y) { Log(2, "DXMove : x %d y %d", x, y); - if (G_dxptr && !(G_dxptr->Flags & 1)) + if (G_dxptr && !(G_dxptr->Flags & DXF_FULLSCREEN)) SetRect(&G_dxptr->rScreen, x, y, x + G_dxptr->dwRenderWidth, y + G_dxptr->dwRenderHeight); } @@ -693,7 +693,7 @@ void DXClose() else Log(1, "%s Attempt To Release NULL Ptr", "Primary Buffer"); - if (!(G_dxptr->Flags & 0x40)) + if (!(G_dxptr->Flags & DXF_NOFREE)) { if (G_dxptr->lpDD) { @@ -746,12 +746,12 @@ long DXCreate(long w, long h, long bpp, long Flags, DXPTR* dxptr, HWND hWnd, lon } } - if (Flags & 1) + if (Flags & DXF_FULLSCREEN) CoopLevel = DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE; else CoopLevel = DDSCL_NORMAL; - if (Flags & 0x20) + if (Flags & DXF_FPUSETUP) CoopLevel |= DDSCL_FPUSETUP; G_dxptr->CoopLevel = CoopLevel; @@ -762,7 +762,7 @@ long DXCreate(long w, long h, long bpp, long Flags, DXPTR* dxptr, HWND hWnd, lon return 0; } - if (Flags & 1) + if (Flags & DXF_FULLSCREEN) { dm = &G_dxinfo->DDInfo[G_dxinfo->nDD].D3DDevices[G_dxinfo->nD3D].DisplayModes[G_dxinfo->nDisplayMode]; DXSetVideoMode(G_dxptr->lpDD, dm->w, dm->h, dm->bpp); @@ -781,13 +781,13 @@ long DXCreate(long w, long h, long bpp, long Flags, DXPTR* dxptr, HWND hWnd, lon memset(&desc, 0, sizeof(DDSURFACEDESCX)); desc.dwSize = sizeof(DDSURFACEDESCX); - if (Flags & 1) + if (Flags & DXF_FULLSCREEN) { desc.dwBackBufferCount = 1; desc.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; desc.ddsCaps.dwCaps = DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY; - if (!(Flags & 0x80)) + if (!(Flags & DXF_HWR)) { desc.dwBackBufferCount = 0; desc.dwFlags = DDSD_CAPS; @@ -802,7 +802,7 @@ long DXCreate(long w, long h, long bpp, long Flags, DXPTR* dxptr, HWND hWnd, lon return 0; } - if (Flags & 0x80) + if (Flags & DXF_HWR) { Log(3, "Get Attached Back Buffer"); desc.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER; @@ -874,7 +874,7 @@ long DXCreate(long w, long h, long bpp, long Flags, DXPTR* dxptr, HWND hWnd, lon } } - if (Flags & 0x10 && Flags & 0x80) + if (Flags & DXF_ZBUFFER && Flags & DXF_HWR) { Log(3, "Creating ZBuffer"); memset(&desc, 0, sizeof(DDSURFACEDESCX)); @@ -918,10 +918,10 @@ long DXChangeVideoMode() long val; Log(2, "DXChangeVideoMode"); - G_dxptr->Flags |= 0x40; + G_dxptr->Flags |= DXF_NOFREE; G_dxptr->lpD3D->EvictManagedTextures(); val = DXCreate(0, 0, 0, G_dxptr->Flags, G_dxptr, G_dxptr->hWnd, G_dxptr->WindowStyle); - G_dxptr->Flags ^= 0x40; + G_dxptr->Flags ^= DXF_NOFREE; Log(2, "Exited DXChangeVideoMode %d", val); return val; } @@ -935,22 +935,21 @@ long DXToggleFullScreen() if (G_dxptr->Flags & 2) { Log(5, "Switching To Full Screen"); - G_dxptr->Flags ^= 2; - G_dxptr->Flags |= 65; - G_dxptr->Flags |= 64; //mhm + G_dxptr->Flags ^= DXF_WINDOWED; + G_dxptr->Flags |= DXF_NOFREE | DXF_FULLSCREEN; } else { Log(5, "Switching To A Window"); - G_dxptr->Flags ^= 1; - G_dxptr->Flags |= 66; + G_dxptr->Flags ^= DXF_FULLSCREEN; + G_dxptr->Flags |= DXF_NOFREE | DXF_WINDOWED; } G_dxptr->lpD3D->EvictManagedTextures(); dm = &G_dxinfo->DDInfo[G_dxinfo->nDD].D3DDevices[G_dxinfo->nD3D].DisplayModes[G_dxinfo->nDisplayMode]; DXCreate(dm->w, dm->h, dm->bpp, G_dxptr->Flags, G_dxptr, G_dxptr->hWnd, G_dxptr->WindowStyle); - WinSetStyle(G_dxptr->Flags & 1, G_dxptr->WindowStyle); - G_dxptr->Flags ^= 64; + WinSetStyle(G_dxptr->Flags & DXF_FULLSCREEN, G_dxptr->WindowStyle); + G_dxptr->Flags ^= DXF_NOFREE; return 1; } diff --git a/TOMB4/specific/fmv.cpp b/TOMB4/specific/fmv.cpp index 7639055c..80ef7cd5 100644 --- a/TOMB4/specific/fmv.cpp +++ b/TOMB4/specific/fmv.cpp @@ -84,7 +84,7 @@ void ShowBinkFrame() BinkCopyToBuffer(Bink, surf.lpSurface, surf.lPitch, Bink->num, 0, 0, BinkSurfaceType); DXAttempt(BinkSurface->Unlock(0)); - if (App.dx.Flags & 2) + if (App.dx.Flags & DXF_WINDOWED) DXShowFrame(); } @@ -140,7 +140,7 @@ long PlayFmvNow(long num) BinkSetSoundSystem(BinkOpenDirectSound, App.dx.lpDS); Bink = (BINK_STRUCT*)BinkOpen(path, 0); - if (App.dx.Flags & 2) + if (App.dx.Flags & DXF_WINDOWED) BinkSurface = App.dx.lpBackBuffer; else BinkSurface = App.dx.lpPrimaryBuffer; diff --git a/TOMB4/specific/output.cpp b/TOMB4/specific/output.cpp index 6f020830..8d1d0316 100644 --- a/TOMB4/specific/output.cpp +++ b/TOMB4/specific/output.cpp @@ -1060,7 +1060,7 @@ void S_InitialisePolyList() else col = 0; - if (App.dx.Flags & 0x80) + if (App.dx.Flags & DXF_HWR) DXAttempt(App.dx.lpViewport->Clear2(1, &rect, D3DCLEAR_TARGET, col, 1.0F, 0)); _BeginScene(); @@ -1490,11 +1490,11 @@ HRESULT DDCopyBitmap(LPDIRECTDRAWSURFACEX surf, HBITMAP hbm, long x, long y, lon l = 0; t = 0; - if (!(App.dx.Flags & 0x80)) + if (!(App.dx.Flags & DXF_HWR)) { surf = App.dx.lpPrimaryBuffer; - if (App.dx.Flags & 2) + if (App.dx.Flags & DXF_WINDOWED) { l = App.dx.rScreen.left; t = App.dx.rScreen.top; diff --git a/TOMB4/specific/registry.cpp b/TOMB4/specific/registry.cpp index 7dc468b3..af183efb 100644 --- a/TOMB4/specific/registry.cpp +++ b/TOMB4/specific/registry.cpp @@ -167,7 +167,7 @@ bool LoadSettings() { App.TextureSize = 256; App.BumpMapSize = 256; - App.StartFlags = 32; + App.StartFlags = DXF_FPUSETUP; REG_ReadLong((char*)"DD", (ulong&)App.DXInfo.nDD, 0); REG_ReadLong((char*)"D3D", (ulong&)App.DXInfo.nD3D, 0); @@ -193,14 +193,14 @@ bool LoadSettings() REG_ReadBool((char*)"HardWare", val, 0); if (val) - App.StartFlags |= 0x90; + App.StartFlags |= DXF_ZBUFFER | DXF_HWR; REG_ReadBool((char*)"Window", val, 0); if (val) - App.StartFlags |= 2; + App.StartFlags |= DXF_WINDOWED; else - App.StartFlags |= 1; + App.StartFlags |= DXF_FULLSCREEN; } CloseRegistry(); @@ -306,7 +306,7 @@ void SaveSettings() OpenRegistry("System"); REG_WriteLong((char*)"VMode", App.DXInfo.nDisplayMode); - REG_WriteBool((char*)"Window", (App.dx.Flags & 2) != 0); + REG_WriteBool((char*)"Window", (App.dx.Flags & DXF_WINDOWED) != 0); CloseRegistry(); } diff --git a/TOMB4/specific/texture.cpp b/TOMB4/specific/texture.cpp index 07e57331..daf2682e 100644 --- a/TOMB4/specific/texture.cpp +++ b/TOMB4/specific/texture.cpp @@ -32,7 +32,7 @@ LPDIRECTDRAWSURFACEX CreateTexturePage(long w, long h, long MipMapCount, long* p desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT; desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE; - if (App.dx.Flags & 0x80) + if (App.dx.Flags & DXF_HWR) desc.ddsCaps.dwCaps2 = DDSCAPS2_TEXTUREMANAGE; else desc.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; diff --git a/TOMB4/specific/winmain.cpp b/TOMB4/specific/winmain.cpp index 5df0880c..fabfddd8 100644 --- a/TOMB4/specific/winmain.cpp +++ b/TOMB4/specific/winmain.cpp @@ -242,7 +242,7 @@ void WinProcessCommands(long cmd) App.dx.WaitAtBeginScene = 0; Log(5, "Game Thread Resumed"); - if (App.dx.Flags & 1) + if (App.dx.Flags & DXF_FULLSCREEN) { SetCursor(0); ShowCursor(0); @@ -423,12 +423,12 @@ void ClearSurfaces() r.y2 = App.dx.rViewport.top + App.dx.rViewport.bottom; r.x2 = App.dx.rViewport.left + App.dx.rViewport.right; - if (App.dx.Flags & 0x80) + if (App.dx.Flags & DXF_HWR) DXAttempt(App.dx.lpViewport->Clear2(1, &r, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0, 1.0F, 0)); S_DumpScreen(); - if (App.dx.Flags & 0x80) + if (App.dx.Flags & DXF_HWR) DXAttempt(App.dx.lpViewport->Clear2(1, &r, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0, 1.0F, 0)); S_DumpScreen(); @@ -562,11 +562,11 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmd CoInitializeEx(0, COINIT_MULTITHREADED); - WinSetStyle(G_dxptr->Flags & 1, G_dxptr->WindowStyle); + WinSetStyle(G_dxptr->Flags & DXF_FULLSCREEN, G_dxptr->WindowStyle); UpdateWindow(App.hWnd); ShowWindow(App.hWnd, nShowCmd); - if (App.dx.Flags & 1) + if (App.dx.Flags & DXF_FULLSCREEN) { SetCursor(0); ShowCursor(0); From 129559a32eff5251b50432ee1f469d787b9627b8 Mon Sep 17 00:00:00 2001 From: Troye Date: Sat, 6 May 2023 13:39:59 -0500 Subject: [PATCH 5/5] version etc. --- CHANGELOG.md | 8 ++------ tomb4.rc | Bin 11560 -> 11560 bytes 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dee1969a..5a1e4cc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,6 @@ # tomb4 changelog -## Unreleased - -### Original bug fixes - +## [2.2.1](https://github.com/Trxyebeep/TOMB4/tree/V2.2.1) (May. 6 2023) ### tomb4 bug fixes @@ -11,8 +8,6 @@ - Fix volume bars screen position. - Fix FMV message with the Times level. -### new tomb4 features - ## [2.2.0](https://github.com/Trxyebeep/TOMB4/tree/V2.2.0) (May. 5 2023) @@ -41,6 +36,7 @@ - Add option to scale bars. - Add times level support. + ## [2.1.0](https://github.com/Trxyebeep/TOMB4/tree/V2.1.0) (Mar. 3 2023) ### Original bug fixes diff --git a/tomb4.rc b/tomb4.rc index e08632df71603fe1c4e0cd8ff8845d78a90ce640..c57f2c7927dd4df42fe989ed68a5fb7f5b590f2f 100644 GIT binary patch delta 58 zcmZ1xwIXW6FJ(r<$-k8i84Wk