Skip to content

Commit

Permalink
Merge branch 'Version0.65'
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeqMacaw committed Jan 22, 2020
2 parents fab8fec + ef4798a commit 5e4effa
Show file tree
Hide file tree
Showing 475 changed files with 6,752 additions and 60,251 deletions.
12 changes: 11 additions & 1 deletion Crowbar/Core/- General/EnumHelper.vb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Public NotInheritable Class EnumHelper
Return index
End Function

Public Shared Function IndexOfKeyAsCasInsensitiveString(ByVal keyText As String, ByVal list As IList) As Integer
Public Shared Function IndexOfKeyAsCaseInsensitiveString(ByVal keyText As String, ByVal list As IList) As Integer
Dim index As Integer = -1
For pairIndex As Integer = 0 To list.Count - 1
Dim pair As KeyValuePair(Of System.Enum, String) = CType(list(pairIndex), KeyValuePair(Of [Enum], String))
Expand All @@ -87,4 +87,14 @@ Public NotInheritable Class EnumHelper
Return index
End Function

Public Shared Function Key(ByVal index As Integer, ByVal list As IList) As System.Enum
Dim pair As KeyValuePair(Of System.Enum, String) = CType(list(index), KeyValuePair(Of [Enum], String))
Return pair.Key
End Function

Public Shared Function Value(ByVal index As Integer, ByVal list As IList) As String
Dim pair As KeyValuePair(Of System.Enum, String) = CType(list(index), KeyValuePair(Of [Enum], String))
Return pair.Value
End Function

End Class
135 changes: 0 additions & 135 deletions Crowbar/Core/- General/MathModule.vb
Original file line number Diff line number Diff line change
Expand Up @@ -236,41 +236,6 @@ Module MathModule
' matrix[2][3] = 0.f;
'}
''Public Sub AngleMatrix(ByVal pitchDegrees As Double, ByVal yawDegrees As Double, ByVal rollDegrees As Double, ByRef matrixColumn0 As SourceVector, ByRef matrixColumn1 As SourceVector, ByRef matrixColumn2 As SourceVector)
Public Sub AngleMatrix(ByVal pitchRadians As Single, ByVal yawRadians As Single, ByVal rollRadians As Single, ByRef matrixColumn0 As SourceVectorSingle, ByRef matrixColumn1 As SourceVectorSingle, ByRef matrixColumn2 As SourceVectorSingle, ByRef matrixColumn3 As SourceVectorSingle)
'Dim pitchRadians As Double
'Dim yawRadians As Double
'Dim rollRadians As Double
Dim sr As Single
Dim sp As Single
Dim sy As Single
Dim cr As Single
Dim cp As Single
Dim cy As Single

'pitchRadians = DegreesToRadians(pitchDegrees)
'yawRadians = DegreesToRadians(yawDegrees)
'rollRadians = DegreesToRadians(rollDegrees)

sy = CSng(Math.Sin(yawRadians))
cy = CSng(Math.Cos(yawRadians))
sp = CSng(Math.Sin(pitchRadians))
cp = CSng(Math.Cos(pitchRadians))
sr = CSng(Math.Sin(rollRadians))
cr = CSng(Math.Cos(rollRadians))

