From 758c0aeec8fd46d57d4d7689ab7b7a4eb987d7ac Mon Sep 17 00:00:00 2001 From: justin Date: Thu, 26 Jun 2025 20:59:38 +0100 Subject: [PATCH] Globally assign attachment orientations --- src/Dodge/Creature/State.hs | 5 +++-- src/Dodge/Data/ComposedItem.hs | 5 ++--- src/Dodge/Item/Draw/SPic.hs | 3 ++- src/Dodge/Item/Grammar.hs | 7 +++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Dodge/Creature/State.hs b/src/Dodge/Creature/State.hs index 8f4f63ba7..fca098320 100644 --- a/src/Dodge/Creature/State.hs +++ b/src/Dodge/Creature/State.hs @@ -3,6 +3,7 @@ module Dodge.Creature.State ( doDamage, ) where +import Dodge.Item.Orientation import Dodge.Item.UseDelay import Control.Applicative import Control.Monad @@ -294,9 +295,9 @@ chainLinkOrientation :: ItemLink -> CItem -> (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 - (p1, q1) = f (par ^. _1) lt (child ^. _1) + (p1, q1) = orientAttachment (par ^. _1) lt (child ^. _1) updateItemWithOrientation :: Creature -> diff --git a/src/Dodge/Data/ComposedItem.hs b/src/Dodge/Data/ComposedItem.hs index 3b55e7246..2eef3f036 100644 --- a/src/Dodge/Data/ComposedItem.hs +++ b/src/Dodge/Data/ComposedItem.hs @@ -9,8 +9,6 @@ import Dodge.Data.AmmoType import Dodge.Data.DoubleTree import Control.Lens import Dodge.Data.Item -import Geometry.Data -import Linear.Quaternion (Quaternion (..)) data CLinkType = AmmoInLink Int AmmoType @@ -69,7 +67,8 @@ type CItem = (Item, ItemStructuralFunction, LinkTest) data ItemLink = ILink { _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 diff --git a/src/Dodge/Item/Draw/SPic.hs b/src/Dodge/Item/Draw/SPic.hs index 846d2d6b8..c5d4da24b 100644 --- a/src/Dodge/Item/Draw/SPic.hs +++ b/src/Dodge/Item/Draw/SPic.hs @@ -5,6 +5,7 @@ module Dodge.Item.Draw.SPic ( itemTreeSPic, ) where +import Dodge.Item.Orientation import Dodge.Item.MaxAmmo import Color import Data.Maybe @@ -28,7 +29,7 @@ itemTreeSPic (LDT (itm,_,_) l r) = itemRotTreeSPic :: Item -> (ItemLink, LabelDoubleTree ItemLink CItem) -> SPic itemRotTreeSPic par (il, t) = translateSP p . overPosSP (Q.rotate q) $ itemTreeSPic t where - (p, q) = _iatOrient il par (_iatType il) itm + (p, q) = orientAttachment par (_iatType il) itm itm = t ^. ldtValue . _1 itemSPic :: Item -> SPic diff --git a/src/Dodge/Item/Grammar.hs b/src/Dodge/Item/Grammar.hs index e760bb5cb..df41cc9d5 100644 --- a/src/Dodge/Item/Grammar.hs +++ b/src/Dodge/Item/Grammar.hs @@ -24,7 +24,6 @@ import Dodge.Data.ComposedItem import Dodge.Data.DoubleTree import Dodge.Data.Item import Dodge.DoubleTree -import Dodge.Item.Orientation import LensHelp import ListHelp @@ -40,7 +39,7 @@ useBreakL :: LinkTest useBreakL x y = useBreakListsLinkTest (map (uncurry noa) x) (map (uncurry noa) y) where - noa a b = (a, ILink b orientAttachment) + noa a b = (a, ILink b) useBreakListsLinkTest :: [(ItemStructuralFunction, ItemLink)] -> @@ -216,7 +215,7 @@ llright itm pci = case pci ^. ldtValue . _1 . itType of toLasgunUpdate :: Item -> LinkUpdate toLasgunUpdate itm = LUpdate - (ILink FunctionChangeLink orientAttachment) + (ILink FunctionChangeLink) (\(par, _, _) -> (par, HeldPlatformSF, uncurry useBreakL $ itemToBreakLists itm HeldPlatformSF)) (\(chi, _, up) -> (chi, FunctionChangeSF, up)) @@ -226,7 +225,7 @@ springLinkTest = LTest (const Nothing) $ CRAFT HARDWARE -> Just ( LUpdate - (ILink FunctionChangeLink orientAttachment) + (ILink FunctionChangeLink) (\(par, _, up) -> (par, MakeAutoSF, up)) (\(chi, _, up) -> (chi, FunctionChangeSF, up)) )