Rename protypes/basic to default
This commit is contained in:
+4
-1
@@ -328,7 +328,7 @@ zoneOfSight :: World -> [(Int,Int)]
|
|||||||
zoneOfSight w = [(a,b) | a <- [minimum xs .. maximum xs]
|
zoneOfSight w = [(a,b) | a <- [minimum xs .. maximum xs]
|
||||||
, b <- [minimum ys .. maximum ys]
|
, b <- [minimum ys .. maximum ys]
|
||||||
]
|
]
|
||||||
where (xs,ys) = unzip $ map zoneOfPoint $ screenPolygon w ++ [_cameraCenter w]
|
where (xs,ys) = unzip $ map zoneOfPoint $ screenPolygon w ++ [_cameraViewFrom w]
|
||||||
|
|
||||||
screenPolygon :: World -> [Point2]
|
screenPolygon :: World -> [Point2]
|
||||||
screenPolygon w = [tr,tl,bl,br]
|
screenPolygon w = [tr,tl,bl,br]
|
||||||
@@ -751,6 +751,9 @@ cartePosToScreen w = doWindowScale . doRotate . doZoom . doTranslate
|
|||||||
mouseWorldPos :: World -> Point2
|
mouseWorldPos :: World -> Point2
|
||||||
mouseWorldPos w = _cameraPos w +.+ (1/_cameraZoom w) *.* rotateV (_cameraRot w) (_mousePos w)
|
mouseWorldPos w = _cameraPos w +.+ (1/_cameraZoom w) *.* rotateV (_cameraRot w) (_mousePos w)
|
||||||
|
|
||||||
|
mouseCartePos :: World -> Point2
|
||||||
|
mouseCartePos w = _carteCenter w +.+ (1/_carteZoom w) *.* rotateV (_carteRot w) (_mousePos w)
|
||||||
|
|
||||||
logistic :: Float -> Float -> Float -> (Float -> Float)
|
logistic :: Float -> Float -> Float -> (Float -> Float)
|
||||||
logistic x0 l k x = l / (1 + exp (k*(x0 - x)))
|
logistic x0 l k x = l / (1 + exp (k*(x0 - x)))
|
||||||
|
|
||||||
|
|||||||
+41
-41
@@ -3,7 +3,7 @@ module Dodge.Critters where
|
|||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.AIs
|
import Dodge.AIs
|
||||||
import Dodge.CreatureState
|
import Dodge.CreatureState
|
||||||
import Dodge.Prototypes
|
import Dodge.Default
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.Item.Weapon
|
import Dodge.Item.Weapon
|
||||||
import Dodge.Item.Consumable
|
import Dodge.Item.Consumable
|
||||||
@@ -37,87 +37,87 @@ colouredEnemy col = pictures [color col $ circleSolid 10, circLine 10]
|
|||||||
|
|
||||||
|
|
||||||
-- armouredSwarmCrit :: Int -> Creature
|
-- armouredSwarmCrit :: Int -> Creature
|
||||||
-- armouredSwarmCrit n = (basicCreature n)
|
-- armouredSwarmCrit n = (defaultCreature n)
|
||||||
-- -- { _crUpdate = encircleAI' n
|
-- -- { _crUpdate = encircleAI' n
|
||||||
-- { _crUpdate = swarmAI lineOrth n
|
-- { _crUpdate = swarmAI lineOrth n
|
||||||
-- , _crHP = 30
|
-- , _crHP = 30
|
||||||
-- , _crPict = equipOnTop goalPict
|
-- , _crPict = equipOnTop goalPict
|
||||||
-- , _crState = basicState {_goals = [[]], _faction = EncircleFlock}
|
-- , _crState = defaultState {_goals = [[]], _faction = EncircleFlock}
|
||||||
-- , _crInv = IM.fromList [(0,frontArmour)]
|
-- , _crInv = IM.fromList [(0,frontArmour)]
|
||||||
-- }
|
-- }
|
||||||
--
|
--
|
||||||
-- swarmCrit :: Int -> Creature
|
-- swarmCrit :: Int -> Creature
|
||||||
-- swarmCrit n = (basicCreature n)
|
-- swarmCrit n = (defaultCreature n)
|
||||||
-- -- { _crUpdate = encircleAI' n
|
-- -- { _crUpdate = encircleAI' n
|
||||||
-- { _crUpdate = swarmAI lineOrth n
|
-- { _crUpdate = swarmAI lineOrth n
|
||||||
-- , _crHP = 30
|
-- , _crHP = 30
|
||||||
-- , _crPict = equipOnTop goalPict
|
-- , _crPict = equipOnTop goalPict
|
||||||
-- , _crState = basicState {_goals = [[]], _faction = EncircleFlock}
|
-- , _crState = defaultState {_goals = [[]], _faction = EncircleFlock}
|
||||||
-- , _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
-- , _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
||||||
-- }
|
-- }
|
||||||
--
|
--
|
||||||
-- encircleCrit :: Int -> Creature
|
-- encircleCrit :: Int -> Creature
|
||||||
-- encircleCrit n = (basicCreature n)
|
-- encircleCrit n = (defaultCreature n)
|
||||||
-- -- { _crUpdate = encircleAI' n
|
-- -- { _crUpdate = encircleAI' n
|
||||||
-- { _crUpdate = swarmAI lineOrth n
|
-- { _crUpdate = swarmAI lineOrth n
|
||||||
-- , _crHP = 30
|
-- , _crHP = 30
|
||||||
-- , _crPict = equipOnTop goalPict
|
-- , _crPict = equipOnTop goalPict
|
||||||
-- , _crState = basicState {_goals = [[]], _faction = EncircleFlock}
|
-- , _crState = defaultState {_goals = [[]], _faction = EncircleFlock}
|
||||||
-- , _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
-- , _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
||||||
-- }
|
-- }
|
||||||
--
|
--
|
||||||
spawnerCrit :: Creature
|
spawnerCrit :: Creature
|
||||||
spawnerCrit = basicCreature
|
spawnerCrit = defaultCreature
|
||||||
{ _crUpdate = stateUpdate $ spawnerAI chaseCrit
|
{ _crUpdate = stateUpdate $ spawnerAI chaseCrit
|
||||||
, _crHP = 300
|
, _crHP = 300
|
||||||
, _crPict = enemyPict blue
|
, _crPict = enemyPict blue
|
||||||
, _crState = basicState {_goals = [[WaitFor 0]]
|
, _crState = defaultState {_goals = [[WaitFor 0]]
|
||||||
}
|
}
|
||||||
, _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
, _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
||||||
}
|
}
|
||||||
--
|
--
|
||||||
-- guardMelee :: Int -> Creature
|
-- guardMelee :: Int -> Creature
|
||||||
-- guardMelee n = (basicCreature n)
|
-- guardMelee n = (defaultCreature n)
|
||||||
-- { _crUpdate = meleeAI' n
|
-- { _crUpdate = meleeAI' n
|
||||||
-- , _crHP = 30
|
-- , _crHP = 30
|
||||||
-- , _crPict = equipOnTop goalPict
|
-- , _crPict = equipOnTop goalPict
|
||||||
-- , _crState = basicState {_goals = [[InitGuard]]
|
-- , _crState = defaultState {_goals = [[InitGuard]]
|
||||||
-- ,_faction = ChaseCritters}
|
-- ,_faction = ChaseCritters}
|
||||||
-- , _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
-- , _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
||||||
-- }
|
-- }
|
||||||
smallChaseCrit :: Creature
|
smallChaseCrit :: Creature
|
||||||
smallChaseCrit = basicCreature
|
smallChaseCrit = defaultCreature
|
||||||
{ _crUpdate = stateUpdate chaseAI
|
{ _crUpdate = stateUpdate chaseAI
|
||||||
, _crHP = 1
|
, _crHP = 1
|
||||||
, _crRad = 4
|
, _crRad = 4
|
||||||
--, _crPict = equipOnTop goalPict
|
--, _crPict = equipOnTop goalPict
|
||||||
, _crPict = enemyPict green
|
, _crPict = enemyPict green
|
||||||
, _crState = basicState {_goals = [[Wait]]
|
, _crState = defaultState {_goals = [[Wait]]
|
||||||
,_faction = ChaseCritters}
|
,_faction = ChaseCritters}
|
||||||
, _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
, _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
||||||
, _crCorpse = onLayer CorpseLayer $ color (greyN 0.5) $ circleSolid 4
|
, _crCorpse = onLayer CorpseLayer $ color (greyN 0.5) $ circleSolid 4
|
||||||
}
|
}
|
||||||
chaseCrit :: Creature
|
chaseCrit :: Creature
|
||||||
chaseCrit = basicCreature
|
chaseCrit = defaultCreature
|
||||||
{ _crUpdate = stateUpdate chaseAI
|
{ _crUpdate = stateUpdate chaseAI
|
||||||
, _crHP = 300
|
, _crHP = 300
|
||||||
-- , _crPict = goalPict -- enemyPict green
|
-- , _crPict = goalPict -- enemyPict green
|
||||||
, _crPict = enemyPict green
|
, _crPict = enemyPict green
|
||||||
, _crState = basicState {_goals = [[Wait]]
|
, _crState = defaultState {_goals = [[Wait]]
|
||||||
,_faction = ChaseCritters}
|
,_faction = ChaseCritters}
|
||||||
, _crInv = IM.empty
|
, _crInv = IM.empty
|
||||||
-- IM.fromList [(0,frontArmour)]
|
-- IM.fromList [(0,frontArmour)]
|
||||||
}
|
}
|
||||||
armourChaseCrit :: Creature
|
armourChaseCrit :: Creature
|
||||||
armourChaseCrit = basicCreature
|
armourChaseCrit = defaultCreature
|
||||||
{ _crUpdate = stateUpdate chaseAI
|
{ _crUpdate = stateUpdate chaseAI
|
||||||
, _crHP = 300
|
, _crHP = 300
|
||||||
, _crPict = enemyPict green
|
, _crPict = enemyPict green
|
||||||
, _crState = basicState {_goals = [[Wait]]}
|
, _crState = defaultState {_goals = [[Wait]]}
|
||||||
, _crInv = IM.fromList [(0,frontArmour)]
|
, _crInv = IM.fromList [(0,frontArmour)]
|
||||||
}
|
}
|
||||||
miniGunCrit :: Creature
|
miniGunCrit :: Creature
|
||||||
miniGunCrit = basicCreature
|
miniGunCrit = defaultCreature
|
||||||
{ _crPict = enemyPict red
|
{ _crPict = enemyPict red
|
||||||
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
||||||
, _crUpdate = stateUpdate miniAI
|
, _crUpdate = stateUpdate miniAI
|
||||||
@@ -126,11 +126,11 @@ miniGunCrit = basicCreature
|
|||||||
, _crInvSel = 0
|
, _crInvSel = 0
|
||||||
, _crRad = 10
|
, _crRad = 10
|
||||||
--, _crState = ShooterWait
|
--, _crState = ShooterWait
|
||||||
, _crState = basicState {_goals = [[InitGuard]]}
|
, _crState = defaultState {_goals = [[InitGuard]]}
|
||||||
, _crHP = 500
|
, _crHP = 500
|
||||||
}
|
}
|
||||||
longCrit :: Creature
|
longCrit :: Creature
|
||||||
longCrit = basicCreature
|
longCrit = defaultCreature
|
||||||
{ _crPict = enemyPict red
|
{ _crPict = enemyPict red
|
||||||
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
||||||
, _crUpdate = stateUpdate sniperAI
|
, _crUpdate = stateUpdate sniperAI
|
||||||
@@ -139,11 +139,11 @@ longCrit = basicCreature
|
|||||||
, _crInvSel = 0
|
, _crInvSel = 0
|
||||||
, _crRad = 10
|
, _crRad = 10
|
||||||
--, _crState = ShooterWait
|
--, _crState = ShooterWait
|
||||||
, _crState = basicState {_goals = [[InitGuard]]}
|
, _crState = defaultState {_goals = [[InitGuard]]}
|
||||||
, _crHP = 300
|
, _crHP = 300
|
||||||
}
|
}
|
||||||
multGunCrit :: Creature
|
multGunCrit :: Creature
|
||||||
multGunCrit = basicCreature
|
multGunCrit = defaultCreature
|
||||||
{ _crPict = enemyPict red
|
{ _crPict = enemyPict red
|
||||||
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
||||||
, _crUpdate = stateUpdate (twitchMissAI 300 350)
|
, _crUpdate = stateUpdate (twitchMissAI 300 350)
|
||||||
@@ -152,11 +152,11 @@ multGunCrit = basicCreature
|
|||||||
, _crInvSel = 0
|
, _crInvSel = 0
|
||||||
, _crRad = 10
|
, _crRad = 10
|
||||||
--, _crState = ShooterWait
|
--, _crState = ShooterWait
|
||||||
, _crState = basicState {_goals = [[InitGuard]]}
|
, _crState = defaultState {_goals = [[InitGuard]]}
|
||||||
, _crHP = 300
|
, _crHP = 300
|
||||||
}
|
}
|
||||||
launcherCrit :: Creature
|
launcherCrit :: Creature
|
||||||
launcherCrit = basicCreature
|
launcherCrit = defaultCreature
|
||||||
{ _crPict = enemyPict red
|
{ _crPict = enemyPict red
|
||||||
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
||||||
, _crUpdate = stateUpdate (launcherAI 150 200)
|
, _crUpdate = stateUpdate (launcherAI 150 200)
|
||||||
@@ -165,11 +165,11 @@ launcherCrit = basicCreature
|
|||||||
, _crInvSel = 0
|
, _crInvSel = 0
|
||||||
, _crRad = 10
|
, _crRad = 10
|
||||||
--, _crState = ShooterWait
|
--, _crState = ShooterWait
|
||||||
, _crState = basicState {_goals = [[Init]]}
|
, _crState = defaultState {_goals = [[Init]]}
|
||||||
, _crHP = 300
|
, _crHP = 300
|
||||||
}
|
}
|
||||||
spreadGunCrit :: Creature
|
spreadGunCrit :: Creature
|
||||||
spreadGunCrit = basicCreature
|
spreadGunCrit = defaultCreature
|
||||||
{ _crPict = enemyPict red
|
{ _crPict = enemyPict red
|
||||||
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
||||||
, _crUpdate = stateUpdate chargeAI
|
, _crUpdate = stateUpdate chargeAI
|
||||||
@@ -178,11 +178,11 @@ spreadGunCrit = basicCreature
|
|||||||
, _crInvSel = 0
|
, _crInvSel = 0
|
||||||
, _crRad = 10
|
, _crRad = 10
|
||||||
--, _crState = ShooterWait
|
--, _crState = ShooterWait
|
||||||
, _crState = basicState {_goals = [[Init]]}
|
, _crState = defaultState {_goals = [[Init]]}
|
||||||
, _crHP = 300
|
, _crHP = 300
|
||||||
}
|
}
|
||||||
pistolCrit :: Creature
|
pistolCrit :: Creature
|
||||||
pistolCrit = basicCreature
|
pistolCrit = defaultCreature
|
||||||
{ _crPict = enemyPict red
|
{ _crPict = enemyPict red
|
||||||
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
||||||
, _crUpdate = stateUpdate (dodgeAI 150 200)
|
, _crUpdate = stateUpdate (dodgeAI 150 200)
|
||||||
@@ -191,11 +191,11 @@ pistolCrit = basicCreature
|
|||||||
, _crInvSel = 0
|
, _crInvSel = 0
|
||||||
, _crRad = 10
|
, _crRad = 10
|
||||||
--, _crState = ShooterWait
|
--, _crState = ShooterWait
|
||||||
, _crState = basicState {_goals = [[InitGuard]]}
|
, _crState = defaultState {_goals = [[InitGuard]]}
|
||||||
, _crHP = 500
|
, _crHP = 500
|
||||||
}
|
}
|
||||||
autoCrit :: Creature
|
autoCrit :: Creature
|
||||||
autoCrit = basicCreature
|
autoCrit = defaultCreature
|
||||||
{ _crPict = enemyPict red
|
{ _crPict = enemyPict red
|
||||||
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
--, _crUpdate = checkDeadStopSound n . shooterFootsteps n . makeStateAI autoShooterAI n
|
||||||
, _crUpdate = stateUpdate basicShooterAI
|
, _crUpdate = stateUpdate basicShooterAI
|
||||||
@@ -204,7 +204,7 @@ autoCrit = basicCreature
|
|||||||
, _crInvSel = 0
|
, _crInvSel = 0
|
||||||
, _crRad = 10
|
, _crRad = 10
|
||||||
--, _crState = ShooterWait
|
--, _crState = ShooterWait
|
||||||
, _crState = basicState {_goals = [[InitGuard]]}
|
, _crState = defaultState {_goals = [[InitGuard]]}
|
||||||
, _crHP = 300
|
, _crHP = 300
|
||||||
}
|
}
|
||||||
addArmour :: Creature -> Creature
|
addArmour :: Creature -> Creature
|
||||||
@@ -212,25 +212,25 @@ addArmour = over crInv insarmour
|
|||||||
where insarmour xs = IM.insert i frontArmour xs
|
where insarmour xs = IM.insert i frontArmour xs
|
||||||
where i = newKey xs
|
where i = newKey xs
|
||||||
--closeShooterCrit :: Int -> Creature
|
--closeShooterCrit :: Int -> Creature
|
||||||
--closeShooterCrit n = (basicCreature n)
|
--closeShooterCrit n = (defaultCreature n)
|
||||||
-- { _crPos = startPos
|
-- { _crPos = startPos
|
||||||
-- , _crPict = equipOnTop goalPict
|
-- , _crPict = equipOnTop goalPict
|
||||||
-- , _crUpdate = closeShooterAI n
|
-- , _crUpdate = closeShooterAI n
|
||||||
-- , _crInv = IM.fromList [(0,ltAutoGun)]
|
-- , _crInv = IM.fromList [(0,ltAutoGun)]
|
||||||
-- , _crInvSel = 0
|
-- , _crInvSel = 0
|
||||||
-- , _crRad = 10
|
-- , _crRad = 10
|
||||||
-- , _crState = basicState {_goals = [[InitGuard]]}
|
-- , _crState = defaultState {_goals = [[InitGuard]]}
|
||||||
-- , _crHP = 50
|
-- , _crHP = 50
|
||||||
-- }
|
-- }
|
||||||
-- where startPos = (20*fromIntegral n-550,0)
|
-- where startPos = (20*fromIntegral n-550,0)
|
||||||
barrel :: Creature
|
barrel :: Creature
|
||||||
barrel = basicCreature
|
barrel = defaultCreature
|
||||||
{ _crUpdate = updateBarrel
|
{ _crUpdate = updateBarrel
|
||||||
, _crHP = 500
|
, _crHP = 500
|
||||||
, _crPict = \ _ -> onLayer CrLayer $ pictures [ color orange $ circleSolid 10
|
, _crPict = \ _ -> onLayer CrLayer $ pictures [ color orange $ circleSolid 10
|
||||||
, color (greyN 0.5) $ circleSolid 8
|
, color (greyN 0.5) $ circleSolid 8
|
||||||
]
|
]
|
||||||
, _crState = basicState {_goals = [[Wait]]
|
, _crState = defaultState {_goals = [[Wait]]
|
||||||
,_faction = ChaseCritters
|
,_faction = ChaseCritters
|
||||||
,_crSpState = Barrel []
|
,_crSpState = Barrel []
|
||||||
}
|
}
|
||||||
@@ -238,13 +238,13 @@ barrel = basicCreature
|
|||||||
}
|
}
|
||||||
|
|
||||||
explosiveBarrel :: Creature
|
explosiveBarrel :: Creature
|
||||||
explosiveBarrel = basicCreature
|
explosiveBarrel = defaultCreature
|
||||||
{ _crUpdate = updateExpBarrel
|
{ _crUpdate = updateExpBarrel
|
||||||
, _crHP = 400
|
, _crHP = 400
|
||||||
, _crPict = \ _ -> onLayer CrLayer $ pictures [ color orange $ circleSolid 10
|
, _crPict = \ _ -> onLayer CrLayer $ pictures [ color orange $ circleSolid 10
|
||||||
, color red $ circleSolid 8
|
, color red $ circleSolid 8
|
||||||
]
|
]
|
||||||
, _crState = basicState {_goals = [[Wait]]
|
, _crState = defaultState {_goals = [[Wait]]
|
||||||
,_faction = ChaseCritters
|
,_faction = ChaseCritters
|
||||||
,_crSpState = Barrel []
|
,_crSpState = Barrel []
|
||||||
,_crApplyDamage = \_ c -> (id, c)
|
,_crApplyDamage = \_ c -> (id, c)
|
||||||
@@ -273,7 +273,7 @@ frontArmouredPict = const $ pictures [ color (greyN 0.8) $ circleSolid 20
|
|||||||
]
|
]
|
||||||
|
|
||||||
--packCrits :: (Int -> World -> World) -> [Int] -> [Creature]
|
--packCrits :: (Int -> World -> World) -> [Int] -> [Creature]
|
||||||
--packCrits ai is = [(basicCreature i)
|
--packCrits ai is = [(defaultCreature i)
|
||||||
-- { _crPos = (150,10+20*fromIntegral i)
|
-- { _crPos = (150,10+20*fromIntegral i)
|
||||||
-- , _crPict = swarmPict
|
-- , _crPict = swarmPict
|
||||||
-- , _crUpdate = ai i
|
-- , _crUpdate = ai i
|
||||||
@@ -285,7 +285,7 @@ frontArmouredPict = const $ pictures [ color (greyN 0.8) $ circleSolid 20
|
|||||||
-- | i <- is]
|
-- | i <- is]
|
||||||
|
|
||||||
--queenBeeCrit :: Int -> Creature
|
--queenBeeCrit :: Int -> Creature
|
||||||
--queenBeeCrit cID = (basicCreature cID)
|
--queenBeeCrit cID = (defaultCreature cID)
|
||||||
-- { _crRad = 20
|
-- { _crRad = 20
|
||||||
-- , _crCorpse = color (greyN 0.5) $ circleSolid 20
|
-- , _crCorpse = color (greyN 0.5) $ circleSolid 20
|
||||||
-- , _crPict = const $ pictures [color black $ circSolid 20
|
-- , _crPict = const $ pictures [color black $ circSolid 20
|
||||||
@@ -297,7 +297,7 @@ frontArmouredPict = const $ pictures [ color (greyN 0.8) $ circleSolid 20
|
|||||||
-- }
|
-- }
|
||||||
|
|
||||||
--antCrit :: Int -> Creature
|
--antCrit :: Int -> Creature
|
||||||
--antCrit cID = (basicCreature cID)
|
--antCrit cID = (defaultCreature cID)
|
||||||
-- { _crPos = (0,100 + 3 * fromIntegral cID)
|
-- { _crPos = (0,100 + 3 * fromIntegral cID)
|
||||||
-- , _crUpdate = checkDead cID . makeStateAI (antAI 2) cID
|
-- , _crUpdate = checkDead cID . makeStateAI (antAI 2) cID
|
||||||
-- , _crState = AntMove 50
|
-- , _crState = AntMove 50
|
||||||
@@ -337,7 +337,7 @@ goalPict cr = let r = _crRad cr in case _crState cr of
|
|||||||
_ -> sizeColEnemy r (light $ dim green)
|
_ -> sizeColEnemy r (light $ dim green)
|
||||||
|
|
||||||
startCr :: Creature
|
startCr :: Creature
|
||||||
startCr = basicCreature
|
startCr = defaultCreature
|
||||||
{ _crPos = (0,0)
|
{ _crPos = (0,0)
|
||||||
, _crOldPos = (0,0)
|
, _crOldPos = (0,0)
|
||||||
, _crDir = 0
|
, _crDir = 0
|
||||||
|
|||||||
+2
-2
@@ -42,7 +42,7 @@ data World = World
|
|||||||
, _cameraAimTime :: Int
|
, _cameraAimTime :: Int
|
||||||
, _cameraRot :: !Float
|
, _cameraRot :: !Float
|
||||||
, _cameraZoom :: !Float
|
, _cameraZoom :: !Float
|
||||||
, _cameraCenter :: !Point2
|
, _cameraViewFrom :: !Point2
|
||||||
, _creatures :: IM.IntMap Creature
|
, _creatures :: IM.IntMap Creature
|
||||||
, _creaturesZone :: IM.IntMap (IM.IntMap (IM.IntMap Creature))
|
, _creaturesZone :: IM.IntMap (IM.IntMap (IM.IntMap Creature))
|
||||||
, _itemPositions :: IM.IntMap ItemPos
|
, _itemPositions :: IM.IntMap ItemPos
|
||||||
@@ -84,7 +84,7 @@ data World = World
|
|||||||
, _tempLightSources :: ![TempLightSource]
|
, _tempLightSources :: ![TempLightSource]
|
||||||
, _closeActiveObjects :: [Either FloorItem Button]
|
, _closeActiveObjects :: [Either FloorItem Button]
|
||||||
, _seenLocations :: IM.IntMap (World -> Point2,String)
|
, _seenLocations :: IM.IntMap (World -> Point2,String)
|
||||||
-- , _remap :: Keycode -> Keycode
|
, _selLocation :: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
data Corpse = Corpse
|
data Corpse = Corpse
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{-# LANGUAGE BangPatterns #-}
|
{-# LANGUAGE BangPatterns #-}
|
||||||
module Dodge.Prototypes where
|
module Dodge.Default where
|
||||||
|
|
||||||
import Dodge.Item.Weapon.Recock
|
import Dodge.Item.Weapon.Recock
|
||||||
|
|
||||||
@@ -19,17 +19,16 @@ import qualified Data.Map as M
|
|||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
import Data.Graph.Inductive.Graph hiding ((&))
|
import Data.Graph.Inductive.Graph hiding ((&))
|
||||||
import Data.List
|
import Data.List
|
||||||
--import Dodge.KeyEvents (keyremapDefault)
|
|
||||||
|
|
||||||
-- defalt datatypes / prototypes {{{
|
-- defalt datatypes / prototypes {{{
|
||||||
basicWall = Wall { _wlLine = [(0,0),(50,0)]
|
defaultWall = Wall { _wlLine = [(0,0),(50,0)]
|
||||||
, _wlID = 0
|
, _wlID = 0
|
||||||
, _wlColor = greyN 0.6
|
, _wlColor = greyN 0.6
|
||||||
, _wlDraw = Nothing
|
, _wlDraw = Nothing
|
||||||
, _wlSeen = False
|
, _wlSeen = False
|
||||||
, _wlIsSeeThrough = False
|
, _wlIsSeeThrough = False
|
||||||
}
|
}
|
||||||
basicAutoDoor = Door { _wlLine = [(0,0),(50,0)]
|
defaultAutoDoor = Door { _wlLine = [(0,0),(50,0)]
|
||||||
, _wlID = 0
|
, _wlID = 0
|
||||||
, _doorMech = id
|
, _doorMech = id
|
||||||
, _wlColor = light $ dim $ dim $ dim $ yellow
|
, _wlColor = light $ dim $ dim $ dim $ yellow
|
||||||
@@ -38,7 +37,7 @@ basicAutoDoor = Door { _wlLine = [(0,0),(50,0)]
|
|||||||
, _wlIsSeeThrough = False
|
, _wlIsSeeThrough = False
|
||||||
, _doorPathable = True
|
, _doorPathable = True
|
||||||
}
|
}
|
||||||
basicDoor = Door { _wlLine = [(0,0),(50,0)]
|
defaultDoor = Door { _wlLine = [(0,0),(50,0)]
|
||||||
, _wlID = 0
|
, _wlID = 0
|
||||||
, _doorMech = id
|
, _doorMech = id
|
||||||
, _wlColor = light $ dim $ dim $ dim $ yellow
|
, _wlColor = light $ dim $ dim $ dim $ yellow
|
||||||
@@ -47,8 +46,8 @@ basicDoor = Door { _wlLine = [(0,0),(50,0)]
|
|||||||
, _wlIsSeeThrough = False
|
, _wlIsSeeThrough = False
|
||||||
, _doorPathable = False
|
, _doorPathable = False
|
||||||
}
|
}
|
||||||
basicCreature :: Creature
|
defaultCreature :: Creature
|
||||||
basicCreature = Creature
|
defaultCreature = Creature
|
||||||
{ _crPos = (0,0)
|
{ _crPos = (0,0)
|
||||||
, _crOldPos = (0,0)
|
, _crOldPos = (0,0)
|
||||||
, _crDir = 0
|
, _crDir = 0
|
||||||
@@ -61,18 +60,18 @@ basicCreature = Creature
|
|||||||
, _crMaxHP = 150
|
, _crMaxHP = 150
|
||||||
, _crInv = IM.empty
|
, _crInv = IM.empty
|
||||||
, _crInvSel = 0
|
, _crInvSel = 0
|
||||||
, _crState = basicState
|
, _crState = defaultState
|
||||||
, _crCorpse = onLayer CorpseLayer $ color (greyN 0.5) $ circleSolid 10
|
, _crCorpse = onLayer CorpseLayer $ color (greyN 0.5) $ circleSolid 10
|
||||||
}
|
}
|
||||||
basicState = CrSt { _goals = []
|
defaultState = CrSt { _goals = []
|
||||||
, _stance = Stance {_carriage=Walking 0 0,_posture=AtEase}
|
, _stance = Stance {_carriage=Walking 0 0,_posture=AtEase}
|
||||||
, _faction = NoFaction
|
, _faction = NoFaction
|
||||||
, _crDamage = []
|
, _crDamage = []
|
||||||
, _crPastDamage = 0
|
, _crPastDamage = 0
|
||||||
, _crSpState = GenCr
|
, _crSpState = GenCr
|
||||||
, _crApplyDamage = basicApplyDamage'
|
, _crApplyDamage = defaultApplyDamage'
|
||||||
}
|
}
|
||||||
basicEquipment = Equipment
|
defaultEquipment = Equipment
|
||||||
{ _itIdentity = Generic
|
{ _itIdentity = Generic
|
||||||
, _itName = "genericEquipment"
|
, _itName = "genericEquipment"
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
@@ -84,13 +83,13 @@ basicEquipment = Equipment
|
|||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = basicItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itInvColor = yellow
|
, _itInvColor = yellow
|
||||||
, _itInvDisplay = _itName
|
, _itInvDisplay = _itName
|
||||||
}
|
}
|
||||||
basicItZoom = ItZoom 20 0.2 1 20 0.2 1
|
defaultItZoom = ItZoom 20 0.2 1 20 0.2 1
|
||||||
basicConsumable :: Item
|
defaultConsumable :: Item
|
||||||
basicConsumable = Consumable
|
defaultConsumable = Consumable
|
||||||
{ _itIdentity = Generic
|
{ _itIdentity = Generic
|
||||||
, _itName = "genericConsumable"
|
, _itName = "genericConsumable"
|
||||||
, _itMaxStack = 9
|
, _itMaxStack = 9
|
||||||
@@ -104,16 +103,16 @@ basicConsumable = Consumable
|
|||||||
, _itEffect = wpRecock
|
, _itEffect = wpRecock
|
||||||
, _itHammer = HammerUp
|
, _itHammer = HammerUp
|
||||||
}
|
}
|
||||||
basicApplyDamage' :: [DamageType] -> Creature -> (World -> World, Creature)
|
defaultApplyDamage' :: [DamageType] -> Creature -> (World -> World, Creature)
|
||||||
basicApplyDamage' ds cr = (id, doPoisonDam $ foldr (\d c -> snd $ basicApplyDamage d c) cr ds')
|
defaultApplyDamage' ds cr = (id, doPoisonDam $ foldr (\d c -> snd $ defaultApplyDamage d c) cr ds')
|
||||||
where (ps,ds') = partition isPoison ds
|
where (ps,ds') = partition isPoison ds
|
||||||
isPoison (PoisonDam {}) = True
|
isPoison (PoisonDam {}) = True
|
||||||
isPoison _ = False
|
isPoison _ = False
|
||||||
poisonDam = quot (max 0 (sum (map _dmAmount ps) - 0)) 10
|
poisonDam = quot (max 0 (sum (map _dmAmount ps) - 0)) 10
|
||||||
doPoisonDam = over crHP (\hp -> hp - poisonDam)
|
doPoisonDam = over crHP (\hp -> hp - poisonDam)
|
||||||
|
|
||||||
basicApplyDamage :: DamageType -> Creature -> (World -> World, Creature)
|
defaultApplyDamage :: DamageType -> Creature -> (World -> World, Creature)
|
||||||
basicApplyDamage (Concussive amount from push pushexp pushRad) cr
|
defaultApplyDamage (Concussive amount from push pushexp pushRad) cr
|
||||||
= ( id
|
= ( id
|
||||||
, over crHP (\hp -> hp - amount)
|
, over crHP (\hp -> hp - amount)
|
||||||
$ over crPos (+.+ (pushAmount *.* safeNormalizeV (_crPos cr -.- from)))
|
$ over crPos (+.+ (pushAmount *.* safeNormalizeV (_crPos cr -.- from)))
|
||||||
@@ -123,19 +122,19 @@ basicApplyDamage (Concussive amount from push pushexp pushRad) cr
|
|||||||
= 0
|
= 0
|
||||||
| otherwise = min 5 $
|
| otherwise = min 5 $
|
||||||
(push*5*pushRad / (dist (_crPos cr) from * _crMass cr))**pushexp
|
(push*5*pushRad / (dist (_crPos cr) from * _crMass cr))**pushexp
|
||||||
basicApplyDamage (TorqueDam amount rot) cr
|
defaultApplyDamage (TorqueDam amount rot) cr
|
||||||
= ( id
|
= ( id
|
||||||
, over crHP (\hp -> hp - amount) $ over crDir (+ rot) cr)
|
, over crHP (\hp -> hp - amount) $ over crDir (+ rot) cr)
|
||||||
basicApplyDamage (PushDam amount pback) cr
|
defaultApplyDamage (PushDam amount pback) cr
|
||||||
= ( id
|
= ( id
|
||||||
, over crHP (\hp -> hp - amount) $ over crPos (+.+ ((1/_crMass cr) *.* pback )) cr
|
, over crHP (\hp -> hp - amount) $ over crPos (+.+ ((1/_crMass cr) *.* pback )) cr
|
||||||
)
|
)
|
||||||
basicApplyDamage dt cr
|
defaultApplyDamage dt cr
|
||||||
= ( id , over crHP (\hp -> hp - _dmAmount dt) cr )
|
= ( id , over crHP (\hp -> hp - _dmAmount dt) cr )
|
||||||
basicFlIt = FlIt {_flItRot=0,_flIt = basicIt, _flItPos = (0,0), _flItID = 0}
|
defaultFlIt = FlIt {_flItRot=0,_flIt = defaultIt, _flItPos = (0,0), _flItID = 0}
|
||||||
basicIt = Consumable
|
defaultIt = Consumable
|
||||||
{ _itIdentity = Medkit25
|
{ _itIdentity = Medkit25
|
||||||
, _itName = "basicIt"
|
, _itName = "defaultIt"
|
||||||
, _itMaxStack = 3
|
, _itMaxStack = 3
|
||||||
, _itAmount = 2
|
, _itAmount = 2
|
||||||
, _cnEffect = \ _ -> return
|
, _cnEffect = \ _ -> return
|
||||||
@@ -147,7 +146,7 @@ basicIt = Consumable
|
|||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
, _itHammer = HammerUp
|
, _itHammer = HammerUp
|
||||||
}
|
}
|
||||||
basicButton = Button
|
defaultButton = Button
|
||||||
{ _btPict = onLayer WlLayer $ color red $ polygon $ rectNSEW 5 (-5) 10 (-10)
|
{ _btPict = onLayer WlLayer $ color red $ polygon $ rectNSEW 5 (-5) 10 (-10)
|
||||||
, _btPos = (0,0)
|
, _btPos = (0,0)
|
||||||
, _btRot = 0
|
, _btRot = 0
|
||||||
@@ -159,7 +158,7 @@ basicButton = Button
|
|||||||
, _btText = "Button"
|
, _btText = "Button"
|
||||||
, _btState = BtOff
|
, _btState = BtOff
|
||||||
}
|
}
|
||||||
basicPT = Projectile
|
defaultPT = Projectile
|
||||||
{ _ptPos = (0,0)
|
{ _ptPos = (0,0)
|
||||||
, _ptStartPos = (0,0)
|
, _ptStartPos = (0,0)
|
||||||
, _ptVel = (0,0)
|
, _ptVel = (0,0)
|
||||||
@@ -167,7 +166,7 @@ basicPT = Projectile
|
|||||||
, _ptID = 0
|
, _ptID = 0
|
||||||
, _ptUpdate = id
|
, _ptUpdate = id
|
||||||
}
|
}
|
||||||
basicPP = PressPlate
|
defaultPP = PressPlate
|
||||||
{ _ppPict = onLayer PressPlateLayer $ color (dim $ dim $ bright $ blue) $ circleSolid 5
|
{ _ppPict = onLayer PressPlateLayer $ color (dim $ dim $ bright $ blue) $ circleSolid 5
|
||||||
, _ppPos = (0,0)
|
, _ppPos = (0,0)
|
||||||
, _ppRot = 0
|
, _ppRot = 0
|
||||||
@@ -177,14 +176,14 @@ basicPP = PressPlate
|
|||||||
}
|
}
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
basicWorld = World
|
defaultWorld = World
|
||||||
{ _keys = S.empty
|
{ _keys = S.empty
|
||||||
, _mouseButtons = S.empty
|
, _mouseButtons = S.empty
|
||||||
, _cameraPos = (0,0)
|
, _cameraPos = (0,0)
|
||||||
, _cameraAimTime = 0
|
, _cameraAimTime = 0
|
||||||
, _cameraRot = 0
|
, _cameraRot = 0
|
||||||
, _cameraZoom = 1
|
, _cameraZoom = 1
|
||||||
, _cameraCenter = (0,0)
|
, _cameraViewFrom = (0,0)
|
||||||
, _creatures = IM.empty
|
, _creatures = IM.empty
|
||||||
, _creaturesZone = IM.empty
|
, _creaturesZone = IM.empty
|
||||||
, _clouds = IM.empty
|
, _clouds = IM.empty
|
||||||
@@ -217,7 +216,7 @@ basicWorld = World
|
|||||||
, _pathPoints = IM.empty
|
, _pathPoints = IM.empty
|
||||||
, _pathInc = M.empty
|
, _pathInc = M.empty
|
||||||
, _windowX = 800
|
, _windowX = 800
|
||||||
, _windowY = 840
|
, _windowY = 600
|
||||||
, _carteDisplay = False
|
, _carteDisplay = False
|
||||||
, _carteCenter = (0,0)
|
, _carteCenter = (0,0)
|
||||||
, _carteZoom = 0.5
|
, _carteZoom = 0.5
|
||||||
@@ -229,6 +228,7 @@ basicWorld = World
|
|||||||
[(0, (_crPos . you, "CURRENT POSITION"))
|
[(0, (_crPos . you, "CURRENT POSITION"))
|
||||||
,(1, (const (0,0) , "START POSITION"))
|
,(1, (const (0,0) , "START POSITION"))
|
||||||
]
|
]
|
||||||
|
, _selLocation = 0
|
||||||
}
|
}
|
||||||
youLight =
|
youLight =
|
||||||
-- LS {_lsEff = \w _ p -> (logistic 1 1 1 (d p w * 0.01) )
|
-- LS {_lsEff = \w _ p -> (logistic 1 1 1 (d p w * 0.01) )
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
module Dodge.Initialisation where
|
module Dodge.Initialisation where
|
||||||
-- imports {{{
|
-- imports {{{
|
||||||
import Dodge.Prototypes
|
import Dodge.Default
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Critters
|
import Dodge.Critters
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
@@ -23,7 +23,7 @@ firstWorld :: IO World
|
|||||||
firstWorld = return $ generateFromTree lev1 $ initialWorld
|
firstWorld = return $ generateFromTree lev1 $ initialWorld
|
||||||
|
|
||||||
initialWorld :: World
|
initialWorld :: World
|
||||||
initialWorld = basicWorld
|
initialWorld = defaultWorld
|
||||||
{ _keys = S.empty
|
{ _keys = S.empty
|
||||||
, _cameraPos = (0,0)
|
, _cameraPos = (0,0)
|
||||||
, _cameraRot = 0
|
, _cameraRot = 0
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ module Dodge.Item.Consumable
|
|||||||
where
|
where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.Prototypes
|
import Dodge.Default
|
||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
|
|
||||||
import Dodge.Item.Draw
|
import Dodge.Item.Draw
|
||||||
@@ -14,7 +14,7 @@ import Control.Lens
|
|||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
|
|
||||||
medkit :: Int -> Item
|
medkit :: Int -> Item
|
||||||
medkit i = basicConsumable
|
medkit i = defaultConsumable
|
||||||
{ _itIdentity = Medkit25
|
{ _itIdentity = Medkit25
|
||||||
, _itName = "MEDKIT" ++ show i
|
, _itName = "MEDKIT" ++ show i
|
||||||
, _itMaxStack = 9
|
, _itMaxStack = 9
|
||||||
|
|||||||
+27
-27
@@ -12,7 +12,7 @@ import Dodge.RandomHelp
|
|||||||
import Dodge.WorldEvent
|
import Dodge.WorldEvent
|
||||||
import Dodge.Debug
|
import Dodge.Debug
|
||||||
import Dodge.WallCreatureCollisions
|
import Dodge.WallCreatureCollisions
|
||||||
import Dodge.Prototypes
|
import Dodge.Default
|
||||||
|
|
||||||
import Dodge.Item.Draw
|
import Dodge.Item.Draw
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ pistol = Weapon
|
|||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = basicItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itEquipPict = drawWeapon $ color green $ polygon $ rectNESW 3 3 (-3) (-3)
|
, _itEquipPict = drawWeapon $ color green $ polygon $ rectNESW 3 3 (-3) (-3)
|
||||||
, _itScrollUp = const id
|
, _itScrollUp = const id
|
||||||
, _itScrollDown = const id
|
, _itScrollDown = const id
|
||||||
@@ -116,7 +116,7 @@ autoGun = defaultGun
|
|||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itZoom = basicItZoom {_itAimZoomFac = 1.5}
|
, _itZoom = defaultItZoom {_itAimZoomFac = 1.5}
|
||||||
, _itEquipPict = drawWeapon $ color red $ polygon $ rectNESW 4 4 (-4) (-4)
|
, _itEquipPict = drawWeapon $ color red $ polygon $ rectNESW 4 4 (-4) (-4)
|
||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
, _itAttachment = Just $ ItMode 0
|
, _itAttachment = Just $ ItMode 0
|
||||||
@@ -206,7 +206,7 @@ teslaGun = defaultAutoGun
|
|||||||
, _itAmount = 1
|
, _itAmount = 1
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itZoom = basicItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itEquipPict = drawWeapon $ color blue $ pictures [polygon $ rectNESW 7 3 1 (-3)
|
, _itEquipPict = drawWeapon $ color blue $ pictures [polygon $ rectNESW 7 3 1 (-3)
|
||||||
,polygon $ rectNESW (-1) 3 (-7) (-3)
|
,polygon $ rectNESW (-1) 3 (-7) (-3)
|
||||||
@@ -345,7 +345,7 @@ bezierGun = defaultAutoGun
|
|||||||
, _itScrollDown = removeItAttachment 0
|
, _itScrollDown = removeItAttachment 0
|
||||||
, _itHammer = HammerUp
|
, _itHammer = HammerUp
|
||||||
, _itEffect = bezierRecock
|
, _itEffect = bezierRecock
|
||||||
, _itZoom = basicItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,7 +451,7 @@ ltAutoGun = defaultAutoGun
|
|||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = basicItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itEquipPict = drawWeapon $ color green $ pictures [polygon $ rectNSWE 4 (-4) (-4) 0
|
, _itEquipPict = drawWeapon $ color green $ pictures [polygon $ rectNSWE 4 (-4) (-4) 0
|
||||||
,circleSolid 4
|
,circleSolid 4
|
||||||
]
|
]
|
||||||
@@ -542,7 +542,7 @@ multGun = defaultGun
|
|||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itZoom = basicItZoom {_itAimZoomFac = 1.5}
|
, _itZoom = defaultItZoom {_itAimZoomFac = 1.5}
|
||||||
, _itEquipPict = drawWeapon $ multGunPic
|
, _itEquipPict = drawWeapon $ multGunPic
|
||||||
}
|
}
|
||||||
where multGunPic = color red $ pictures
|
where multGunPic = color red $ pictures
|
||||||
@@ -576,7 +576,7 @@ longGun = defaultGun
|
|||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
, _itAimingSpeed = 0.2
|
, _itAimingSpeed = 0.2
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itZoom = basicItZoom {_itAimZoomMax = 0.5, _itAimZoomMin = 0.5}
|
, _itZoom = defaultItZoom {_itAimZoomMax = 0.5, _itAimZoomMin = 0.5}
|
||||||
, _itEquipPict = drawWeapon $ pictures [color orange $ polygon $ rectNESW 3 6 (-3) (-6) ]
|
, _itEquipPict = drawWeapon $ pictures [color orange $ polygon $ rectNESW 3 6 (-3) (-6) ]
|
||||||
, _itScrollUp = startZoomInLongGun
|
, _itScrollUp = startZoomInLongGun
|
||||||
, _itScrollDown = startZoomOutLongGun
|
, _itScrollDown = startZoomOutLongGun
|
||||||
@@ -610,7 +610,7 @@ poisonSprayer = defaultAutoGun
|
|||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
, _itAimingSpeed = 0.2
|
, _itAimingSpeed = 0.2
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = basicItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itEquipPict = drawWeapon $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
, _itEquipPict = drawWeapon $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -633,7 +633,7 @@ flamer = defaultAutoGun
|
|||||||
-- , _itAimingSpeed = 1
|
-- , _itAimingSpeed = 1
|
||||||
-- , _itAimingSpeed = 0.2
|
-- , _itAimingSpeed = 0.2
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = basicItZoom {_itAimZoomMax = 5, _itAimZoomMin = 1.5}
|
, _itZoom = defaultItZoom {_itAimZoomMax = 5, _itAimZoomMin = 1.5}
|
||||||
, _itEquipPict = drawWeapon $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
, _itEquipPict = drawWeapon $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
||||||
, _itAttachment = Nothing
|
, _itAttachment = Nothing
|
||||||
}
|
}
|
||||||
@@ -1007,7 +1007,7 @@ retireRemoteBomb itid 0 ptid w
|
|||||||
= set (pointToItem (_itemPositions w IM.! itid) . itAttachment . _Just . scopePos)
|
= set (pointToItem (_itemPositions w IM.! itid) . itAttachment . _Just . scopePos)
|
||||||
(0,0)
|
(0,0)
|
||||||
$ set (pointToItem (_itemPositions w IM.! itid) . itZoom)
|
$ set (pointToItem (_itemPositions w IM.! itid) . itZoom)
|
||||||
basicItZoom
|
defaultItZoom
|
||||||
$ set (pointToItem (_itemPositions w IM.! itid) . twFire)
|
$ set (pointToItem (_itemPositions w IM.! itid) . twFire)
|
||||||
throwRemoteBomb
|
throwRemoteBomb
|
||||||
(w & projectiles %~ IM.delete ptid)
|
(w & projectiles %~ IM.delete ptid)
|
||||||
@@ -1047,7 +1047,7 @@ moveRemoteBomb itid time pID w
|
|||||||
-> w' & creatures . ix cid . crInv . ix invid . itAttachment
|
-> w' & creatures . ix cid . crInv . ix invid . itAttachment
|
||||||
. _Just . scopePos .~ (newPos -.- _crPos (_creatures w' IM.! cid))
|
. _Just . scopePos .~ (newPos -.- _crPos (_creatures w' IM.! cid))
|
||||||
& creatures . ix cid . crInv . ix invid . itZoom
|
& creatures . ix cid . crInv . ix invid . itZoom
|
||||||
.~ (basicItZoom {_itAimZoomMax = 0.5, _itAimZoomMin = 0.5})
|
.~ (defaultItZoom {_itAimZoomMax = 0.5, _itAimZoomMin = 0.5})
|
||||||
_ -> w'
|
_ -> w'
|
||||||
pt = _projectiles w IM.! pID
|
pt = _projectiles w IM.! pID
|
||||||
oldPos = _ptPos pt
|
oldPos = _ptPos pt
|
||||||
@@ -1230,7 +1230,7 @@ grenade = Throwable
|
|||||||
, _twFire = throwGrenade fuseTime
|
, _twFire = throwGrenade fuseTime
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = basicItZoom {_itAimZoomMax = (f fuseTime), _itAimZoomMin = (f fuseTime)}
|
, _itZoom = defaultItZoom {_itAimZoomMax = (f fuseTime), _itAimZoomMin = (f fuseTime)}
|
||||||
, _itEquipPict = drawWeapon $ grenadePic fuseTime
|
, _itEquipPict = drawWeapon $ grenadePic fuseTime
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
, _itAttachment = Just $ ItFuse fuseTime
|
, _itAttachment = Just $ ItFuse fuseTime
|
||||||
@@ -1250,7 +1250,7 @@ increaseFuse fuse i w = w & creatures . ix 0 . crInv . ix itRef . itScrollUp .~
|
|||||||
& creatures . ix 0 . crInv . ix itRef . itName .~ "GRENADE " ++ show newTime
|
& creatures . ix 0 . crInv . ix itRef . itName .~ "GRENADE " ++ show newTime
|
||||||
& creatures . ix 0 . crInv . ix itRef . itAttachment .~ Just (ItFuse newTime)
|
& creatures . ix 0 . crInv . ix itRef . itAttachment .~ Just (ItFuse newTime)
|
||||||
& creatures . ix 0 . crInv . ix itRef . itZoom
|
& creatures . ix 0 . crInv . ix itRef . itZoom
|
||||||
.~ (basicItZoom {_itAimZoomMax = zm, _itAimZoomMin = zm})
|
.~ (defaultItZoom {_itAimZoomMax = zm, _itAimZoomMin = zm})
|
||||||
where itRef = fromMaybe (-2) $ w ^? creatures . ix 0 . crInvSel
|
where itRef = fromMaybe (-2) $ w ^? creatures . ix 0 . crInvSel
|
||||||
newTime = min (fuse + 5) 90
|
newTime = min (fuse + 5) 90
|
||||||
zm = 50 / fromIntegral newTime
|
zm = 50 / fromIntegral newTime
|
||||||
@@ -1262,7 +1262,7 @@ decreaseFuse fuse i w = w & creatures . ix 0 . crInv . ix itRef . itScrollUp .~
|
|||||||
& creatures . ix 0 . crInv . ix itRef . itName .~ "GRENADE " ++ show newTime
|
& creatures . ix 0 . crInv . ix itRef . itName .~ "GRENADE " ++ show newTime
|
||||||
& creatures . ix 0 . crInv . ix itRef . itAttachment .~ Just (ItFuse newTime)
|
& creatures . ix 0 . crInv . ix itRef . itAttachment .~ Just (ItFuse newTime)
|
||||||
& creatures . ix 0 . crInv . ix itRef . itZoom
|
& creatures . ix 0 . crInv . ix itRef . itZoom
|
||||||
.~ (basicItZoom {_itAimZoomMax = zm, _itAimZoomMin = zm})
|
.~ (defaultItZoom {_itAimZoomMax = zm, _itAimZoomMin = zm})
|
||||||
where itRef = fromMaybe (-2) $ w ^? creatures . ix 0 . crInvSel
|
where itRef = fromMaybe (-2) $ w ^? creatures . ix 0 . crInvSel
|
||||||
newTime = max (fuse - 5) 20
|
newTime = max (fuse - 5) 20
|
||||||
zm = 50 / fromIntegral newTime
|
zm = 50 / fromIntegral newTime
|
||||||
@@ -1648,7 +1648,7 @@ pipe = Craftable
|
|||||||
, _itInvDisplay = _itName
|
, _itInvDisplay = _itName
|
||||||
, _itInvColor = green
|
, _itInvColor = green
|
||||||
}
|
}
|
||||||
magShield = basicEquipment
|
magShield = defaultEquipment
|
||||||
{ _itIdentity = MagShield
|
{ _itIdentity = MagShield
|
||||||
, _itName = "MAGSHIELD"
|
, _itName = "MAGSHIELD"
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
@@ -1657,7 +1657,7 @@ magShield = basicEquipment
|
|||||||
, _itEquipPict = \cr _ -> blank
|
, _itEquipPict = \cr _ -> blank
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
}
|
}
|
||||||
flameShield = basicEquipment
|
flameShield = defaultEquipment
|
||||||
{ _itIdentity = FlameShield
|
{ _itIdentity = FlameShield
|
||||||
, _itName = "FLAMESHIELD"
|
, _itName = "FLAMESHIELD"
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
@@ -1668,7 +1668,7 @@ flameShield = basicEquipment
|
|||||||
)
|
)
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
}
|
}
|
||||||
frontArmour = basicEquipment
|
frontArmour = defaultEquipment
|
||||||
{ _itIdentity = FrontArmour
|
{ _itIdentity = FrontArmour
|
||||||
, _itName = "FARMOUR"
|
, _itName = "FARMOUR"
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
@@ -1685,7 +1685,7 @@ frontArmour = basicEquipment
|
|||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
}
|
}
|
||||||
jetPack = basicEquipment
|
jetPack = defaultEquipment
|
||||||
{ _itIdentity = JetPack
|
{ _itIdentity = JetPack
|
||||||
, _itName = "JETPACK"
|
, _itName = "JETPACK"
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
@@ -1700,7 +1700,7 @@ jetPack = basicEquipment
|
|||||||
}
|
}
|
||||||
|
|
||||||
latchkey :: Int -> Item
|
latchkey :: Int -> Item
|
||||||
latchkey n = basicEquipment
|
latchkey n = defaultEquipment
|
||||||
{ _itIdentity = Generic
|
{ _itIdentity = Generic
|
||||||
, _itName = "KEY "++show n
|
, _itName = "KEY "++show n
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
@@ -1712,7 +1712,7 @@ latchkey n = basicEquipment
|
|||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = basicItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itInvColor = yellow
|
, _itInvColor = yellow
|
||||||
, _itInvDisplay = _itName
|
, _itInvDisplay = _itName
|
||||||
}
|
}
|
||||||
@@ -1859,7 +1859,7 @@ radar = defaultGun
|
|||||||
, _itAmount = 1
|
, _itAmount = 1
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itZoom = basicItZoom {_itAimZoomMax = 1, _itZoomMax = 1}
|
, _itZoom = defaultItZoom {_itAimZoomMax = 1, _itZoomMax = 1}
|
||||||
, _itEquipPict = drawWeapon $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itEquipPict = drawWeapon $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1880,7 +1880,7 @@ sonar = defaultGun
|
|||||||
, _itAmount = 1
|
, _itAmount = 1
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itZoom = basicItZoom {_itAimZoomMax = 1, _itZoomMax = 1}
|
, _itZoom = defaultItZoom {_itAimZoomMax = 1, _itZoomMax = 1}
|
||||||
, _itEquipPict = drawWeapon $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itEquipPict = drawWeapon $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1968,7 +1968,7 @@ mvRadar x p w pt = (putBlips w, Just $ pt {_ptDraw = const pic
|
|||||||
| otherwise = fromIntegral x / 10
|
| otherwise = fromIntegral x / 10
|
||||||
colHelper y = color (withAlpha (y * globalAlpha) red)
|
colHelper y = color (withAlpha (y * globalAlpha) red)
|
||||||
|
|
||||||
autoSonar = basicEquipment
|
autoSonar = defaultEquipment
|
||||||
{ _itIdentity = Generic
|
{ _itIdentity = Generic
|
||||||
, _itName = "AUTOSONAR"
|
, _itName = "AUTOSONAR"
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
@@ -1979,9 +1979,9 @@ autoSonar = basicEquipment
|
|||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = basicItZoom {_itAimZoomMax = 1, _itZoomMax = 1}
|
, _itZoom = defaultItZoom {_itAimZoomMax = 1, _itZoomMax = 1}
|
||||||
}
|
}
|
||||||
autoRadar = basicEquipment
|
autoRadar = defaultEquipment
|
||||||
{ _itIdentity = Generic
|
{ _itIdentity = Generic
|
||||||
, _itName = "AUTORADAR"
|
, _itName = "AUTORADAR"
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
@@ -1992,7 +1992,7 @@ autoRadar = basicEquipment
|
|||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = basicItZoom {_itAimZoomMax = 1, _itZoomMax = 1}
|
, _itZoom = defaultItZoom {_itAimZoomMax = 1, _itZoomMax = 1}
|
||||||
}
|
}
|
||||||
|
|
||||||
autoRadarEffect :: ItEffect
|
autoRadarEffect :: ItEffect
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ module Dodge.LevelGen.StaticWalls
|
|||||||
where
|
where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.Prototypes
|
import Dodge.Default
|
||||||
|
|
||||||
import Geometry
|
import Geometry
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ createPolyWall (p1,p2) walls =
|
|||||||
p4 = p3 +.+ 10000 *.* vNormal (p2 -.- p1)
|
p4 = p3 +.+ 10000 *.* vNormal (p2 -.- p1)
|
||||||
maybeW = wallOnLine p3 p4 walls
|
maybeW = wallOnLine p3 p4 walls
|
||||||
k = newKey walls
|
k = newKey walls
|
||||||
newWall = basicWall {_wlLine = [p1,p2], _wlID = k}
|
newWall = defaultWall {_wlLine = [p1,p2], _wlID = k}
|
||||||
|
|
||||||
-- given a segment and a wall, adds a cut point to the wall if it intersects the
|
-- given a segment and a wall, adds a cut point to the wall if it intersects the
|
||||||
-- segment
|
-- segment
|
||||||
|
|||||||
@@ -119,9 +119,9 @@ lineOnScreenCone :: World -> [Point2] -> Bool
|
|||||||
lineOnScreenCone w (p1:p2:_) = errorPointInPolygon 8 p1 sp || errorPointInPolygon 9 p2 sp
|
lineOnScreenCone w (p1:p2:_) = errorPointInPolygon 8 p1 sp || errorPointInPolygon 9 p2 sp
|
||||||
|| any (isJust . uncurry (intersectSegSeg' p1 p2)) sps
|
|| any (isJust . uncurry (intersectSegSeg' p1 p2)) sps
|
||||||
where sp' = screenPolygon w
|
where sp' = screenPolygon w
|
||||||
vp = _cameraCenter w
|
vp = _cameraViewFrom w
|
||||||
sp | pointInPolygon vp sp' = sp'
|
sp | pointInPolygon vp sp' = sp'
|
||||||
| otherwise = orderPolygon $ (_cameraCenter w : sp')
|
| otherwise = orderPolygon $ (_cameraViewFrom w : sp')
|
||||||
sps = zip sp (tail sp ++ [head sp])
|
sps = zip sp (tail sp ++ [head sp])
|
||||||
|
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ drawWallFace w wall
|
|||||||
where
|
where
|
||||||
(x:y:_) = _wlLine wall
|
(x:y:_) = _wlLine wall
|
||||||
points = extendConeToScreenEdge w sightFrom (x,y)
|
points = extendConeToScreenEdge w sightFrom (x,y)
|
||||||
sightFrom = _cameraCenter w
|
sightFrom = _cameraViewFrom w
|
||||||
|
|
||||||
-- the following assumes that the point a is inside the screen
|
-- the following assumes that the point a is inside the screen
|
||||||
-- it still works otherwise, but it might intersect two points:
|
-- it still works otherwise, but it might intersect two points:
|
||||||
|
|||||||
+9
-9
@@ -6,7 +6,7 @@ import Dodge.Critters
|
|||||||
import Dodge.LevelGen
|
import Dodge.LevelGen
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.RandomHelp
|
import Dodge.RandomHelp
|
||||||
import Dodge.Prototypes
|
import Dodge.Default
|
||||||
import Dodge.Path
|
import Dodge.Path
|
||||||
import Dodge.Layout
|
import Dodge.Layout
|
||||||
import Dodge.LightSources
|
import Dodge.LightSources
|
||||||
@@ -438,14 +438,14 @@ randFirstWeapon :: State StdGen PSType
|
|||||||
randFirstWeapon = do
|
randFirstWeapon = do
|
||||||
r <- state $ randomR (-pi,pi)
|
r <- state $ randomR (-pi,pi)
|
||||||
takeOne $ map PutFlIt
|
takeOne $ map PutFlIt
|
||||||
[ basicFlIt {_flItRot=r,_flIt = pistol}
|
[ defaultFlIt {_flItRot=r,_flIt = pistol}
|
||||||
, basicFlIt {_flItRot=r,_flIt = ltAutoGun}
|
, defaultFlIt {_flItRot=r,_flIt = ltAutoGun}
|
||||||
-- , basicFlIt {_flItRot=r,_flIt = autoGun}
|
-- , defaultFlIt {_flItRot=r,_flIt = autoGun}
|
||||||
, basicFlIt {_flItRot=r,_flIt = spreadGun}
|
, defaultFlIt {_flItRot=r,_flIt = spreadGun}
|
||||||
, basicFlIt {_flItRot=r,_flIt = multGun}
|
, defaultFlIt {_flItRot=r,_flIt = multGun}
|
||||||
, basicFlIt {_flItRot=r,_flIt = launcher}
|
, defaultFlIt {_flItRot=r,_flIt = launcher}
|
||||||
-- , basicFlIt {_flItRot=r,_flIt = lasGun}
|
-- , defaultFlIt {_flItRot=r,_flIt = lasGun}
|
||||||
-- , basicFlIt {_flItRot=r,_flIt = flamer}
|
-- , defaultFlIt {_flItRot=r,_flIt = flamer}
|
||||||
]
|
]
|
||||||
|
|
||||||
--randC1 :: State StdGen PSType
|
--randC1 :: State StdGen PSType
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ updateAimTime w
|
|||||||
|
|
||||||
moveCamera :: World -> World
|
moveCamera :: World -> World
|
||||||
moveCamera w = w & cameraPos .~ idealPos
|
moveCamera w = w & cameraPos .~ idealPos
|
||||||
& cameraCenter .~ sightFrom
|
& cameraViewFrom .~ sightFrom
|
||||||
where aimRangeFactor | _cameraZoom w == 0 = 0
|
where aimRangeFactor | _cameraZoom w == 0 = 0
|
||||||
| otherwise = (fromMaybe 0 $ yourItem w ^? itAimingRange) / _cameraZoom w
|
| otherwise = (fromMaybe 0 $ yourItem w ^? itAimingRange) / _cameraZoom w
|
||||||
aimTimeFactor = fromIntegral (w ^. cameraAimTime) / 10
|
aimTimeFactor = fromIntegral (w ^. cameraAimTime) / 10
|
||||||
@@ -121,7 +121,7 @@ zoomCamOut w | SDL.ScancodeK `S.member` _keys w
|
|||||||
autoZoomCam :: World -> World
|
autoZoomCam :: World -> World
|
||||||
autoZoomCam w = over cameraZoom changeZoom w
|
autoZoomCam w = over cameraZoom changeZoom w
|
||||||
where maxViewDistance = 800
|
where maxViewDistance = 800
|
||||||
camPos = _cameraCenter w
|
camPos = _cameraViewFrom w
|
||||||
camRot = _cameraRot w
|
camRot = _cameraRot w
|
||||||
wallZoom = min (halfWidth w / (horizontalMax+50) )
|
wallZoom = min (halfWidth w / (horizontalMax+50) )
|
||||||
(halfHeight w / (verticalMax+50) )
|
(halfHeight w / (verticalMax+50) )
|
||||||
|
|||||||
Reference in New Issue
Block a user