matrixColumn0.x = cp * cy
matrixColumn0.y = cp * sy
matrixColumn0.z = -sp
matrixColumn1.x = sr * sp * cy + cr * -sy
matrixColumn1.y = sr * sp * sy + cr * cy
matrixColumn1.z = sr * cp
matrixColumn2.x = (cr * sp * cy + -sr * -sy)
matrixColumn2.y = (cr * sp * sy + -sr * cy)
matrixColumn2.z = cr * cp
matrixColumn3.x = 0
matrixColumn3.y = 0
matrixColumn3.z = 0
End Sub
Public Sub AngleMatrix(ByVal pitchRadians As Double, ByVal yawRadians As Double, ByVal rollRadians As Double, ByRef matrixColumn0 As SourceVector, ByRef matrixColumn1 As SourceVector, ByRef matrixColumn2 As SourceVector, ByRef matrixColumn3 As SourceVector)
'Dim pitchRadians As Double
'Dim yawRadians As Double
Expand Down Expand Up @@ -439,22 +404,6 @@ Module MathModule
' out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] +
' in1[2][2] * in2[2][3] + in1[2][3];
'}
Public Sub R_ConcatTransforms(ByVal in1_matrixColumn0 As SourceVectorSingle, ByVal in1_matrixColumn1 As SourceVectorSingle, ByVal in1_matrixColumn2 As SourceVectorSingle, ByVal in1_matrixColumn3 As SourceVectorSingle, ByVal in2_matrixColumn0 As SourceVectorSingle, ByVal in2_matrixColumn1 As SourceVectorSingle, ByVal in2_matrixColumn2 As SourceVectorSingle, ByVal in2_matrixColumn3 As SourceVectorSingle, ByRef out_matrixColumn0 As SourceVectorSingle, ByRef out_matrixColumn1 As SourceVectorSingle, ByRef out_matrixColumn2 As SourceVectorSingle, ByRef out_matrixColumn3 As SourceVectorSingle)
out_matrixColumn0.x = in1_matrixColumn0.x * in2_matrixColumn0.x + in1_matrixColumn1.x * in2_matrixColumn0.y + in1_matrixColumn2.x * in2_matrixColumn0.z
out_matrixColumn1.x = in1_matrixColumn0.x * in2_matrixColumn1.x + in1_matrixColumn1.x * in2_matrixColumn1.y + in1_matrixColumn2.x * in2_matrixColumn1.z
out_matrixColumn2.x = in1_matrixColumn0.x * in2_matrixColumn2.x + in1_matrixColumn1.x * in2_matrixColumn2.y + in1_matrixColumn2.x * in2_matrixColumn2.z
out_matrixColumn3.x = in1_matrixColumn0.x * in2_matrixColumn3.x + in1_matrixColumn1.x * in2_matrixColumn3.y + in1_matrixColumn2.x * in2_matrixColumn3.z + in1_matrixColumn3.x

out_matrixColumn0.y = in1_matrixColumn0.y * in2_matrixColumn0.x + in1_matrixColumn1.y * in2_matrixColumn0.y + in1_matrixColumn2.y * in2_matrixColumn0.z
out_matrixColumn1.y = in1_matrixColumn0.y * in2_matrixColumn1.x + in1_matrixColumn1.y * in2_matrixColumn1.y + in1_matrixColumn2.y * in2_matrixColumn1.z
out_matrixColumn2.y = in1_matrixColumn0.y * in2_matrixColumn2.x + in1_matrixColumn1.y * in2_matrixColumn2.y + in1_matrixColumn2.y * in2_matrixColumn2.z
out_matrixColumn3.y = in1_matrixColumn0.y * in2_matrixColumn3.x + in1_matrixColumn1.y * in2_matrixColumn3.y + in1_matrixColumn2.y * in2_matrixColumn3.z + in1_matrixColumn3.y

