Skip to content

Commit

Permalink
Merge pull request #67 from Trxyebeep/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Trxyebeep committed May 6, 2023
2 parents 18bb80d + 129559a commit 0422c18
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 42 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# tomb4 changelog

## [2.2.1](https://github.com/Trxyebeep/TOMB4/tree/V2.2.1) (May. 6 2023)

### tomb4 bug fixes

- Fix volume bars drawing on certain GPUs.
- Fix volume bars screen position.
- Fix FMV message with the Times level.


## [2.2.0](https://github.com/Trxyebeep/TOMB4/tree/V2.2.0) (May. 5 2023)

### Original bug fixes
Expand Down Expand Up @@ -27,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
Expand Down
2 changes: 2 additions & 0 deletions TOMB4/game/gameflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions TOMB4/global/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions TOMB4/specific/drawbars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand All @@ -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();
Expand Down
39 changes: 19 additions & 20 deletions TOMB4/specific/dxshell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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);
}

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions TOMB4/specific/fmv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions TOMB4/specific/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions TOMB4/specific/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion TOMB4/specific/texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 7 additions & 5 deletions TOMB4/specific/winmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -533,6 +533,7 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmd
LoadSettings();
}

#ifndef TIMES_LEVEL
if (!fmvs_disabled)
{
if (!LoadBinkStuff())
Expand All @@ -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();
Expand All @@ -560,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);
Expand Down
8 changes: 8 additions & 0 deletions USING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Binary file modified tomb4.rc
Binary file not shown.

0 comments on commit 0422c18

Please sign in to comment.