Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better V53/V52 Support #30

Merged
merged 47 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
2c59443
fixes jiggle bones on v53
IJARika Aug 11, 2022
f417463
quick v52 bone update
IJARika Aug 11, 2022
bd2ffa9
working ik chain for v53
IJARika Aug 11, 2022
9134f35
formatting and v52 hdr updating
IJARika Aug 11, 2022
06e4f33
clean up
IJARika Aug 11, 2022
5875ead
partial update of the smd file
IJARika Aug 11, 2022
8b5ef56
swap version back
IJARika Aug 11, 2022
3ff7106
yep
IJARika Aug 26, 2022
5f609a3
some anim fixes plus updated smd file
IJARika Aug 26, 2022
85ffde8
Progress on MDL 53 animation decompiling.
ZeqMacaw Aug 26, 2022
16a929c
more anim
IJARika Aug 27, 2022
8b20d05
fix ikchains and add bone flag for later use
IJARika Aug 29, 2022
745e8df
Merge pull request #1 from IJARika/respawn-mdl
IJARika Aug 29, 2022
9ff01c6
add $worldalign (this is actually a csgo thing)
IJARika Aug 29, 2022
1d13fd6
removed duplicate line
IJARika Aug 29, 2022
8a49963
add exporting some extra data even if it can't be used
IJARika Aug 30, 2022
77d3365
add aabb header, and comments
IJARika Aug 31, 2022
ef07452
Progress on MDL 53 animation decompiling -- Anim values decompiled now.
ZeqMacaw Aug 31, 2022
c679f48
Fix size of ikrule struct.
ZeqMacaw Aug 31, 2022
60c2c58
Fix reading of empty struct at end of list of SourceMdlAnimation. Fix…
ZeqMacaw Aug 31, 2022
8d7ff8e
fixes v52 bone
IJARika Aug 31, 2022
b775ae1
Merge branch 'anim2' into respawn-mdl
IJARika Aug 31, 2022
506766d
fade distance v52
IJARika Sep 1, 2022
809cf3b
FIXED: MDL53 animation position xyz from "anim values" are all read i…
ZeqMacaw Sep 1, 2022
a86bcc9
Adjust MDL53 anim rotation to match MDL52 example model, ogre_titan.
ZeqMacaw Sep 1, 2022
166d0fd
minor changes
IJARika Sep 3, 2022
a30e961
Merge branch 'pre-merger' into merge-into-pre-merger
IJARika Sep 3, 2022
d6a3177
Merge pull request #7 from IJARika/merge-into-pre-merger
IJARika Sep 3, 2022
1a5a865
merge cleanup
IJARika Sep 3, 2022
ce3222d
Update SourceMdlFile53.vb
IJARika Sep 3, 2022
907b431
minor command cleanup
IJARika Sep 6, 2022
49845c0
add some rui structs, get more v52/v53 data reading
IJARika Sep 7, 2022
2b45c3e
Changed IKRule structure and made progress on anim sections.
ZeqMacaw Sep 8, 2022
b6b0c2e
rui start
IJARika Sep 8, 2022
5564974
Merge branch 'sections' into mdl-anim-new
IJARika Sep 8, 2022
ec16f86
Merge pull request #9 from IJARika/mdl-anim-new
IJARika Sep 8, 2022
8c943e1
fix error and activity modifiers
IJARika Sep 8, 2022
6ec5f73
minor changes
IJARika Sep 13, 2022
713e2b8
Merge pull request #10 from IJARika/sections
IJARika Sep 13, 2022
b43a044
Merge pull request #11 from IJARika/pre-merger
IJARika Sep 13, 2022
8a9086a
temporary mass fix + activity modifier on v52
IJARika Sep 13, 2022
4821ef4
fixes last issue with anims sometimes having bad position
IJARika Sep 19, 2022
35871eb
fix v53 activity modifiers
IJARika Sep 20, 2022
19e5a15
add support for delta anims in v53
IJARika Sep 25, 2022
7a30198
fix actmods and tweak frame anims for v52
IJARika Nov 13, 2022
8138835
some minor cleanups
IJARika Nov 14, 2022
157c204
Revert back to Framework 4.0 to keep XP compatibility.
ZeqMacaw Jan 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Public Class SourceMdlActivityModifier