out_matrixColumn0.z = in1_matrixColumn0.z * in2_matrixColumn0.x + in1_matrixColumn1.z * in2_matrixColumn0.y + in1_matrixColumn2.z * in2_matrixColumn0.z
out_matrixColumn1.z = in1_matrixColumn0.z * in2_matrixColumn1.x + in1_matrixColumn1.z * in2_matrixColumn1.y + in1_matrixColumn2.z * in2_matrixColumn1.z
out_matrixColumn2.z = in1_matrixColumn0.z * in2_matrixColumn2.x + in1_matrixColumn1.z * in2_matrixColumn2.y + in1_matrixColumn2.z * in2_matrixColumn2.z
out_matrixColumn3.z = in1_matrixColumn0.z * in2_matrixColumn3.x + in1_matrixColumn1.z * in2_matrixColumn3.y + in1_matrixColumn2.z * in2_matrixColumn3.z + in1_matrixColumn3.z
End Sub
Public Sub R_ConcatTransforms(ByVal in1_matrixColumn0 As SourceVector, ByVal in1_matrixColumn1 As SourceVector, ByVal in1_matrixColumn2 As SourceVector, ByVal in1_matrixColumn3 As SourceVector, ByVal in2_matrixColumn0 As SourceVector, ByVal in2_matrixColumn1 As SourceVector, ByVal in2_matrixColumn2 As SourceVector, ByVal in2_matrixColumn3 As SourceVector, ByRef out_matrixColumn0 As SourceVector, ByRef out_matrixColumn1 As SourceVector, ByRef out_matrixColumn2 As SourceVector, ByRef out_matrixColumn3 As SourceVector)
out_matrixColumn0.x = in1_matrixColumn0.x * in2_matrixColumn0.x + in1_matrixColumn1.x * in2_matrixColumn0.y + in1_matrixColumn2.x * in2_matrixColumn0.z
out_matrixColumn1.x = in1_matrixColumn0.x * in2_matrixColumn1.x + in1_matrixColumn1.x * in2_matrixColumn1.y + in1_matrixColumn2.x * in2_matrixColumn1.z
Expand Down Expand Up @@ -537,18 +486,10 @@ Module MathModule
'{
' return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
'}
Public Function DotProduct(ByVal vector1 As SourceVectorSingle, ByVal vector2 As SourceVectorSingle) As Single
Return vector1.x * vector2.x + vector1.y * vector2.y + vector1.z * vector2.z
End Function
Public Function DotProduct(ByVal vector1 As SourceVector, ByVal vector2 As SourceVector) As Double
Return vector1.x * vector2.x + vector1.y * vector2.y + vector1.z * vector2.z
End Function

Public Sub VectorCopy(ByVal input As SourceVectorSingle, ByRef output As SourceVectorSingle)
output.x = input.x
output.y = input.y
output.z = input.z
End Sub

Public Sub VectorCopy(ByVal input As SourceVector, ByRef output As SourceVector)
output.x = input.x
Expand All @@ -563,35 +504,6 @@ Module MathModule
' out[1] = DotProduct(in1, in2[1]);
' out[2] = DotProduct(in1, in2[2]);
'}
Public Function VectorRotate(ByVal input As SourceVectorSingle, ByVal matrixColumn0 As SourceVectorSingle, ByVal matrixColumn1 As SourceVectorSingle, ByVal matrixColumn2 As SourceVectorSingle, ByVal matrixColumn3 As SourceVectorSingle) As SourceVectorSingle
Dim output As SourceVectorSingle
Dim matrixRow0 As SourceVectorSingle
Dim matrixRow1 As SourceVectorSingle
Dim matrixRow2 As SourceVectorSingle

output = New SourceVectorSingle()
matrixRow0 = New SourceVectorSingle()
matrixRow1 = New SourceVectorSingle()
matrixRow2 = New SourceVectorSingle()

matrixRow0.x = matrixColumn0.x
matrixRow0.y = matrixColumn1.x
matrixRow0.z = matrixColumn2.x

matrixRow1.x = matrixColumn0.y
matrixRow1.y = matrixColumn1.y
matrixRow1.z = matrixColumn2.y

matrixRow2.x = matrixColumn0.z
matrixRow2.y = matrixColumn1.z
matrixRow2.z = matrixColumn2.z

output.x = DotProduct(input, matrixRow0)
output.y = DotProduct(input, matrixRow1)
output.z = DotProduct(input, matrixRow2)

Return output
End Function
Public Function VectorRotate(ByVal input As SourceVector, ByVal matrixColumn0 As SourceVector, ByVal matrixColumn1 As SourceVector, ByVal matrixColumn2 As SourceVector, ByVal matrixColumn3 As SourceVector) As SourceVector
Dim output As SourceVector
Dim matrixRow0 As SourceVector
Expand Down Expand Up @@ -662,24 +574,6 @@ Module MathModule
'
' return length;
'}
Public Function VectorNormalize(ByRef ioVector As SourceVectorSingle) As Single
Dim length As Single

