Cutscene viewer loading and animating props

This commit is contained in:
dexy 2019-11-26 03:10:48 +11:00
parent f67731ddd4
commit 7e240682d0

View File

@ -486,6 +486,25 @@ namespace CodeWalker.World
obj.Ped.Rotation = rot; obj.Ped.Rotation = rot;
obj.Ped.AnimClip = cme; obj.Ped.AnimClip = cme;
} }
if (obj.Prop != null)
{
ycd.CutsceneMap.TryGetValue(obj.Prop.Archetype?.Hash ?? 0, out cme);
var pos = Position;
var rot = Rotation;
if (cme != null)
{
cme.OverridePlayTime = true;
cme.PlayTime = cutOffset;
updateObjectTransform(obj, cme, 0, 5, 6);
pos = pos + rot.Multiply(obj.Position);
rot = rot * obj.Rotation;
}
obj.Prop.Position = pos;
obj.Prop.Orientation = rot;
}
} }
} }
@ -509,6 +528,10 @@ namespace CodeWalker.World
{ {
renderer.RenderPed(obj.Ped); renderer.RenderPed(obj.Ped);
} }
if (obj.Prop != null)
{
renderer.RenderArchetype(obj.Prop.Archetype, obj.Prop);
}
} }
} }
@ -968,6 +991,9 @@ namespace CodeWalker.World
public Ped Ped { get; set; } public Ped Ped { get; set; }
public YmapEntityDef Prop { get; set; }
public void Init(CutObject obj, GameFileCache gfc) public void Init(CutObject obj, GameFileCache gfc)
{ {
@ -1066,6 +1092,10 @@ namespace CodeWalker.World
private void InitProp(CutPropModelObject prop, GameFileCache gfc) private void InitProp(CutPropModelObject prop, GameFileCache gfc)
{ {
var archetypeName = prop.StreamingName;
Prop = new YmapEntityDef();
Prop.SetArchetype(gfc.GetArchetype(archetypeName));
} }