Code: Select all
#SpeedFactor = 3 ; usually 1 to 5. Default = 3.
; -------------------------------------------------------------------------------------------
; INITS
; -------------------------------------------------------------------------------------------
; initialize the ingoing effect for the InObjects(CurrObject.l)
Procedure.l EffectInitIn(*Effect.structEffectParameters, ScreenWidth.l, ScreenHeight.l, CurrObject.l, GroupID.l, GroupMax.l)
; GroupID: which number of a group with GroupMax members am I?
; In case of no group (images?) set 1 and 1.
With InObjects(CurrObject.l)
*Effect\Direction = UCase(*Effect\Direction)
*Effect\Rotation = UCase(*Effect\Rotation)
Select LCase(*Effect\Type)
Case "standard" ; standard fade in effect
\ActualTransparency = 0
\Transform = #True
; movement
If FindString(*Effect\Direction, "L", 1) > 0: \ActualPosX = \PosX - ScreenWidth.l : EndIf
If FindString(*Effect\Direction, "R", 1) > 0: \ActualPosX = \PosX + ScreenWidth.l : EndIf
If FindString(*Effect\Direction, "T", 1) > 0: \ActualPosY = \PosY - ScreenHeight.l : EndIf
If FindString(*Effect\Direction, "B", 1) > 0: \ActualPosY = \PosY + ScreenHeight.l : EndIf
If FindString(*Effect\Direction, "F", 1) > 0: \ActualPosZ = #InitialZ * 4: EndIf
If FindString(*Effect\Direction, "V", 1) > 0: \ActualPosZ = 0: EndIf
\Val0 = (\PosX - \ActualPosX) / (255 / #SpeedFactor) ; vector X
\Val1 = (\PosY - \ActualPosY) / (255 / #SpeedFactor) ; vector Y
\Val2 = (\PosZ - \ActualPosZ) / (255 / #SpeedFactor) ; vector Z
; rotation
If FindString(*Effect\Rotation, "X", 1) > 0: \ActualAngleX = 8: EndIf
If FindString(*Effect\Rotation, "Y", 1) > 0: \ActualAngleY = 8: EndIf
If FindString(*Effect\Rotation, "Z", 1) > 0: \ActualAngleZ = 8: EndIf
If FindString(*Effect\Rotation, "L", 1) > 0
; rotate left (counterclockwise)
\ActualAngleX = - \ActualAngleX
\ActualAngleY = - \ActualAngleY
\ActualAngleZ = - \ActualAngleZ
EndIf
\Val3 = (\AngleX - \ActualAngleX) / (255 / #SpeedFactor)
\Val4 = (\AngleY - \ActualAngleY) / (255 / #SpeedFactor)
\Val5 = (\AngleZ - \ActualAngleZ) / (255 / #SpeedFactor)
; delayed mode
If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 40): EndIf
ProcedureReturn
Case "explode"
\ActualTransparency = 0
\Transform = #True
; movement
\ActualPosX = \PosX + Random(ScreenWidth.l / 3) - ScreenWidth.l / 6
\ActualPosY = \PosY + Random(ScreenWidth.l / 3) - ScreenWidth.l / 6
\ActualPosZ = \PosZ + Random(ScreenWidth.l / 1) - ScreenWidth.l / 2
If FindString(*Effect\Direction, "L", 1) > 0: \ActualPosX = \ActualPosX - ScreenWidth.l / 2: EndIf
If FindString(*Effect\Direction, "R", 1) > 0: \ActualPosX = \ActualPosX + ScreenWidth.l / 2: EndIf
If FindString(*Effect\Direction, "T", 1) > 0: \ActualPosY = \ActualPosY - ScreenHeight.l / 2: EndIf
If FindString(*Effect\Direction, "B", 1) > 0: \ActualPosY = \ActualPosY + ScreenHeight.l / 2: EndIf
\Val0 = (\PosX - \ActualPosX) / (255 / #SpeedFactor) ; vector X
\Val1 = (\PosY - \ActualPosY) / (255 / #SpeedFactor) ; vector Y
\Val2 = (\PosZ - \ActualPosZ) / (255 / #SpeedFactor) ; vector Z
; rotation
\ActualAngleX = Random(3141) / 1000
\ActualAngleY = Random(3141) / 1000
\ActualAngleZ = Random(3141) / 1000
\Val3 = (\AngleX - \ActualAngleX) / (255 / #SpeedFactor)
\Val4 = (\AngleY - \ActualAngleY) / (255 / #SpeedFactor)
\Val5 = (\AngleZ - \ActualAngleZ) / (255 / #SpeedFactor)
; delayed mode
If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 30): EndIf
Case "turn"
\ActualTransparency = 0
\Transform = #True
; movement
\ActualPosZ = \ActualPosZ + 400
If FindString(*Effect\Direction, "L", 1) > 0: \ActualPosX = \ActualPosX - 300: EndIf
If FindString(*Effect\Direction, "R", 1) > 0: \ActualPosX = \ActualPosX + 300: EndIf
If FindString(*Effect\Direction, "T", 1) > 0: \ActualPosY = \ActualPosY - 200: EndIf
If FindString(*Effect\Direction, "B", 1) > 0: \ActualPosY = \ActualPosY + 200: EndIf
\Val0 = (\PosX - \ActualPosX) / (255 / #SpeedFactor) ; vector X
\Val1 = (\PosY - \ActualPosY) / (255 / #SpeedFactor) ; vector Y
\Val2 = (\PosZ - \ActualPosZ) / (255 / #SpeedFactor) ; vector Z
; rotation
If FindString(*Effect\Direction, "L", 1) > 0: \ActualAngleY = \ActualAngleY - #PI * 0.4: EndIf
If FindString(*Effect\Direction, "R", 1) > 0: \ActualAngleY = \ActualAngleY + #PI * 0.4: EndIf
If FindString(*Effect\Direction, "T", 1) > 0: \ActualAngleX = \ActualAngleX + #PI * 0.4: EndIf
If FindString(*Effect\Direction, "B", 1) > 0: \ActualAngleX = \ActualAngleX - #PI * 0.4: EndIf
\Val3 = (\AngleX - \ActualAngleX) / (255 / #SpeedFactor)
\Val4 = (\AngleY - \ActualAngleY) / (255 / #SpeedFactor)
\Val5 = (\AngleZ - \ActualAngleZ) / (255 / #SpeedFactor)
; delayed mode
If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 30): EndIf
Case "wave"
\ActualTransparency = 0
\Transform = #True
; movement
\Val1 = (255 / #SpeedFactor)
; delayed mode
If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 30): EndIf
EndSelect
EndWith
EndProcedure
; initialize the outgoing effect for the OutObjects(CurrObject.l)
Procedure.l EffectInitOut(*Effect.structEffectParameters, ScreenWidth.l, ScreenHeight.l, CurrObject.l, GroupID.l, GroupMax.l)
; GroupID: which number of a group with GroupMax members am I?
; In case of no group (images?) set 1 and 1.
With OutObjects(CurrObject.l)
Select LCase(*Effect\Type)
Case "standard" ; standard fade out effect
\ActualTransparency = 255
\Transform = #True
\Delay = 0
; movement
If FindString(*Effect\Direction, "L", 1) > 0: \PosX = \PosX - ScreenWidth.l : EndIf
If FindString(*Effect\Direction, "R", 1) > 0: \PosX = \PosX + ScreenWidth.l : EndIf
If FindString(*Effect\Direction, "T", 1) > 0: \PosY = \PosY - ScreenHeight.l : EndIf
If FindString(*Effect\Direction, "B", 1) > 0: \PosY = \PosY + ScreenHeight.l : EndIf
If FindString(*Effect\Direction, "F", 1) > 0: \PosZ = #InitialZ * 4: EndIf
If FindString(*Effect\Direction, "V", 1) > 0: \PosZ = -100: EndIf
\Val0 = (\PosX - \ActualPosX) / (255 / #SpeedFactor) ; vector X
\Val1 = (\PosY - \ActualPosY) / (255 / #SpeedFactor) ; vector Y
\Val2 = (\PosZ - \ActualPosZ) / (255 / #SpeedFactor) ; vector Z
; rotation
If FindString(*Effect\Rotation, "X", 1) > 0: \AngleX = -8: EndIf
If FindString(*Effect\Rotation, "Y", 1) > 0: \AngleY = -8: EndIf
If FindString(*Effect\Rotation, "Z", 1) > 0: \AngleZ = -8: EndIf
If FindString(*Effect\Rotation, "L", 1) > 0
; rotate left (counterclockwise)
\AngleX = - \AngleX
\AngleY = - \AngleY
\AngleZ = - \AngleZ
EndIf
\Val3 = (\AngleX - \ActualAngleX) / (255 / #SpeedFactor)
\Val4 = (\AngleY - \ActualAngleY) / (255 / #SpeedFactor)
\Val5 = (\AngleZ - \ActualAngleZ) / (255 / #SpeedFactor)
; delayed mode
If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 40): EndIf
ProcedureReturn
Case "explode"
\ActualTransparency = 255
\Transform = #True
\Delay = 0
; movement
\Val0 = (Random(400) - 200) / (255 / #SpeedFactor) ; vector X
\Val1 = (Random(400) - 200) / (255 / #SpeedFactor) ; vector Y
\Val2 = (Random(800) - 400) / (255 / #SpeedFactor) ; vector Z
If FindString(*Effect\Direction, "L", 1) > 0: \Val0 = \Val0 - #SpeedFactor*2: EndIf
If FindString(*Effect\Direction, "R", 1) > 0: \Val0 = \Val0 + #SpeedFactor*2: EndIf
If FindString(*Effect\Direction, "T", 1) > 0: \Val1 = \Val1 - #SpeedFactor*2: EndIf
If FindString(*Effect\Direction, "B", 1) > 0: \Val1 = \Val1 + #SpeedFactor*2: EndIf
; rotation
\Val3 = (Random(400) - 200) / 4000 ; rot X
\Val4 = (Random(400) - 200) / 4000 ; rot Y
\Val5 = (Random(400) - 200) / 4000 ; rot Z
; delayed mode
If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 30): EndIf
ProcedureReturn
Case "turn"
\ActualTransparency = 255
\Transform = #True
\Delay = 0
; movement
\PosZ = \PosZ + 400
If FindString(*Effect\Direction, "L", 1) > 0: \PosX = \PosX - 200: EndIf
If FindString(*Effect\Direction, "R", 1) > 0: \PosX = \PosX + 200: EndIf
If FindString(*Effect\Direction, "T", 1) > 0: \PosY = \PosY - 200: EndIf
If FindString(*Effect\Direction, "B", 1) > 0: \PosY = \PosY + 200: EndIf
\Val0 = (\PosX - \ActualPosX) / (255 / #SpeedFactor) ; vector X
\Val1 = (\PosY - \ActualPosY) / (255 / #SpeedFactor) ; vector Y
\Val2 = (\PosZ - \ActualPosZ) / (255 / #SpeedFactor) ; vector Z
; rotation
If FindString(*Effect\Direction, "L", 1) > 0: \AngleY = \AngleY - #PI * 0.4: EndIf
If FindString(*Effect\Direction, "R", 1) > 0: \AngleY = \AngleY + #PI * 0.4: EndIf
If FindString(*Effect\Direction, "T", 1) > 0: \AngleX = \AngleX + #PI * 0.4: EndIf
If FindString(*Effect\Direction, "B", 1) > 0: \AngleX = \AngleX - #PI * 0.4: EndIf
\Val3 = (\AngleX - \ActualAngleX) / (255 / #SpeedFactor)
\Val4 = (\AngleY - \ActualAngleY) / (255 / #SpeedFactor)
\Val5 = (\AngleZ - \ActualAngleZ) / (255 / #SpeedFactor)
; delayed mode
If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 30): EndIf
ProcedureReturn
Case "wave"
\ActualTransparency = 255
\Transform = #True
\Delay = 0
; movement
\Val1 = 0
; delayed mode
If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 30): EndIf
ProcedureReturn
EndSelect
EndWith
EndProcedure
; -------------------------------------------------------------------------------------------
; TRANSFORMS
; -------------------------------------------------------------------------------------------
; do the ingoing effect for the InObjects(CurrObject.l)
Procedure EffectTransformIn(*Effect.structEffectParameters, ScreenWidth.l, ScreenHeight.l, CurrObject.l, MaxObjects.l)
With InObjects(CurrObject.l)
Select LCase(*Effect\Type)
Case "standard", "explode", "turn" ; standard movement calculation
\ActualTransparency = \ActualTransparency + #SpeedFactor
\ActualPosX = \ActualPosX + \Val0
\ActualPosY = \ActualPosY + \Val1
\ActualPosZ = \ActualPosZ + \Val2
\ActualAngleX = \ActualAngleX + \Val3
\ActualAngleY = \ActualAngleY + \Val4
\ActualAngleZ = \ActualAngleZ + \Val5
If \ActualTransparency >= 255
\ActualTransparency = 255
\Transform = #False ; ready
EndIf
ProcedureReturn
Case "wave" ; wave movement calculation
\ActualTransparency = \ActualTransparency + #SpeedFactor
\Val0 = \Val0 + 0.1
\Val1 = \Val1 - 1
If FindString(\EffectIn\Direction, "X", 1) > 0: \ActualPosX = \PosX + Sin(\Val0) * \Val1: EndIf
If FindString(\EffectIn\Direction, "Y", 1) > 0: \ActualPosY = \PosY + Sin(\Val0) * \Val1: EndIf
If FindString(\EffectIn\Direction, "Z", 1) > 0: \ActualPosZ = \PosZ + Sin(\Val0) * \Val1: EndIf
If \ActualTransparency >= 255
\ActualTransparency = 255
\Transform = #False ; ready
EndIf
ProcedureReturn
EndSelect
EndWith
EndProcedure
; do the outgoing effect for the InObjects(CurrObject.l)
Procedure EffectTransformOut(*Effect.structEffectParameters, ScreenWidth.l, ScreenHeight.l, CurrObject.l, MaxObjects.l)
With OutObjects(CurrObject.l)
Select LCase(*Effect\Type)
Case "standard", "explode", "turn" ; standard movement calcumaltion
\ActualTransparency = \ActualTransparency - #SpeedFactor
\ActualPosX = \ActualPosX + \Val0
\ActualPosY = \ActualPosY + \Val1
\ActualPosZ = \ActualPosZ + \Val2
\ActualAngleX = \ActualAngleX + \Val3
\ActualAngleY = \ActualAngleY + \Val4
\ActualAngleZ = \ActualAngleZ + \Val5
If \ActualTransparency < 1
\ActualTransparency = 0
\Transform = #False ; ready
EndIf
ProcedureReturn
Case "wave" ; wave movement calculation
\ActualTransparency = \ActualTransparency - #SpeedFactor
\Val0 = \Val0 + 0.1
\Val1 = \Val1 + 1
If FindString(\EffectOut\Direction, "X", 1) > 0: \ActualPosX = \PosX + Sin(\Val0) * \Val1: EndIf
If FindString(\EffectOut\Direction, "Y", 1) > 0: \ActualPosY = \PosY + Sin(\Val0) * \Val1: EndIf
If FindString(\EffectOut\Direction, "Z", 1) > 0: \ActualPosZ = \PosZ + Sin(\Val0) * \Val1: EndIf
If \ActualTransparency < 1
\ActualTransparency = 0
\Transform = #False ; ready
EndIf
ProcedureReturn
EndSelect
EndWith
EndProcedure