Skip to content

Commit

Permalink
Merge pull request #6 from Trxyebeep/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Trxyebeep authored Nov 19, 2022
2 parents e14d576 + 0a0cc0d commit 9843213
Show file tree
Hide file tree
Showing 17 changed files with 476 additions and 82 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
### Original bug fixes

- Fix underwater pickups rotating with Lara.
- Fix the wrong ambient track being played after reloading.

### tomb3 additions

- Add option for PSX mono screen colors.
- Move saves to a designated folder.
- Add support for The Lost Artifact.
- Add experimental Windowed support.

### tomb3 bug fixes

Expand Down
6 changes: 0 additions & 6 deletions tomb3.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tomb3", "tomb3.vcxproj", "{
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CB038090-6E9C-48AE-8D36-56EB883F9040}.Debug|x64.ActiveCfg = Debug|x64
{CB038090-6E9C-48AE-8D36-56EB883F9040}.Debug|x64.Build.0 = Debug|x64
{CB038090-6E9C-48AE-8D36-56EB883F9040}.Debug|x86.ActiveCfg = Debug|Win32
{CB038090-6E9C-48AE-8D36-56EB883F9040}.Debug|x86.Build.0 = Debug|Win32
{CB038090-6E9C-48AE-8D36-56EB883F9040}.Release|x64.ActiveCfg = Release|x64
{CB038090-6E9C-48AE-8D36-56EB883F9040}.Release|x64.Build.0 = Release|x64
{CB038090-6E9C-48AE-8D36-56EB883F9040}.Release|x86.ActiveCfg = Release|Win32
{CB038090-6E9C-48AE-8D36-56EB883F9040}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
Expand Down
2 changes: 2 additions & 0 deletions tomb3/3dsystem/3d_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,9 @@ void phd_InitWindow(long x, long y, long w, long h, long znear, long zfar, long
phd_WindowRect.top = phd_winymin;
phd_WindowRect.right = phd_winxmin + phd_winwidth;

#ifndef TROYESTUFF
if (!App.nRenderMode || App.nRenderMode == 1)
#endif
{
InsertObjectGT3 = HWI_InsertObjectGT3_Sorted;
InsertObjectGT4 = HWI_InsertObjectGT4_Sorted;
Expand Down
53 changes: 24 additions & 29 deletions tomb3/game/fish.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ void ControlFish(short item_number)
return;

leader = item->hit_points;

pLeader = &lead_info[leader];

if (!pLeader->on)
Expand Down Expand Up @@ -267,7 +266,7 @@ void ControlFish(short item_number)
if (pirahna_attack != 1)
enemy = &items[CarcassItem];

pFish->angle = (-((long)mGetAngle(pFish->x + item->pos.x_pos, pFish->z + item->pos.z_pos, enemy->pos.x_pos, enemy->pos.z_pos) + 0x4000) >> 4) & 0xFFF;
pFish->angle = ((-(long)mGetAngle(pFish->x + item->pos.x_pos, pFish->z + item->pos.z_pos, enemy->pos.x_pos, enemy->pos.z_pos) - 0x4000) >> 4) & 0xFFF;
pLeader->angle = pFish->angle;
pLeader->speed = (GetRandomControl() & 0x3F) - 64;
}
Expand Down Expand Up @@ -431,7 +430,7 @@ void ControlFish(short item_number)
fx = x;
fz = z;

for (int i = 0; i < 24; i++)
for (int i = 0, j = 32; i < 24; i++, j += 2)
{
pFish = &fish[(leader * 24) + 8 + i];

Expand All @@ -455,11 +454,9 @@ void ControlFish(short item_number)
}
}

angle = (-((long)mGetAngle(pFish->x, pFish->z, fx, fz) + 0x4000) >> 4) & 0xFFF;
dx = pFish->x - fx + ((24 - i) << 7);
dz = pFish->z - fz - ((24 - i) << 7);
dx *= dx;
dz *= dz;
angle = ((-(long)mGetAngle(pFish->x, pFish->z, fx, fz) - 0x4000) >> 4) & 0xFFF;
dx = SQUARE(pFish->x - fx + ((24 - i) << 7));
dz = SQUARE(pFish->z - fz - ((24 - i) << 7));
diff = pFish->angle - angle;

