Skip to content

Commit

Permalink
Resolved #11; Fixed #10; Resolved #5
Browse files Browse the repository at this point in the history
  • Loading branch information
munawarb committed Nov 18, 2018
1 parent 56b75ac commit 32b730c
Show file tree
Hide file tree
Showing 13 changed files with 1,635 additions and 2,073 deletions.
33 changes: 18 additions & 15 deletions README.md
Expand Up @@ -37,18 +37,21 @@ I had originally tried DotPeek to get a Visual Studio project, but the tool wasn
#### Downloading Treasure Hunt
You can either [download the zip file of the master branch](https://github.com/munawarb/Treasure-Hunt/archive/master.zip), or if you're normal like the rest of us and prefer to use Git, just execute:
`git clone https://github.com/munawarb/Treasure-Hunt.git`

Run the file Treasure-Hunt/Bin/Debug/th.exe to start the game. If you find any issues or have suggestions, simply post them on the issues page. And most of all, have fun! It's been quite a challenge for me to get this game working from nothing but a Reactor-protected executable, so I really hope you enjoy this classic. Oh yeah, I removed the demo restrictions. You're welcome.

#### Changes

##### 4.44
- Treasure Hunt no longer uses `KeyDown` and takes advantage of `DirectInput` through the use of `BPCSharedComponent.dll`, a library I wrote for Three-D Velocity. Keys are now processed in the game loop, making key processing smoother ([#9](../../issues/9))
- The single footstep sound has been replaced with better footstep sounds ([#7](../../issues/7))
- Key presses are handled better now and weapons can be rapid-fired. A lot of the key-handling code was cleaned up ([#6](../../issues/6))
- The game loop is now much cleaner and no longer runs every tenth of a second. The slow frame rate would force the player to slow down so the game could update the state ([#4](../../issues/4))
- When the player holds down an arrow key, the character will move steadily in that direction as opposed to taking only one step ([#3](../../issues/3))

##### 4.42 11/13/2018
- Treasure Hunt now has an auto updater, and the window layout has been fixed ([#2](../../issues/2))
- Exceptions should be logged properly now ([#1](../../issues/1))

Run the file Treasure-Hunt/Bin/Debug/th.exe to start the game. If you find any issues or have suggestions, simply post them on the issues page. And most of all, have fun! It's been quite a challenge for me to get this game working from nothing but a Reactor-protected executable, so I really hope you enjoy this classic. Oh yeah, I removed the demo restrictions. You're welcome.

#### Changes

##### 4.44
- The game no longer relies on hard-coded frame ticks and now operates on a time elapsed basis with respect to frames. In other words, the game time might look something like `fw = t` where `f` represents the number of frames in the current session and `w` represents the width of each frame in milliseconds. Previously, Treasure Hunt was only accounting for `f` and assumed `w=100`, so the time elapsed formula would look like `100f = t`. This change allows for future adjustments to the frame rate if needed ([#5](../../issues/5))
- The game no longer uses the `Short` type and all `Short` integers have been promoted to `Integer`. This was necessary to prevent arithmetic overflow exceptions especially on account of trackers now using the frame width ([#10](../../issues/10))
- The game loop that was started in the load event handler has been replaced with a timer to control the game loop. This is less resource-intensive ([#11](../../issues/11))
- Treasure Hunt no longer uses `KeyDown` and takes advantage of `DirectInput` through the use of `BPCSharedComponent.dll`, a library I wrote for Three-D Velocity. Keys are now processed in the game loop, making key processing smoother ([#9](../../issues/9))
- The single footstep sound has been replaced with better footstep sounds ([#7](../../issues/7))
- Key presses are handled better now and weapons can be rapid-fired. A lot of the key-handling code was cleaned up ([#6](../../issues/6))
- The game loop is now much cleaner and no longer runs every tenth of a second. The slow frame rate would force the player to slow down so the game could update the state ([#4](../../issues/4))
- When the player holds down an arrow key, the character will move steadily in that direction as opposed to taking only one step ([#3](../../issues/3))

##### 4.42 11/13/2018
- Treasure Hunt now has an auto updater, and the window layout has been fixed ([#2](../../issues/2))
- Exceptions should be logged properly now ([#1](../../issues/1))
Binary file modified bin/Debug/Updater.exe
Binary file not shown.
Binary file modified bin/Debug/th.exe
Binary file not shown.
1 change: 0 additions & 1 deletion th.vbproj
Expand Up @@ -66,7 +66,6 @@
<Compile Include="th\EllReg.vb" />
<Compile Include="th\THConstVars.vb" />
<Compile Include="th\THF.vb" />
<Compile Include="th\THReg.vb" />
</ItemGroup>
<ItemGroup>
<Folder Include="My Project\" />
Expand Down
6 changes: 3 additions & 3 deletions th/Addendums.vb
Expand Up @@ -19,15 +19,15 @@ Namespace th
Get
Dim str3 As String = ""
Dim array As String() = Strings.Split(FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly.Location).FileName, "\", -1, CompareMethod.Binary)
Dim num2 As Short = CShort((Information.UBound(array, 1) - 1))
Dim i As Short = 0
Dim num2 As Integer = ((Information.UBound(array, 1) - 1))
Dim i As Integer = 0
Do While (i <= num2)
If (i = 0) Then
str3 = array(i)
Else
str3 = (str3 & "\" & array(i))
End If
i = CShort((i + 1))
i = ((i + 1))
Loop
Return str3
End Get
Expand Down
70 changes: 35 additions & 35 deletions th/DXSound.vb
Expand Up @@ -8,12 +8,12 @@ Namespace th
<StandardModule> _
Friend NotInheritable Class DXSound
' Methods
Private Shared Sub GetWhere(ByRef TheX As Short, ByRef TheY As Short, ByRef x As Short, ByRef y As Short)
Dim px As Short
Dim py As Short
Private Shared Sub GetWhere(ByRef TheX As Integer, ByRef TheY As Integer, ByRef x As Integer, ByRef y As Integer)
Dim px As Integer
Dim py As Integer
If THF.F.IsControling Then
px = Conversions.ToShort(NewLateBinding.LateGet(THF.F.GetChall(THF.F.WControl), Nothing, "x", New Object(0 - 1) {}, Nothing, Nothing, Nothing))
py = Conversions.ToShort(NewLateBinding.LateGet(THF.F.GetChall(THF.F.WControl), Nothing, "y", New Object(0 - 1) {}, Nothing, Nothing, Nothing))
px = Conversions.ToInteger(NewLateBinding.LateGet(THF.F.GetChall(THF.F.WControl), Nothing, "x", New Object(0 - 1) {}, Nothing, Nothing, Nothing))
py = Conversions.ToInteger(NewLateBinding.LateGet(THF.F.GetChall(THF.F.WControl), Nothing, "y", New Object(0 - 1) {}, Nothing, Nothing, Nothing))
Else
px = THF.F.px
py = THF.F.py
Expand Down Expand Up @@ -55,16 +55,16 @@ Namespace th
Return DXSound.objDS.CreateSoundBufferFromFile(FileName, dsbufferdesc)
End Function

Public Shared Sub LocaleNotify(ByRef x As Short, ByRef y As Short, ByRef Optional DVolume As String = "")
Dim num As Short
Dim num2 As Short
Public Shared Sub LocaleNotify(ByRef x As Integer, ByRef y As Integer, ByRef Optional DVolume As String = "")
Dim num As Integer
Dim num2 As Integer
DXSound.GetWhere(num, num2, x, y)
If (DVolume <> "dont") Then
Dim flag As Boolean
Dim flag2 As Boolean
Dim flag3 As Boolean
Dim num3 As Short
Dim num4 As Short
Dim num3 As Integer
Dim num4 As Integer
Dim str As String
Dim flag4 As Boolean
Select Case num2
Expand Down Expand Up @@ -92,27 +92,27 @@ Namespace th
End If
End Sub

Private Shared Sub PlayAroundCenter(ByRef Sound As DirectSoundSecondaryBuffer8, ByVal x As Short, ByVal y As Short, ByRef position As Single, ByVal Optional Distance As Long = 1)
Dim num2 As Short
Dim num3 As Short
Private Shared Sub PlayAroundCenter(ByRef Sound As DirectSoundSecondaryBuffer8, ByVal x As Integer, ByVal y As Integer, ByRef position As Single, ByVal Optional Distance As Long = 1)
Dim num2 As Integer
Dim num3 As Integer
Select Case position
Case 0!
num2 = CShort((x - Distance))
num2 = ((x - Distance))
num3 = 0
DXSound.smethod_1(Sound, True, False, num2, y, num3)
Exit Select
Case 1!
num3 = CShort((x + Distance))
num3 = ((x + Distance))
num2 = 0
DXSound.smethod_1(Sound, True, False, num3, y, num2)
Exit Select
Case 2!
num3 = CShort((y + Distance))
num3 = ((y + Distance))
num2 = 0
DXSound.smethod_1(Sound, True, False, x, num3, num2)
Exit Select
Case 3!
num3 = CShort((y - Distance))
num3 = ((y - Distance))
num2 = 0
DXSound.smethod_1(Sound, True, False, x, num3, num2)
Exit Select
Expand All @@ -123,7 +123,7 @@ Namespace th
End Select
End Sub

Public Shared Sub PlaySound(ByRef Sound As DirectSoundSecondaryBuffer8, ByRef bCloseFirst As Boolean, ByRef bLoopSound As Boolean, ByRef Optional PerformEffects As Boolean = False, ByRef Optional x As Short = 0, ByRef Optional y As Short = 0, ByRef Optional DVolume As String = "", ByRef Optional WaitTillDone As Boolean = False)
Public Shared Sub PlaySound(ByRef Sound As DirectSoundSecondaryBuffer8, ByRef bCloseFirst As Boolean, ByRef bLoopSound As Boolean, ByRef Optional PerformEffects As Boolean = False, ByRef Optional x As Integer = 0, ByRef Optional y As Integer = 0, ByRef Optional DVolume As String = "", ByRef Optional WaitTillDone As Boolean = False)
If bCloseFirst Then
Sound.Stop
Sound.SetCurrentPosition(0)
Expand All @@ -146,8 +146,8 @@ Namespace th
Dim bCloseFirst As Boolean = True
Dim bLoopSound As Boolean = False
Dim performEffects As Boolean = False
Dim x As Short = 0
Dim y As Short = 0
Dim x As Integer = 0
Dim y As Integer = 0
Dim dVolume As String = ""
Dim waitTillDone As Boolean = False
DXSound.PlaySound(THF.F.RadioSound, bCloseFirst, bLoopSound, performEffects, x, y, dVolume, waitTillDone)
Expand All @@ -169,19 +169,19 @@ Namespace th
THConstVars.CannotDoKeydown = False
End Sub

Public Shared Sub SetCoordinates(ByRef x As Short, ByRef y As Short, ByRef Optional z As Short = 0)
Public Shared Sub SetCoordinates(ByRef x As Integer, ByRef y As Integer, ByRef Optional z As Integer = 0)
DXSound.directSound3DListener8_0.SetPosition(CSng(x), CSng(y), CSng(z), CONST_DS3DAPPLYFLAGS.DS3D_IMMEDIATE)
End Sub

Private Shared Sub SetSoundPosition1(ByRef TheSound As DirectSoundSecondaryBuffer8, ByRef x As Short, ByRef y As Short, ByRef DVolume As String)
Private Shared Sub SetSoundPosition1(ByRef TheSound As DirectSoundSecondaryBuffer8, ByRef x As Integer, ByRef y As Integer, ByRef DVolume As String)
Dim num As Integer
Dim num2 As Short
Dim num3 As Short
Dim num2 As Integer
Dim num3 As Integer
DXSound.GetWhere(num2, num3, x, y)
If (Math.Abs(CShort((THF.F.px - x))) > 10) Then
If (Math.Abs(((THF.F.px - x))) > 10) Then
num = &H2710
Else
num = (Math.Abs(CShort((THF.F.px - x))) * &H3E8)
num = (Math.Abs(((THF.F.px - x))) * &H3E8)
End If
Select Case num2
Case -1
Expand All @@ -194,27 +194,27 @@ Namespace th
TheSound.SetPan(num)
Exit Select
End Select
If (Math.Abs(CShort((THF.F.py - y))) > Math.Abs(CShort((THF.F.px - x)))) Then
If (Math.Abs(CShort((THF.F.py - y))) > 20) Then
If (Math.Abs(((THF.F.py - y))) > Math.Abs(((THF.F.px - x)))) Then
If (Math.Abs(((THF.F.py - y))) > 20) Then
num = &H2710
Else
num = (Math.Abs(CShort((THF.F.py - y))) * 100)
num = (Math.Abs(((THF.F.py - y))) * 100)
End If
End If
If ((Math.Abs(CShort((THF.F.px - x))) > Math.Abs(CShort((THF.F.py - y)))) Or (Math.Abs(CShort((THF.F.px - x))) = Math.Abs(CShort((THF.F.py - y))))) Then
If (Math.Abs(CShort((THF.F.px - x))) > 20) Then
If ((Math.Abs(((THF.F.px - x))) > Math.Abs(((THF.F.py - y)))) Or (Math.Abs(((THF.F.px - x))) = Math.Abs(((THF.F.py - y))))) Then
If (Math.Abs(((THF.F.px - x))) > 20) Then
num = &H2710
Else
num = (Math.Abs(CShort((THF.F.px - x))) * 100)
num = (Math.Abs(((THF.F.px - x))) * 100)
End If
End If
TheSound.SetVolume((0 - num))
If (DVolume <> "dont") Then
Dim flag As Boolean
Dim flag2 As Boolean
Dim flag3 As Boolean
Dim num4 As Short
Dim num5 As Short
Dim num4 As Integer
Dim num5 As Integer
Dim str As String
Dim flag4 As Boolean
Select Case num3
Expand Down Expand Up @@ -272,7 +272,7 @@ Namespace th
Return buffer
End Function

Public Shared Sub smethod_1(ByRef Sound As DirectSoundSecondaryBuffer8, ByVal bCloseFirst As Boolean, ByVal bLoopSound As Boolean, ByRef x As Short, ByRef y As Short, ByRef Optional z As Short = 0)
Public Shared Sub smethod_1(ByRef Sound As DirectSoundSecondaryBuffer8, ByVal bCloseFirst As Boolean, ByVal bLoopSound As Boolean, ByRef x As Integer, ByRef y As Integer, ByRef Optional z As Integer = 0)
Dim buffer As DirectSound3DBuffer8 = Sound.GetDirectSound3DBuffer
If bCloseFirst Then
Sound.Stop
Expand Down
40 changes: 20 additions & 20 deletions th/EllReg.vb
Expand Up @@ -168,8 +168,8 @@ Label_00DD:
Dim str4 As String = ""
Label_00E8:
num10 = 13
Dim num7 As Short = CShort(lpcbData)
Dim start As Short = 1
Dim num7 As Integer = (lpcbData)
Dim start As Integer = 1
Label_00F3:
If (start > num7) Then
GoTo Label_014F
Expand All @@ -188,7 +188,7 @@ Label_011F:
GoTo Label_013E
Label_0133:
num10 = &H13
start = CShort((start + 1))
start = ((start + 1))
GoTo Label_00F3
Label_013E:
num10 = &H12
Expand Down Expand Up @@ -678,12 +678,12 @@ Label_00EF:
Public Const STANDARD_RIGHTS_ALL As Integer = &H1F0000
Public Const STANDARD_RIGHTS_READ As Integer = &H20000
Public Const STANDARD_RIGHTS_WRITE As Integer = &H20000
Public Const KEY_QUERY_VALUE As Short = 1
Public Const KEY_SET_VALUE As Short = 2
Public Const KEY_CREATE_SUB_KEY As Short = 4
Public Const KEY_ENUMERATE_SUB_KEYS As Short = 8
Public Const KEY_NOTIFY As Short = &H10
Public Const KEY_CREATE_LINK As Short = &H20
Public Const KEY_QUERY_VALUE As Integer = 1
Public Const KEY_SET_VALUE As Integer = 2
Public Const KEY_CREATE_SUB_KEY As Integer = 4
Public Const KEY_ENUMERATE_SUB_KEYS As Integer = 8
Public Const KEY_NOTIFY As Integer = &H10
Public Const KEY_CREATE_LINK As Integer = &H20
Public Const KEY_ALL_ACCESS As Boolean = True
Public Const KEY_READ As Boolean = True
Public Const KEY_EXECUTE As Boolean = True
Expand All @@ -703,17 +703,17 @@ Label_00EF:
Public Const HKEY_PERFORMANCE_DATA As Integer = -2147483644
Public Const HKEY_CURRENT_CONFIG As Integer = -2147483643
Public Const HKEY_DYN_DATA As Integer = -2147483642
Private Const ERROR_NONE As Short = 0
Private Const ERROR_BADDB As Short = 1
Private Const ERROR_BADKEY As Short = 2
Private Const ERROR_CANTOPEN As Short = 3
Private Const ERROR_CANTREAD As Short = 4
Private Const ERROR_CANTWRITE As Short = 5
Private Const ERROR_OUTOFMEMORY As Short = 6
Private Const ERROR_INVALID_PARAMETER As Short = 7
Private Const ERROR_ACCESS_DENIED As Short = 8
Private Const ERROR_INVALID_PARAMETERS As Short = &H57
Private Const ERROR_NO_MORE_ITEMS As Short = &H103
Private Const ERROR_NONE As Integer = 0
Private Const ERROR_BADDB As Integer = 1
Private Const ERROR_BADKEY As Integer = 2
Private Const ERROR_CANTOPEN As Integer = 3
Private Const ERROR_CANTREAD As Integer = 4
Private Const ERROR_CANTWRITE As Integer = 5
Private Const ERROR_OUTOFMEMORY As Integer = 6
Private Const ERROR_INVALID_PARAMETER As Integer = 7
Private Const ERROR_ACCESS_DENIED As Integer = 8
Private Const ERROR_INVALID_PARAMETERS As Integer = &H57
Private Const ERROR_NO_MORE_ITEMS As Integer = &H103

' Nested Types
Public Enum InTypes
Expand Down

0 comments on commit 32b730c

Please sign in to comment.