Public nameOffset As Integer

' V53/V52 has an int here that needs to be read for proper output. 0 or 1.
Public unk As Integer

Public theName As String

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ Public Class SourceMdlAnimation
' short nextoffset;
Public nextSourceMdlAnimationOffset As Short

'MDL 53 stuff
Public positionScale As Double
Public unk As Short
'Public OffsetX As Short
'Public OffsetY As Short
'Public OffsetZ As Short
'Public OffsetL As Short
Public PosX As SourceFloat16bits
Public PosY As SourceFloat16bits
Public PosZ As SourceFloat16bits
Public ScaleX As SourceFloat16bits
Public ScaleY As SourceFloat16bits
Public ScaleZ As SourceFloat16bits
Public nextTitanfall2MdlAnimationOffset As Integer


' Values for the field, flags:
'#define STUDIO_ANIM_RAWPOS 0x01 // Vector48
Expand All @@ -47,6 +62,20 @@ Public Class SourceMdlAnimation
Public Const STUDIO_ANIM_DELTA As Integer = &H10
Public Const STUDIO_ANIM_RAWROT2 As Integer = &H20

' MDL 53 values for flags:
'#define STUDIO_ANIM_DELTA_53 0x01 // this appears to be delta until proven otherwise
'// These work as toggles, flag enabled is raw data, flag disabled is pointers, see 'STUDIO_ANIM_READBONE_53' for exception.
'#define STUDIO_ANIM_RAWPOS_53 0x02 // Vector48
'#define STUDIO_ANIM_RAWROT_53 0x04 // Quaternion48
'#define STUDIO_ANIM_RAWSCALE_53 0x08 // Vector48
'// if above flag is disabled and below is enabled there is special exceptions
'#define STUDIO_ANIM_READBONE_53 0x10 // read bone data if any Of the above are disabled, only observed For rotation
Public Const STUDIO_ANIM_DELTA_53 As Integer = &H1
Public Const STUDIO_ANIM_RAWPOS_53 As Integer = &H2
Public Const STUDIO_ANIM_RAWROT_53 As Integer = &H4
Public Const STUDIO_ANIM_RAWSCALE_53 As Integer = &H8
Public Const STUDIO_ANIM_UNKFLAG_53 As Integer = &H10


' Do not use union, because it will have to rely on size of a .NET Framework data type.
'<StructLayout(LayoutKind.Explicit)> _
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ Public Class SourceMdlBone
'#define BONE_HAS_SAVEFRAME_ROT 0x00400000
Public Const BONE_SCREEN_ALIGN_SPHERE As Integer = &H8
Public Const BONE_SCREEN_ALIGN_CYLINDER As Integer = &H10
Public Const BONE_WORLD_ALIGN As Integer = &H20
Public Const BONE_USED_BY_VERTEX_LOD0 As Integer = &H400
Public Const BONE_USED_BY_VERTEX_LOD1 As Integer = &H800
Public Const BONE_USED_BY_VERTEX_LOD2 As Integer = &H1000
Expand Down
18 changes: 18 additions & 0 deletions Crowbar/Core/GameModel/SourceGlobal/SourceQuaternion64bits.vb
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,22 @@ Public Class SourceQuaternion64bits
<FieldOffset(0)> Public s As Single
End Structure

Public ReadOnly Property XOffset() As UInt16
Get
Return BitConverter.ToUInt16(Me.theBytes, 0)
End Get
End Property

Public ReadOnly Property YOffset() As UInt16
Get
Return BitConverter.ToUInt16(Me.theBytes, 2)
End Get
End Property

Public ReadOnly Property ZOffset() As UInt16
Get
Return BitConverter.ToUInt16(Me.theBytes, 4)
End Get
End Property

End Class
35 changes: 35 additions & 0 deletions Crowbar/Core/GameModel/SourceModel49/SourceQcFile49.vb
Original file line number Diff line number Diff line change
Expand Up @@ -3973,6 +3973,8 @@ Public Class SourceQcFile49
Me.WriteBoneMergeCommand()
Me.WriteLimitRotationCommand()

Me.WriteWorldAlignCommand()

