author | Wuzzy <Wuzzy2@mail.ru> |
Thu, 18 Jul 2019 03:39:58 +0200 | |
changeset 15273 | 515a4a317e52 |
parent 15094 | 7732013ce64c |
permissions | -rw-r--r-- |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
1 |
local animPos, lastx, lasty, jumpTypes, jumpTimes, moveDirs, jumpStarted |
12778
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
2 |
local moveTime = 0 |
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
3 |
local backJumped, jTimer, awTime, globalWait, stageEvents, seNum, curEvent |
14252
74bf2d906097
Turn accidental globals to locals in Lua libraries
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
4 |
local needToDecrease |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
5 |
local AnimList, AnimListNum |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
6 |
local FunctionList, FunctionListNum |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
7 |
local skipFuncList |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
8 |
local skipping |
12594
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
9 |
local baseInputMask = 0xFFFFFFFF |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
10 |
local extraInputMask = baseInputMask |
15094
7732013ce64c
Animate library: Document way to speed up animations for testing purposes
Wuzzy <Wuzzy2@mail.ru>
parents:
14646
diff
changeset
|
11 |
|
7732013ce64c
Animate library: Document way to speed up animations for testing purposes
Wuzzy <Wuzzy2@mail.ru>
parents:
14646
diff
changeset
|
12 |
-- DEBUGGING STUFF -- |
7732013ce64c
Animate library: Document way to speed up animations for testing purposes
Wuzzy <Wuzzy2@mail.ru>
parents:
14646
diff
changeset
|
13 |
--[[ Number of animation ticks to decrease whenever AnimUnWait() |
7732013ce64c
Animate library: Document way to speed up animations for testing purposes
Wuzzy <Wuzzy2@mail.ru>
parents:
14646
diff
changeset
|
14 |
is called (usually every game tick). Default: 1 |
7732013ce64c
Animate library: Document way to speed up animations for testing purposes
Wuzzy <Wuzzy2@mail.ru>
parents:
14646
diff
changeset
|
15 |
Increase this number to increase overall animation speed. ]] |
7732013ce64c
Animate library: Document way to speed up animations for testing purposes
Wuzzy <Wuzzy2@mail.ru>
parents:
14646
diff
changeset
|
16 |
local animSpeed = 1 |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
17 |
--------------------------------Animation--------------------------------- |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
18 |
--------------------------(In-game cinematics)---------------------------- |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
19 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
20 |
function AddSkipFunction(anim, func, args) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
21 |
skipFuncList[anim] = {sfunc = func, sargs = args} |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
22 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
23 |
|
7263
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
24 |
function RemoveSkipFunction(anim) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
25 |
skipFuncList[anim] = nil |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
26 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
27 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
28 |
function SetAnimSkip(bool) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
29 |
skipping = bool |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
30 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
31 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
32 |
function AnimInProgress() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
33 |
return AnimListNum ~= 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
34 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
35 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
36 |
function SkipAnimation(anim) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
37 |
if skipFuncList[anim] == nil then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
38 |
return |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
39 |
else |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
40 |
skipFuncList[anim].sfunc(unpack(skipFuncList[anim].sargs)) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
41 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
42 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
43 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
44 |
function AddFunction(element) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
45 |
table.insert(FunctionList, element) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
46 |
FunctionListNum = FunctionListNum + 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
47 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
48 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
49 |
function RemoveFunction() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
50 |
table.remove(FunctionList, 1) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
51 |
FunctionListNum = FunctionListNum - 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
52 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
53 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
54 |
function ExecuteAfterAnimations() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
55 |
if FunctionListNum == 0 then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
56 |
return |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
57 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
58 |
FunctionList[1].func(unpack(FunctionList[1].args)) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
59 |
RemoveFunction() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
60 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
61 |
|
12594
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
62 |
local function updateInputMask() |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
63 |
SetInputMask(band(baseInputMask, extraInputMask)) |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
64 |
end |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
65 |
|
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
66 |
local function startCinemaLock() |
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
67 |
SetCinematicMode(true) |
12594
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
68 |
baseInputMask = bnot(gmAnimate+gmAttack+gmDown+gmHJump+gmLeft+gmLJump+gmRight+gmSlot+gmSwitch+gmTimer+gmUp+gmWeapon) |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
69 |
updateInputMask() |
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
70 |
end |
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
71 |
|
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
72 |
local function stopCinemaLock() |
12594
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
73 |
baseInputMask = 0xFFFFFFFF |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
74 |
updateInputMask() |
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
75 |
SetCinematicMode(false) |
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
76 |
end |
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
77 |
|
12594
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
78 |
function AnimSetInputMask(newExtraInputMask) |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
79 |
extraInputMask = newExtraInputMask |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
80 |
updateInputMask() |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
81 |
end |
d8adae379d3c
A Space Adventure: Add outro sequence / epilogue in the final mission
Wuzzy <almikes@aol.com>
parents:
12088
diff
changeset
|
82 |
|
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
83 |
function AnimInit(startAnimating) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
84 |
lastx = 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
85 |
lasty = 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
86 |
jumpTypes = {long = gmLJump, high = gmHJump, back = gmHJump} |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
87 |
jumpTimes = {long = 500, high = 500, back = 300, backback = 500} |
7245
53f73f4ae203
Modified frontend so that updating campaogn progress no longer changes current index of the mission combo box
belphegorr <szabibibi@gmail.com>
parents:
7213
diff
changeset
|
88 |
moveDirs = {Right = gmRight, Left = gmLeft} |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
89 |
jumpStarted = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
90 |
backJumped = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
91 |
jTimer = 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
92 |
awTime = 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
93 |
globalWait = 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
94 |
stageEvents = {} |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
95 |
seNum = 0 |
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
96 |
curEvent = 0 |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
97 |
needToDecrease = 0 |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
98 |
AnimList = {} |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
99 |
AnimListNum = 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
100 |
FunctionList = {} |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
101 |
FunctionListNum = 0 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
102 |
skipping = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
103 |
skipFuncList = {} |
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
104 |
animPos = 1 |
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
105 |
if startAnimating then |
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
106 |
startCinemaLock() |
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
107 |
end |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
108 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
109 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
110 |
function AnimSwitchHog(gear) |
14626
153c12b9051b
Clear gear message in AnimSwitchHog
Wuzzy <Wuzzy2@mail.ru>
parents:
14252
diff
changeset
|
111 |
SetGearMessage(gear, band(GetGearMessage(gear), bnot(gmAllStoppable))) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
112 |
SwitchHog(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
113 |
FollowGear(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
114 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
115 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
116 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
117 |
function AnimGiveState(gear, state) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
118 |
SetState(gear, state) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
119 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
120 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
121 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
122 |
function AnimRemoveState(gear, state) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
123 |
SetState(gear, band(GetState(gear), bnot(state))) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
124 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
125 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
126 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
127 |
function AnimGearWait(gear, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
128 |
AnimWait(gear, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
129 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
130 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
131 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
132 |
function AnimUnWait() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
133 |
if globalWait > 0 then |
15094
7732013ce64c
Animate library: Document way to speed up animations for testing purposes
Wuzzy <Wuzzy2@mail.ru>
parents:
14646
diff
changeset
|
134 |
globalWait = globalWait - animSpeed |
7732013ce64c
Animate library: Document way to speed up animations for testing purposes
Wuzzy <Wuzzy2@mail.ru>
parents:
14646
diff
changeset
|
135 |
if globalWait < 0 then |
7732013ce64c
Animate library: Document way to speed up animations for testing purposes
Wuzzy <Wuzzy2@mail.ru>
parents:
14646
diff
changeset
|
136 |
globalWait = 0 |
7732013ce64c
Animate library: Document way to speed up animations for testing purposes
Wuzzy <Wuzzy2@mail.ru>
parents:
14646
diff
changeset
|
137 |
end |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
138 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
139 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
140 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
141 |
function AnimWait(gear, time) -- gear is for compatibility with Animate |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
142 |
globalWait = globalWait + time |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
143 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
144 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
145 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
146 |
function AnimWaitLeft() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
147 |
return globalWait |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
148 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
149 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
150 |
function AnimSay(gear, text, manner, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
151 |
HogSay(gear, text, manner, 2) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
152 |
if time ~= nil then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
153 |
AnimWait(gear, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
154 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
155 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
156 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
157 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
158 |
function AnimSound(gear, sound, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
159 |
PlaySound(sound, gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
160 |
AnimWait(gear, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
161 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
162 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
163 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
164 |
function AnimTurn(gear, dir) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
165 |
if dir == "Right" then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
166 |
HogTurnLeft(gear, false) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
167 |
else |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
168 |
HogTurnLeft(gear, true) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
169 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
170 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
171 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
172 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
173 |
function AnimFollowGear(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
174 |
FollowGear(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
175 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
176 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
177 |
|
12778
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
178 |
function AnimMove(gear, dir, posx, posy, maxMoveTime) |
14252
74bf2d906097
Turn accidental globals to locals in Lua libraries
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
179 |
local dirr = moveDirs[dir] |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
180 |
SetGearMessage(gear, dirr) |
12778
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
181 |
moveTime = moveTime + 1 |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
182 |
if (maxMoveTime and moveTime > maxMoveTime) then |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
183 |
SetGearMessage(gear, 0) |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
184 |
SetGearPosition(gear, posx, posy) |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
185 |
lastx = GetX(gear) |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
186 |
lasty = GetY(gear) |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
187 |
moveTime = 0 |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
188 |
return true |
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
189 |
elseif GetX(gear) == posx or GetY(gear) == posy then |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
190 |
SetGearMessage(gear, 0) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
191 |
lastx = GetX(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
192 |
lasty = GetY(gear) |
12778
cb29ec085767
Animate library: Add new parameter maxMoveTime to AnimMove
Wuzzy <Wuzzy2@mail.ru>
parents:
12594
diff
changeset
|
193 |
moveTime = 0 |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
194 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
195 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
196 |
return false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
197 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
198 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
199 |
function AnimJump(gear, jumpType) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
200 |
if jumpStarted == false then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
201 |
lastx = GetX(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
202 |
lasty = GetY(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
203 |
backJumped = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
204 |
jumpStarted = true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
205 |
SetGearMessage(gear, jumpTypes[jumpType]) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
206 |
AnimGearWait(gear, jumpTimes[jumpType]) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
207 |
elseif jumpType == "back" and backJumped == false then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
208 |
backJumped = true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
209 |
SetGearMessage(gear, jumpTypes[jumpType]) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
210 |
AnimGearWait(gear, jumpTimes["backback"]) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
211 |
else |
14252
74bf2d906097
Turn accidental globals to locals in Lua libraries
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
212 |
local curx = GetX(gear) |
74bf2d906097
Turn accidental globals to locals in Lua libraries
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
213 |
local cury = GetY(gear) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
214 |
if curx == lastx and cury == lasty then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
215 |
jumpStarted = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
216 |
backJumped = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
217 |
AnimGearWait(gear, 100) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
218 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
219 |
else |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
220 |
lastx = curx |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
221 |
lasty = cury |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
222 |
AnimGearWait(gear, 100) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
223 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
224 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
225 |
return false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
226 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
227 |
|
7448
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
228 |
function AnimSetGearPosition(gear, destX, destY, fall) |
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
229 |
SetGearPosition(gear, destX, destY) |
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
230 |
if fall ~= false then |
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
231 |
SetGearVelocity(gear, 0, 10) |
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
232 |
end |
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
233 |
return true |
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
234 |
end |
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
235 |
|
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
236 |
function AnimDisappear(gear, destX, destY) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
237 |
AddVisualGear(GetX(gear)-5, GetY(gear)-5, vgtSmoke, 0, false) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
238 |
AddVisualGear(GetX(gear)+5, GetY(gear)+5, vgtSmoke, 0, false) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
239 |
AddVisualGear(GetX(gear)-5, GetY(gear)+5, vgtSmoke, 0, false) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
240 |
AddVisualGear(GetX(gear)+5, GetY(gear)-5, vgtSmoke, 0, false) |
7245
53f73f4ae203
Modified frontend so that updating campaogn progress no longer changes current index of the mission combo box
belphegorr <szabibibi@gmail.com>
parents:
7213
diff
changeset
|
241 |
PlaySound(sndExplosion) |
7448
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
242 |
AnimSetGearPosition(gear, destX, destY) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
243 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
244 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
245 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
246 |
function AnimOutOfNowhere(gear, destX, destY) |
14646
835072bcbfb6
Animate lib: AnimOutOfNowhere's 2nd and 3rd args are now optional
Wuzzy <Wuzzy2@mail.ru>
parents:
14626
diff
changeset
|
247 |
if (not destX) or (not destY) then |
835072bcbfb6
Animate lib: AnimOutOfNowhere's 2nd and 3rd args are now optional
Wuzzy <Wuzzy2@mail.ru>
parents:
14626
diff
changeset
|
248 |
destX = GetX(gear) |
835072bcbfb6
Animate lib: AnimOutOfNowhere's 2nd and 3rd args are now optional
Wuzzy <Wuzzy2@mail.ru>
parents:
14626
diff
changeset
|
249 |
destY = GetY(gear) |
835072bcbfb6
Animate lib: AnimOutOfNowhere's 2nd and 3rd args are now optional
Wuzzy <Wuzzy2@mail.ru>
parents:
14626
diff
changeset
|
250 |
end |
7448
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
251 |
AnimSetGearPosition(gear, destX, destY) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
252 |
AddVisualGear(destX, destY, vgtBigExplosion, 0, false) |
7245
53f73f4ae203
Modified frontend so that updating campaogn progress no longer changes current index of the mission combo box
belphegorr <szabibibi@gmail.com>
parents:
7213
diff
changeset
|
253 |
PlaySound(sndExplosion) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
254 |
AnimGearWait(gear, 50) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
255 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
256 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
257 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
258 |
function AnimTeleportGear(gear, destX, destY) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
259 |
AddVisualGear(GetX(gear)-5, GetY(gear)-5, vgtSmoke, 0, false) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
260 |
AddVisualGear(GetX(gear)+5, GetY(gear)+5, vgtSmoke, 0, false) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
261 |
AddVisualGear(GetX(gear)-5, GetY(gear)+5, vgtSmoke, 0, false) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
262 |
AddVisualGear(GetX(gear)+5, GetY(gear)-5, vgtSmoke, 0, false) |
7448
d0521a3a4358
Solved "floating repositionings" in every mission
belphegorr <szabibibi@gmail.com>
parents:
7438
diff
changeset
|
263 |
AnimSetGearPosition(gear, destX, destY) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
264 |
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) |
7245
53f73f4ae203
Modified frontend so that updating campaogn progress no longer changes current index of the mission combo box
belphegorr <szabibibi@gmail.com>
parents:
7213
diff
changeset
|
265 |
PlaySound(sndExplosion) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
266 |
FollowGear(gear) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
267 |
AnimGearWait(gear, 50) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
268 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
269 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
270 |
|
13684
739fd039daaa
Animate: Remove follow arg from AnimVisualGear
Wuzzy <Wuzzy2@mail.ru>
parents:
13032
diff
changeset
|
271 |
function AnimVisualGear(gear, x, y, vgType, state, critical) |
739fd039daaa
Animate: Remove follow arg from AnimVisualGear
Wuzzy <Wuzzy2@mail.ru>
parents:
13032
diff
changeset
|
272 |
AddVisualGear(x, y, vgType, state, critical) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
273 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
274 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
275 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
276 |
function AnimCaption(gear, text, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
277 |
AddCaption(text) |
7213
fce7de71742f
Fixed some bugs with Mission 2 and Animate.lua.
belphegorr <szabibibi@gmail.com>
parents:
7205
diff
changeset
|
278 |
if time == nil then |
fce7de71742f
Fixed some bugs with Mission 2 and Animate.lua.
belphegorr <szabibibi@gmail.com>
parents:
7205
diff
changeset
|
279 |
return true |
fce7de71742f
Fixed some bugs with Mission 2 and Animate.lua.
belphegorr <szabibibi@gmail.com>
parents:
7205
diff
changeset
|
280 |
end |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
281 |
AnimWait(gear, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
282 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
283 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
284 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
285 |
function AnimCustomFunction(gear, func, args) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
286 |
if args == nil then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
287 |
args = {} |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
288 |
end |
14252
74bf2d906097
Turn accidental globals to locals in Lua libraries
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
289 |
local retval = func(unpack(args)) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
290 |
if retval == false then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
291 |
return false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
292 |
else |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
293 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
294 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
295 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
296 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
297 |
function AnimInsertStepNext(step) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
298 |
table.insert(AnimList[1], animPos + 1, step) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
299 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
300 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
301 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
302 |
function AnimShowMission(gear, caption, subcaption, text, icon, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
303 |
ShowMission(caption, subcaption, text, icon, time) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
304 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
305 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
306 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
307 |
function RemoveAnim() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
308 |
table.remove(AnimList, 1) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
309 |
AnimListNum = AnimListNum - 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
310 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
311 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
312 |
function AddAnim(animation) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
313 |
table.insert(AnimList, animation) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
314 |
AnimListNum = AnimListNum + 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
315 |
if AnimListNum == 1 then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
316 |
skipping = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
317 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
318 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
319 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
320 |
function ShowAnimation() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
321 |
if AnimListNum == 0 then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
322 |
skipping = false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
323 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
324 |
else |
13752
110d6c1e817f
Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
325 |
SetTurnTimeLeft(MAX_TURN_TIME) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
326 |
if Animate(AnimList[1]) == true then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
327 |
RemoveAnim() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
328 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
329 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
330 |
return false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
331 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
332 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
333 |
function Animate(steps) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
334 |
if skipping == true then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
335 |
animPos = 1 |
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
336 |
stopCinemaLock() |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
337 |
SkipAnimation(steps) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
338 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
339 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
340 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
341 |
if globalWait ~= 0 then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
342 |
return false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
343 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
344 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
345 |
if steps[animPos] == nil then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
346 |
animPos = 1 |
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
347 |
stopCinemaLock() |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
348 |
return true |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
349 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
350 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
351 |
if steps[animPos].args[1] ~= CurrentHedgehog and steps[animPos].func ~= AnimWait |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
352 |
and (steps[animPos].swh == nil or steps[animPos].swh == true) then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
353 |
AnimSwitchHog(steps[animPos].args[1]) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
354 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
355 |
|
12088
1da37e2ba6fd
Fix A Space Adventure Missions allowing player to walk before 1st animation and screw things up
Wuzzy <almikes@aol.com>
parents:
12084
diff
changeset
|
356 |
startCinemaLock() |
14252
74bf2d906097
Turn accidental globals to locals in Lua libraries
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
357 |
local retVal = steps[animPos].func(unpack(steps[animPos].args)) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
358 |
if (retVal ~= false) then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
359 |
animPos = animPos + 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
360 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
361 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
362 |
return false |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
363 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
364 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
365 |
------------------------------Event Handling------------------------------ |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
366 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
367 |
function AddEvent(condFunc, condArgs, doFunc, doArgs, evType) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
368 |
seNum = seNum + 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
369 |
stageEvents[seNum] = {} |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
370 |
stageEvents[seNum].cFunc = condFunc |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
371 |
stageEvents[seNum].cArgs = condArgs |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
372 |
stageEvents[seNum].dFunc = doFunc |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
373 |
stageEvents[seNum].dArgs = doArgs |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
374 |
stageEvents[seNum].evType = evType |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
375 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
376 |
|
7263
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
377 |
function AddNewEvent(condFunc, condArgs, doFunc, doArgs, evType) |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
378 |
local i |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
379 |
for i = 1, seNum do |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
380 |
if stageEvents[i].cFunc == condFunc and stageEvents[i].cArgs == condArgs and |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
381 |
stageEvents[i].dFunc == doFunc and stageEvents[i].dArgs == doArgs and |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
382 |
stageEvents[seNum].evType == evType then |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
383 |
return |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
384 |
end |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
385 |
end |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
386 |
AddEvent(condFunc, condArgs, doFunc, doArgs, evType) |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
387 |
end |
644eabbc9218
Added a new function: AddNewEvent, which only adds an event to the list if it doesn't already exist. Kept the old one as it might me useful to be able to add an event more than once.
belphegorr <szabibibi@gmail.com>
parents:
7255
diff
changeset
|
388 |
|
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
389 |
function RemoveEvent(evNum) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
390 |
if stageEvents[evNum] ~= nil then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
391 |
seNum = seNum - 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
392 |
table.remove(stageEvents, evNum) |
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
393 |
if evNum < curEvent then |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
394 |
return true |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
395 |
end |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
396 |
end |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
397 |
if evNum < curEvent then |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
398 |
needToDecrease = needToDecrease + 1 |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
399 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
400 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
401 |
|
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
402 |
function RemoveEventFunc(cFunc, cArgs) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
403 |
local i = 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
404 |
while i <= seNum do |
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
405 |
if stageEvents[i].cFunc == cFunc and (cArgs == nil or cArgs == stageEvents[i].cArgs) then |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
406 |
RemoveEvent(i) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
407 |
i = i - 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
408 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
409 |
i = i + 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
410 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
411 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
412 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
413 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
414 |
function CheckEvents() |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
415 |
local i = 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
416 |
while i <= seNum do |
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
417 |
curEvent = i |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
418 |
if stageEvents[i].cFunc(unpack(stageEvents[i].cArgs)) then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
419 |
stageEvents[i].dFunc(unpack(stageEvents[i].dArgs)) |
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
420 |
if needToDecrease > 0 then |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
421 |
i = i - needToDecrease |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
422 |
needToDecrease = 0 |
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
423 |
end |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
424 |
if stageEvents[i].evType ~= 1 then |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
425 |
RemoveEvent(i) |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
426 |
i = i - 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
427 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
428 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
429 |
i = i + 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
430 |
end |
7438
195f9cbd6df6
Modified Animate.lua: Modified event removal function to check if removed event is before current one, added optional parameter to RemoveEventFunc for optional checking of parameter list identicity.
belphegorr <szabibibi@gmail.com>
parents:
7263
diff
changeset
|
431 |
curEvent = 0 |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
432 |
end |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
433 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
434 |
-------------------------------------Misc--------------------------------- |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
435 |
|
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
436 |
function StoppedGear(gear) |
13032
91f23558c936
Lua library Animate: StoppedGear now returns true if gear does not exist
Wuzzy <Wuzzy2@mail.ru>
parents:
12778
diff
changeset
|
437 |
-- GetHealth returns nil if gear does not exist |
91f23558c936
Lua library Animate: StoppedGear now returns true if gear does not exist
Wuzzy <Wuzzy2@mail.ru>
parents:
12778
diff
changeset
|
438 |
if not GetHealth(gear) then |
91f23558c936
Lua library Animate: StoppedGear now returns true if gear does not exist
Wuzzy <Wuzzy2@mail.ru>
parents:
12778
diff
changeset
|
439 |
-- We consider the gear to be “stopped” if it has been destroyed |
91f23558c936
Lua library Animate: StoppedGear now returns true if gear does not exist
Wuzzy <Wuzzy2@mail.ru>
parents:
12778
diff
changeset
|
440 |
return true |
91f23558c936
Lua library Animate: StoppedGear now returns true if gear does not exist
Wuzzy <Wuzzy2@mail.ru>
parents:
12778
diff
changeset
|
441 |
end |
14252
74bf2d906097
Turn accidental globals to locals in Lua libraries
Wuzzy <Wuzzy2@mail.ru>
parents:
13752
diff
changeset
|
442 |
local dx,dy = GetGearVelocity(gear) |
7205
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
443 |
return math.abs(dx) <= 1 and math.abs(dy) <= 1 |
cdc38e49a276
Added the helper script I forgot to add last time
belphegorr <szabibibi@gmail.com>
parents:
diff
changeset
|
444 |
end |