if (diff > 2048)
Expand All @@ -478,8 +475,8 @@ void ControlFish(short item_number)
{
pFish->angadd += 4;

if (pFish->angadd > 92 + (i >> 1))
pFish->angadd = 92 + (i >> 1);
if (pFish->angadd > (i >> 1) + 92)
pFish->angadd = (i >> 1) + 92;
}
else
{
Expand All @@ -498,16 +495,16 @@ void ControlFish(short item_number)

if (dx + dz < SQUARE(i << 7) + 0x100000)
{
if (pFish->speed > 32 + (i << 1))
if (pFish->speed > j)
pFish->speed -= pFish->speed >> 5;
}
else
{
if (pFish->speed < 160 + (i >> 1))
pFish->speed += uchar((GetRandomControl() & 3) + 1 + (i >> 1));
if (pFish->speed < (i >> 1) + 160)
pFish->speed += uchar((i >> 1) + (GetRandomControl() & 3) + 1);

if (pFish->speed > 160 + (i >> 1) - (i << 2))
pFish->speed = 160 + (i >> 1) - (i << 2);
if (pFish->speed > (i >> 1) - (i << 2) + 160)
pFish->speed = (i >> 1) - (i << 2) + 160;
}

if (GetRandomControl() & 1)
Expand All @@ -525,30 +522,28 @@ void ControlFish(short item_number)
x = pFish->x - ((pFish->speed * rcossin_tbl[pFish->angle << 1]) >> 13);
z = pFish->z + ((pFish->speed * rcossin_tbl[(pFish->angle << 1) + 1]) >> 13);

if (z < -32000)
z = -32000;
else if (z > 32000)
z = 32000;
if (x < -32000)
x = -32000;
else if (x > 32000)
x = 32000;
if (z < -0x7D00)
z = -0x7D00;
else if (z > 0x7D00)
z = 0x7D00;

if (x < -0x7D00)
x = -0x7D00;
else if (x > 0x7D00)
x = 0x7D00;

pFish->x = (short)x;
pFish->z = (short)z;

if (!pirahna_attack)
{
if (abs(pFish->y - pFish->desty) < 16)
pFish->desty = GetRandomControl() % lead_info[leader].Yrange;
}
else
if (pirahna_attack)
{
diff = enemy->pos.y_pos - item->pos.y_pos;

if (abs(pFish->y - pFish->desty) < 16)
pFish->desty = short(diff + (GetRandomControl() & 0xFF));
}
else if (abs(pFish->y - pFish->desty) < 16)
pFish->desty = GetRandomControl() % lead_info[leader].Yrange;

pFish->y += (pFish->desty - pFish->y) >> 4;
}
Expand Down
5 changes: 5 additions & 0 deletions tomb3/game/setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,12 @@ long InitialiseLevel(long level, long type)
if (objects[FINAL_LEVEL].loaded)
InitialiseFinalLevel();

#ifdef TROYESTUFF
if (type == 2) //mid_level_save is not used on PC (right now), on PSX it means any save that's NOT from the level stats prompt
//so on PC this check will never pass, although it should since PC cannot save other than "mid level".
#else
if (type == 2 && savegame.mid_level_save)
#endif
{
S_CDPlay(CurrentAtmosphere, 1);
IsAtmospherePlaying = 1;
Expand Down
6 changes: 6 additions & 0 deletions tomb3/global/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,12 @@ struct TOMB3_OPTIONS
float INV_Scale;
float unwater_music_mute;
float inv_music_mute;

//windowed stuff, move to WINAPP when possible
RECT rScreen;
RECT rViewport;
ulong WindowStyle;
bool Windowed;
};
#endif
#pragma pack(pop)
20 changes: 19 additions & 1 deletion tomb3/specific/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,32 @@ long ACMGetTrackLocation()
return long((float(timeGetTime() - acm_start_time) / (float)CLOCKS_PER_SEC) * 60.0F);
}

#ifdef TROYESTUFF
static bool ACMIsTrackPlaying()
{
ulong status;

if (DSBuffer->GetStatus(&status) == DS_OK)
{
if (status & DSBSTATUS_PLAYING)
return 1;
}

return 0;
}
#endif