Me.WriteProceduralBonesCommand()
Me.WriteJiggleBoneCommand()
End Sub
Expand Down Expand Up @@ -4180,6 +4182,39 @@ Public Class SourceQcFile49
End If
End Sub

Private Sub WriteWorldAlignCommand()
Dim line As String = ""

' used in CS:GO
'$worldalign "ValveBiped.Bip01_R_Hand"
If Me.theMdlFileData.theBones IsNot Nothing Then
Dim aBone As SourceMdlBone
Dim emptyLineIsAlreadyWritten As Boolean

emptyLineIsAlreadyWritten = False
For i As Integer = 0 To Me.theMdlFileData.theBones.Count - 1
aBone = Me.theMdlFileData.theBones(i)

If (aBone.flags And SourceMdlBone.BONE_WORLD_ALIGN) > 0 Then
If Not emptyLineIsAlreadyWritten Then
Me.theOutputFileStreamWriter.WriteLine()
emptyLineIsAlreadyWritten = True
End If

If TheApp.Settings.DecompileQcUseMixedCaseForKeywordsIsChecked Then
line = "$WorldAlign "
Else
line = "$worldalign "
End If
line += """"
line += aBone.theName
line += """"
Me.theOutputFileStreamWriter.WriteLine(line)
End If
Next
End If
End Sub

Private Sub WriteJiggleBoneCommand()
If Me.theMdlFileData.theBones Is Nothing Then
Return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ Public Class SourceAniFrameAnim52
Public constantsOffset As Integer
Public frameOffset As Integer
Public frameLength As Integer
Public unused(2) As Integer
Public oldBoneFlags As Integer
Public unkDataIndex As Integer
Public unused As Integer


'NOTE: These are indexed by global bone index.
Expand All @@ -34,26 +36,12 @@ Public Class SourceAniFrameAnim52
'NOTE: This is indexed by frame index and global bone index.
Public theBoneFrameDataInfos As List(Of List(Of BoneFrameDataInfo49))

'FROM: AlienSwarm_source\src\public\studio.h
' Values for the field, theBoneFlags:
'#define STUDIO_FRAME_RAWPOS 0x01 // Vector48 in constants
'#define STUDIO_FRAME_RAWROT 0x02 // Quaternion48 in constants
'#define STUDIO_FRAME_ANIMPOS 0x04 // Vector48 in framedata
'#define STUDIO_FRAME_ANIMROT 0x08 // Quaternion48 in framedata
'#define STUDIO_FRAME_FULLANIMPOS 0x10 // Vector in framedata
' In V52 they added scale tracks and redid how these work
Public Const STUDIO_FRAME_RAWPOS As Integer = &H1
Public Const STUDIO_FRAME_RAWROT As Integer = &H2
Public Const STUDIO_FRAME_ANIMPOS As Integer = &H4
Public Const STUDIO_FRAME_ANIMROT As Integer = &H8
Public Const STUDIO_FRAME_FULLANIMPOS As Integer = &H10

'Public Const STUDIO_FRAME_UNKNOWN01 As Integer = &H40 ' Seems to be 6 rotation bytes in constants based on tests. New format that is not Quaternion48. Maybe Quaternion48Smallest3?
'Public Const STUDIO_FRAME_UNKNOWN02 As Integer = &H80 ' Seems to be 6 rotation bytes in framedata based on tests. New format that is not Quaternion48. Maybe Quaternion48Smallest3?
'FROM: Kerry at Valve via Splinks on 24-Apr-2017
'#define STUDIO_FRAME_CONST_ROT2 0x40 // Quaternion48S in constants
'#define STUDIO_FRAME_ANIM_ROT2 0x80 // Quaternion48S in framedata
Public Const STUDIO_FRAME_CONST_ROT2 As Integer = &H40
Public Const STUDIO_FRAME_ANIM_ROT2 As Integer = &H80

Public Const STUDIO_FRAME_RAWSCALE As Integer = &H4
Public Const STUDIO_FRAME_ANIMPOS As Integer = &H8
Public Const STUDIO_FRAME_ANIMROT As Integer = &H10
Public Const STUDIO_FRAME_ANIMSCALE As Integer = &H20

End Class
Loading