length = 0
length += ioVector.x * ioVector.x
length += ioVector.y * ioVector.y
length += ioVector.z * ioVector.z
length = CSng(Math.Sqrt(length))
If length = 0 Then
Return 0
End If

ioVector.x /= length
ioVector.y /= length
ioVector.z /= length

Return length
End Function
Public Function VectorNormalize(ByRef ioVector As SourceVector) As Double
Dim length As Double

Expand Down Expand Up @@ -710,35 +604,6 @@ Module MathModule
' out[1] = DotProduct(in1, in2[1]) + in2[1][3];
' out[2] = DotProduct(in1, in2[2]) + in2[2][3];
'}
Public Function VectorTransform(ByVal input As SourceVectorSingle, ByVal matrixColumn0 As SourceVectorSingle, ByVal matrixColumn1 As SourceVectorSingle, ByVal matrixColumn2 As SourceVectorSingle, ByVal matrixColumn3 As SourceVectorSingle) As SourceVectorSingle
Dim output As SourceVectorSingle
Dim matrixRow0 As SourceVectorSingle
Dim matrixRow1 As SourceVectorSingle
Dim matrixRow2 As SourceVectorSingle

output = New SourceVectorSingle()
matrixRow0 = New SourceVectorSingle()
matrixRow1 = New SourceVectorSingle()
matrixRow2 = New SourceVectorSingle()

matrixRow0.x = matrixColumn0.x
matrixRow0.y = matrixColumn1.x
matrixRow0.z = matrixColumn2.x

matrixRow1.x = matrixColumn0.y
matrixRow1.y = matrixColumn1.y
matrixRow1.z = matrixColumn2.y

matrixRow2.x = matrixColumn0.z
matrixRow2.y = matrixColumn1.z
matrixRow2.z = matrixColumn2.z

output.x = DotProduct(input, matrixRow0) + matrixColumn3.x
output.y = DotProduct(input, matrixRow1) + matrixColumn3.y
output.z = DotProduct(input, matrixRow2) + matrixColumn3.z

Return output
End Function
Public Function VectorTransform(ByVal input As SourceVector, ByVal matrixColumn0 As SourceVector, ByVal matrixColumn1 As SourceVector, ByVal matrixColumn2 As SourceVector, ByVal matrixColumn3 As SourceVector) As SourceVector
Dim output As SourceVector
Dim matrixRow0 As SourceVector
Expand Down
66 changes: 33 additions & 33 deletions Crowbar/Core/DebugLog/AccessedBytesDebugFile.vb
Original file line number Diff line number Diff line change
Expand Up @@ -32,42 +32,42 @@ Public Class AccessedBytesDebugFile
line = "====== File Seek Log ======"
Me.WriteLogLine(0, line)

line = "--- Summary ---"
Me.WriteLogLine(0, line)
'line = "--- Summary ---"
'Me.WriteLogLine(0, line)

Dim offsetStart As Long
Dim offsetEnd As Long
offsetStart = -1
offsetEnd = -1
For i As Integer = 0 To aFileSeekLog.theFileSeekList.Count - 1
If offsetStart = -1 Then
offsetStart = aFileSeekLog.theFileSeekList.Keys(i)
End If
offsetEnd = aFileSeekLog.theFileSeekList.Values(i)

If aFileSeekLog.theFileSeekDescriptionList.Values(i).StartsWith("[ERROR] Unread bytes") Then
If i > 0 Then
line = offsetStart.ToString("N0") + " - " + (aFileSeekLog.theFileSeekList.Keys(i) - 1).ToString("N0")
Me.WriteLogLine(1, line)
End If
If aFileSeekLog.theFileSeekDescriptionList.Values(i).StartsWith("[ERROR] Unread bytes (all zeroes)") Then
line = aFileSeekLog.theFileSeekList.Keys(i).ToString("N0") + " - " + offsetEnd.ToString("N0") + " [ERROR] Unread bytes (all zeroes)"
Else
line = aFileSeekLog.theFileSeekList.Keys(i).ToString("N0") + " - " + offsetEnd.ToString("N0") + " [ERROR] Unread bytes (non-zero)"
End If
Me.WriteLogLine(1, line)
offsetStart = -1
ElseIf (i = aFileSeekLog.theFileSeekList.Count - 1) OrElse (offsetEnd + 1 <> aFileSeekLog.theFileSeekList.Keys(i + 1)) Then
line = offsetStart.ToString("N0") + " - " + offsetEnd.ToString("N0")
Me.WriteLogLine(1, line)
offsetStart = -1
End If
Next

