Globally assign attachment orientations
This commit is contained in:
@@ -3,6 +3,7 @@ module Dodge.Creature.State (
|
|||||||
doDamage,
|
doDamage,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Dodge.Item.Orientation
|
||||||
import Dodge.Item.UseDelay
|
import Dodge.Item.UseDelay
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
@@ -294,9 +295,9 @@ chainLinkOrientation ::
|
|||||||
ItemLink ->
|
ItemLink ->
|
||||||
CItem ->
|
CItem ->
|
||||||
(Point3, Q.Quaternion Float)
|
(Point3, Q.Quaternion Float)
|
||||||
chainLinkOrientation (p, q) par (ILink lt f) child = (p + Q.rotate q p1, q * q1)
|
chainLinkOrientation (p, q) par (ILink lt) child = (p + Q.rotate q p1, q * q1)
|
||||||
where
|
where
|
||||||
(p1, q1) = f (par ^. _1) lt (child ^. _1)
|
(p1, q1) = orientAttachment (par ^. _1) lt (child ^. _1)
|
||||||
|
|
||||||
updateItemWithOrientation ::
|
updateItemWithOrientation ::
|
||||||
Creature ->
|
Creature ->
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import Dodge.Data.AmmoType
|
|||||||
import Dodge.Data.DoubleTree
|
import Dodge.Data.DoubleTree
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Dodge.Data.Item
|
import Dodge.Data.Item
|
||||||
import Geometry.Data
|
|
||||||
import Linear.Quaternion (Quaternion (..))
|
|
||||||
|
|
||||||
data CLinkType
|
data CLinkType
|
||||||
= AmmoInLink Int AmmoType
|
= AmmoInLink Int AmmoType
|
||||||
@@ -69,7 +67,8 @@ type CItem = (Item, ItemStructuralFunction, LinkTest)
|
|||||||
|
|
||||||
data ItemLink = ILink
|
data ItemLink = ILink
|
||||||
{ _iatType :: CLinkType
|
{ _iatType :: CLinkType
|
||||||
, _iatOrient :: Item -> CLinkType -> Item -> (Point3, Quaternion Float)
|
-- , _iatOrient :: Item -> CLinkType -> Item -> (Point3, Quaternion Float)
|
||||||
|
-- , _iatOrient :: Item -> CLinkType -> (Point3, Quaternion Float)
|
||||||
}
|
}
|
||||||
|
|
||||||
-- this should possibly use a full item structure tree rather than a
|
-- this should possibly use a full item structure tree rather than a
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ module Dodge.Item.Draw.SPic (
|
|||||||
itemTreeSPic,
|
itemTreeSPic,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Dodge.Item.Orientation
|
||||||
import Dodge.Item.MaxAmmo
|
import Dodge.Item.MaxAmmo
|
||||||
import Color
|
import Color
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
@@ -28,7 +29,7 @@ itemTreeSPic (LDT (itm,_,_) l r) =
|
|||||||
itemRotTreeSPic :: Item -> (ItemLink, LabelDoubleTree ItemLink CItem) -> SPic
|
itemRotTreeSPic :: Item -> (ItemLink, LabelDoubleTree ItemLink CItem) -> SPic
|
||||||
itemRotTreeSPic par (il, t) = translateSP p . overPosSP (Q.rotate q) $ itemTreeSPic t
|
itemRotTreeSPic par (il, t) = translateSP p . overPosSP (Q.rotate q) $ itemTreeSPic t
|
||||||
where
|
where
|
||||||
(p, q) = _iatOrient il par (_iatType il) itm
|
(p, q) = orientAttachment par (_iatType il) itm
|
||||||
itm = t ^. ldtValue . _1
|
itm = t ^. ldtValue . _1
|
||||||
|
|
||||||
itemSPic :: Item -> SPic
|
itemSPic :: Item -> SPic
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import Dodge.Data.ComposedItem
|
|||||||
import Dodge.Data.DoubleTree
|
import Dodge.Data.DoubleTree
|
||||||
import Dodge.Data.Item
|
import Dodge.Data.Item
|
||||||
import Dodge.DoubleTree
|
import Dodge.DoubleTree
|
||||||
import Dodge.Item.Orientation
|
|
||||||
import LensHelp
|
import LensHelp
|
||||||
import ListHelp
|
import ListHelp
|
||||||
|
|
||||||
@@ -40,7 +39,7 @@ useBreakL ::
|
|||||||
LinkTest
|
LinkTest
|
||||||
useBreakL x y = useBreakListsLinkTest (map (uncurry noa) x) (map (uncurry noa) y)
|
useBreakL x y = useBreakListsLinkTest (map (uncurry noa) x) (map (uncurry noa) y)
|
||||||
where
|
where
|
||||||
noa a b = (a, ILink b orientAttachment)
|
noa a b = (a, ILink b)
|
||||||
|
|
||||||
useBreakListsLinkTest ::
|
useBreakListsLinkTest ::
|
||||||
[(ItemStructuralFunction, ItemLink)] ->
|
[(ItemStructuralFunction, ItemLink)] ->
|
||||||
@@ -216,7 +215,7 @@ llright itm pci = case pci ^. ldtValue . _1 . itType of
|
|||||||
toLasgunUpdate :: Item -> LinkUpdate
|
toLasgunUpdate :: Item -> LinkUpdate
|
||||||
toLasgunUpdate itm =
|
toLasgunUpdate itm =
|
||||||
LUpdate
|
LUpdate
|
||||||
(ILink FunctionChangeLink orientAttachment)
|
(ILink FunctionChangeLink)
|
||||||
(\(par, _, _) -> (par, HeldPlatformSF, uncurry useBreakL $ itemToBreakLists itm HeldPlatformSF))
|
(\(par, _, _) -> (par, HeldPlatformSF, uncurry useBreakL $ itemToBreakLists itm HeldPlatformSF))
|
||||||
(\(chi, _, up) -> (chi, FunctionChangeSF, up))
|
(\(chi, _, up) -> (chi, FunctionChangeSF, up))
|
||||||
|
|
||||||
@@ -226,7 +225,7 @@ springLinkTest = LTest (const Nothing) $
|
|||||||
CRAFT HARDWARE ->
|
CRAFT HARDWARE ->
|
||||||
Just
|
Just
|
||||||
( LUpdate
|
( LUpdate
|
||||||
(ILink FunctionChangeLink orientAttachment)
|
(ILink FunctionChangeLink)
|
||||||
(\(par, _, up) -> (par, MakeAutoSF, up))
|
(\(par, _, up) -> (par, MakeAutoSF, up))
|
||||||
(\(chi, _, up) -> (chi, FunctionChangeSF, up))
|
(\(chi, _, up) -> (chi, FunctionChangeSF, up))
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user