void ACMSetVolume(long volume)
{
#ifdef TROYESTUFF
static bool paused;

if (!DSBuffer)
return;

if (!volume)
{
if (!paused)
if (!paused && ACMIsTrackPlaying())
{
DSBuffer->Stop();
paused = 1;
Expand Down
55 changes: 47 additions & 8 deletions tomb3/specific/dxdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "winmain.h"
#ifdef TROYESTUFF
#include "smain.h"
#include "../tomb3/tomb3.h"
#endif

//these are the BOXES/BUTTONS not the text
Expand All @@ -14,8 +15,8 @@
#define IDC_ZBUFFER 1004
#define IDC_DITHER 1005
#define IDC_BILINEAR 1006
#define IDC_HARDWARE 1007
#define IDC_SOFTWARE 1008
#define IDC_HARDWARE 1007 //now "Fullscreen"
#define IDC_SOFTWARE 1008 //now "Windowed"
#define IDC_8BIT_TEXTURES 1009
#define IDC_SOUND 1010
#define IDC_JOYSTICK 1011
Expand All @@ -39,6 +40,14 @@ BOOL CALLBACK DXSetupDlgProc(HWND dlg, UINT message, WPARAM wParam, LPARAM lPara
DXInitDialogBox(dlg);
output_setting = GetDlgItem(dlg, IDC_OUTPUT_SETTINGS);
resolution = GetDlgItem(dlg, IDC_RESOLUTION);
#ifdef TROYESTUFF
SendMessage(output_setting, CB_SETCURSEL, 1, 0);
DXInitD3DDrivers(dlg, SendMessage(GetDlgItem(dlg, IDC_GRAPHICS_ADAPTER), CB_GETCURSEL, 0, 0));
DXInitVideoModes(dlg, SendMessage(GetDlgItem(dlg, IDC_GRAPHICS_ADAPTER), CB_GETCURSEL, 0, 0),
SendMessage(GetDlgItem(dlg, IDC_OUTPUT_SETTINGS), CB_GETCURSEL, 0, 0));
DXInitTextures(dlg, SendMessage(GetDlgItem(dlg, IDC_GRAPHICS_ADAPTER), CB_GETCURSEL, 0, 0),
SendMessage(GetDlgItem(dlg, IDC_OUTPUT_SETTINGS), CB_GETCURSEL, 0, 0));
#endif
return 1;
}

Expand All @@ -61,6 +70,9 @@ BOOL CALLBACK DXSetupDlgProc(HWND dlg, UINT message, WPARAM wParam, LPARAM lPara
G_DXConfig->Filter = (bool)SendMessage(GetDlgItem(dlg, IDC_BILINEAR), BM_GETCHECK, 0, 0);
G_DXConfig->sound = !(bool)SendMessage(GetDlgItem(dlg, IDC_DISABLE_SOUND), BM_GETCHECK, 0, 0);
G_DXConfig->Joystick = !(bool)SendMessage(GetDlgItem(dlg, IDC_DISABLE_JOYSTICK), BM_GETCHECK, 0, 0);
#ifdef TROYESTUFF
tomb3.Windowed = (bool)SendMessage(GetDlgItem(dlg, IDC_SOFTWARE), BM_GETCHECK, 0, 0);
#endif

if ((ushort)wParam == IDOK)
{
Expand All @@ -78,6 +90,9 @@ BOOL CALLBACK DXSetupDlgProc(HWND dlg, UINT message, WPARAM wParam, LPARAM lPara
pass = WinDXInit(&App.DeviceInfo, &App.DXConfig, 1);
WinFreeDX(1);
ShowWindow(App.WindowHandle, 0);
#ifdef TROYESTUFF
UpdateWindow(dlg);
#endif
ShowCursor(1);

if (pass)
Expand Down Expand Up @@ -106,32 +121,40 @@ BOOL CALLBACK DXSetupDlgProc(HWND dlg, UINT message, WPARAM wParam, LPARAM lPara

break;

case IDC_HARDWARE:
case IDC_SOFTWARE:

if (!HIWORD(wParam))
{
SendMessage(output_setting, CB_SETCURSEL, 1, 0);
#ifdef TROYESTUFF
SendMessage(GetDlgItem(dlg, IDC_HARDWARE), BM_SETCHECK, 0, 0);
#else
SendMessage(output_setting, CB_SETCURSEL, 0, 0);
SendMessage(resolution, CB_SETCURSEL, 0, 0);
DXInitD3DDrivers(dlg, SendMessage(GetDlgItem(dlg, IDC_GRAPHICS_ADAPTER), CB_GETCURSEL, 0, 0));
DXInitVideoModes(dlg, SendMessage(GetDlgItem(dlg, IDC_GRAPHICS_ADAPTER), CB_GETCURSEL, 0, 0),
SendMessage(GetDlgItem(dlg, IDC_OUTPUT_SETTINGS), CB_GETCURSEL, 0, 0));
DXInitTextures(dlg, SendMessage(GetDlgItem(dlg, IDC_GRAPHICS_ADAPTER), CB_GETCURSEL, 0, 0),
SendMessage(GetDlgItem(dlg, IDC_OUTPUT_SETTINGS), CB_GETCURSEL, 0, 0));
EnableWindow(GetDlgItem(dlg, IDC_8BIT_TEXTURES), 0);
#endif
}

break;

case IDC_SOFTWARE:
case IDC_HARDWARE:

if (!HIWORD(wParam))
{
SendMessage(output_setting, CB_SETCURSEL, 0, 0);
SendMessage(resolution, CB_SETCURSEL, 0, 0);
#ifdef TROYESTUFF
SendMessage(GetDlgItem(dlg, IDC_SOFTWARE), BM_SETCHECK, 0, 0);
#else
SendMessage(output_setting, CB_SETCURSEL, 1, 0);
DXInitD3DDrivers(dlg, SendMessage(GetDlgItem(dlg, IDC_GRAPHICS_ADAPTER), CB_GETCURSEL, 0, 0));
DXInitVideoModes(dlg, SendMessage(GetDlgItem(dlg, IDC_GRAPHICS_ADAPTER), CB_GETCURSEL, 0, 0),
SendMessage(GetDlgItem(dlg, IDC_OUTPUT_SETTINGS), CB_GETCURSEL, 0, 0));
DXInitTextures(dlg, SendMessage(GetDlgItem(dlg, IDC_GRAPHICS_ADAPTER), CB_GETCURSEL, 0, 0),
SendMessage(GetDlgItem(dlg, IDC_OUTPUT_SETTINGS), CB_GETCURSEL, 0, 0));
EnableWindow(GetDlgItem(dlg, IDC_8BIT_TEXTURES), 0);
#endif
}

break;
Expand Down Expand Up @@ -265,15 +288,18 @@ void DXInitD3DDrivers(HWND hwnd, long nDrivers)
SendMessage(agp_mem, BM_SETCHECK, 1, 0);
}

#ifndef TROYESTUFF
SendMessage(HWR, BM_SETCHECK, 1, 0);
SendMessage(SWR, BM_SETCHECK, 0, 0);
#endif
SendMessage(zbuffer, BM_SETCHECK, 1, 0);
SendMessage(filter, BM_SETCHECK, 1, 0);
SendMessage(dither, BM_SETCHECK, 1, 0);
SendMessage(tex_8bit, BM_SETCHECK, 0, 0);
}
else
{
#ifndef TROYESTUFF
SendMessage(zbuffer, BM_SETCHECK, 0, 0);
SendMessage(filter, BM_SETCHECK, 0, 0);
SendMessage(dither, BM_SETCHECK, 0, 0);
Expand All @@ -299,6 +325,7 @@ void DXInitD3DDrivers(HWND hwnd, long nDrivers)
SendMessage(tex_8bit, BM_SETCHECK, 0, 0);

SendMessage(agp_mem, BM_SETCHECK, 0, 0);
#endif
}
}

Expand Down Expand Up @@ -464,6 +491,7 @@ void DXInitTextures(HWND hwnd, long nDD, long nD3D)
else
EnableWindow(GetDlgItem(hwnd, IDC_8BIT_TEXTURES), 0);

#ifndef TROYESTUFF
if (G_DXConfig->MMX && SendMessage(GetDlgItem(hwnd, IDC_SOFTWARE), BM_GETCHECK, 0, 0))
{
if (!found)
Expand All @@ -483,6 +511,7 @@ void DXInitTextures(HWND hwnd, long nDD, long nD3D)
}
}
}
#endif

if (!found)
{
Expand Down Expand Up @@ -740,6 +769,16 @@ void DXInitDialogBox(HWND hwnd)
else
nDD = G_DeviceInfo->nDDInfo - 1;

#ifdef TROYESTUFF
SendMessage(GetDlgItem(hwnd, IDOK), WM_SETTEXT, 0, (LPARAM)("Save"));

SendMessage(GetDlgItem(hwnd, IDC_HARDWARE), WM_SETTEXT, 0, (LPARAM)("Fullscreen"));
SendMessage(GetDlgItem(hwnd, IDC_HARDWARE), BM_SETCHECK, 1, 0);

SendMessage(GetDlgItem(hwnd, IDC_SOFTWARE), WM_SETTEXT, 0, (LPARAM)("Windowed"));
SendMessage(GetDlgItem(hwnd, IDC_SOFTWARE), BM_SETCHECK, 0, 0);
#endif

SendMessage(gfx, CB_SETCURSEL, nDD, 0);
DXCheckMMXTechnology(hwnd);
DXInitD3DDrivers(hwnd, nDD);
Expand Down
Loading

0 comments on commit 9843213

Please sign in to comment.