line = "------------------------"
Me.WriteLogLine(0, line)
line = "--- Each Section or Loop ---"
Me.WriteLogLine(0, line)
'offsetStart = -1
'offsetEnd = -1
'For i As Integer = 0 To aFileSeekLog.theFileSeekList.Count - 1
' If offsetStart = -1 Then
' offsetStart = aFileSeekLog.theFileSeekList.Keys(i)
' End If
' offsetEnd = aFileSeekLog.theFileSeekList.Values(i)

' If aFileSeekLog.theFileSeekDescriptionList.Values(i).StartsWith("[ERROR] Unread bytes") Then
' If i > 0 Then
' line = offsetStart.ToString("N0") + " - " + (aFileSeekLog.theFileSeekList.Keys(i) - 1).ToString("N0")
' Me.WriteLogLine(1, line)
' End If
' If aFileSeekLog.theFileSeekDescriptionList.Values(i).StartsWith("[ERROR] Unread bytes (all zeroes)") Then
' line = aFileSeekLog.theFileSeekList.Keys(i).ToString("N0") + " - " + offsetEnd.ToString("N0") + " [ERROR] Unread bytes (all zeroes)"
' Else
' line = aFileSeekLog.theFileSeekList.Keys(i).ToString("N0") + " - " + offsetEnd.ToString("N0") + " [ERROR] Unread bytes (non-zero)"
' End If
' Me.WriteLogLine(1, line)
' offsetStart = -1
' ElseIf (i = aFileSeekLog.theFileSeekList.Count - 1) OrElse (offsetEnd + 1 <> aFileSeekLog.theFileSeekList.Keys(i + 1)) Then
' line = offsetStart.ToString("N0") + " - " + offsetEnd.ToString("N0")
' Me.WriteLogLine(1, line)
' offsetStart = -1
' End If
'Next

'line = "------------------------"
'Me.WriteLogLine(0, line)
'line = "--- Each Section or Loop ---"
'Me.WriteLogLine(0, line)

offsetEnd = -1
For i As Integer = 0 To aFileSeekLog.theFileSeekList.Count - 1
Expand Down
20 changes: 20 additions & 0 deletions Crowbar/Core/DebugLog/FileSeekLog.vb
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,32 @@ Public Class FileSeekLog
Catch ex As Exception
Dim debug As Integer = 4242
End Try

Me.LogErrors()
End Sub

Public theFileSize As Long
Public theFileSeekList As SortedList(Of Long, Long)
Public theFileSeekDescriptionList As SortedList(Of Long, String)

Private Sub LogErrors()
Dim offsetStart As Long
Dim offsetEnd As Long

Try
For i As Integer = 0 To Me.theFileSeekList.Count - 1
offsetStart = Me.theFileSeekList.Keys(i)
offsetEnd = Me.theFileSeekList.Values(i)

If (i < Me.theFileSeekList.Count - 1) AndAlso (offsetEnd + 1 <> Me.theFileSeekList.Keys(i + 1)) Then
Me.theFileSeekDescriptionList(offsetStart) = "[ERROR] [End offset is incorrect] " + Me.theFileSeekDescriptionList(offsetStart)
End If
Next
Catch ex As Exception
Dim debug As Integer = 4242
End Try
End Sub

Private Function GetByteValues(ByVal inputFileReader As BinaryReader, ByVal fileOffsetStart2 As Long, ByVal fileOffsetEnd2 As Long, ByRef allZeroesWereFound As Boolean) As String
Dim byteValues As String

Expand Down
File renamed without changes.
Loading

0 comments on commit 5e4effa

Please sign in to comment.