-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathActions.ras
180 lines (165 loc) · 4.94 KB
/
Actions.ras
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
procedure ActionOpenDoor(actorId: byte);
var
receiverId: byte;
begin
receiverId := actorList[actorId].receiverId;
if(objectList[receiverId].component2 & @COMP_DOOR_2 = @COMP_DOOR_2) then begin
if(objectList[receiverId].onOff = @OFF) then begin
SetZLayer(receiverId, @Z_MAIN, @Z_BACK1);
SwitchAnimation(receiverId,@ANIM_DOOR_ON);
objectList[receiverId].onOff := @ON;
end;
end;
end;
procedure ActionCloseDoor(actorId: byte);
var
receiverId: byte;
begin
receiverId := actorList[actorId].receiverId;
if(objectList[receiverId].component2 & @COMP_DOOR_2 = @COMP_DOOR_2) then begin
if(objectList[receiverId].onOff = @ON) then begin
SetZLayer(receiverId, @Z_BACK1, @Z_MAIN);
SwitchAnimation(receiverId,@ANIM_DOOR_OFF);
objectList[receiverId].onOff := @OFF;
end;
end;
end;
procedure ActionOpenExit(actorId: byte);
var
receiverId: byte;
begin
receiverId := actorList[actorId].receiverId;
if(objectList[receiverId].component3 & @COMP_EXIT_3 = @COMP_EXIT_3) then begin
if(objectList[receiverId].onOff = @OFF) then begin
objectList[receiverId].animId := $FF;
SwitchAnimation(receiverId,@ANIM_EXIT_ON);
objectList[receiverId].onOff := @ON;
end;
end;
end;
procedure ActionCloseExit(actorId: byte);
var
receiverId: byte;
begin
receiverId := actorList[actorId].receiverId;
if(objectList[receiverId].component3 & @COMP_EXIT_3 = @COMP_EXIT_3) then begin
if(objectList[receiverId].onOff = @ON) then begin
objectList[receiverId].animId := $FF;
SwitchAnimation(receiverId,@ANIM_EXIT_OFF);
objectList[receiverId].onOff := @OFF;
end;
end;
end;
procedure ActionLaserCannonOn(actorId: byte);
var
receiverId: byte;
begin
receiverId := actorList[actorId].receiverId;
if(objectList[receiverId].component1 & @COMP_LASER_1 = @COMP_LASER_1) then begin
objectList[receiverId].onOff := @ON;
end;
end;
procedure ActionLaserCannonOff(actorId: byte);
var
receiverId: byte;
begin
receiverId := actorList[actorId].receiverId;
if(objectList[receiverId].component1 & @COMP_LASER_1 = @COMP_LASER_1) then begin
objectList[receiverId].onOff := @OFF;
end;
end;
procedure ActionFontaineOn(actorId: byte);
var
receiverId: byte;
begin
receiverId := actorList[actorId].receiverId;
if(objectList[receiverId].component2 & @COMP_FONTAINE_2 = @COMP_FONTAINE_2) then begin
objectList[receiverId].onOff := @ON;
end;
end;
procedure ActionFontaineOff(actorId: byte);
var
receiverId: byte;
begin
receiverId := actorList[actorId].receiverId;
if(objectList[receiverId].component2 & @COMP_FONTAINE_2 = @COMP_FONTAINE_2) then begin
objectList[receiverId].onOff := @OFF;
end;
end;
procedure ActionPrintText(actorId: byte);
var
textId,x: byte;
begin
textId := actorList[actorId].param0;
x := actorList[actorId].param1;
textTimer := actorList[actorId].param2;
sp := levStrings[textId];
PrintText(x);
end;
procedure ActionSetGrav(actorId: byte);
var
receiverId: byte;
begin
receiverId := actorList[actorId].receiverId;
objectList[receiverId].physGravity := actorList[actorId].param0;
end;
procedure ActionSwitchOn(actorId: byte);
var
receiverId: byte;
begin
receiverId := actorList[actorId].receiverId;
if(objectList[receiverId].component2 & @COMP_SWITCH_2 = @COMP_SWITCH_2) then begin
SwitchAnimation(receiverId, @ANIM_SWITCH_ON);
objectList[receiverId].onOff := @ON;
// DispatchEvent(@EVENT_SWITCH_ON, receiverId, $FF, $FF);
end;
end;
procedure ActionSwitchOff(actorId: byte);
var
receiverId: byte;
begin
receiverId := actorList[actorId].receiverId;
if(objectList[receiverId].component2 & @COMP_SWITCH_2 = @COMP_SWITCH_2) then begin
SwitchAnimation(receiverId, @ANIM_SWITCH_OFF);
objectList[receiverId].onOff := @OFF;
// DispatchEvent(@EVENT_SWITCH_OFF, receiverId, $FF, $FF);
end;
end;
procedure ActionBulkGrav(actorId: byte);
var
id,i : byte;
begin
for i:=0 to countDyn do begin
id := dynObjectList[i];
if(objectList[id].component3 & @COMP_BULK_PHYS_3 = @COMP_BULK_PHYS_3) then begin
objectList[id].physGravity := actorList[actorId].param0;
end;
end;
end;
procedure DispatchEvent(event: byte, senderId: byte, p1,p2: byte);
var
i, action: byte;
begin
for i := 0 to @MAX_ACTORS do begin
if(actorList[i].event = $FF) then break;
if(actorList[i].event = event and actorList[i].senderId = senderId) then begin
action := actorList[i].action;
case action of
@ACTION_DOOR_OPEN: ActionOpenDoor(i);
@ACTION_DOOR_CLOSE: ActionCloseDoor(i);
@ACTION_EXIT_OPEN: ActionOpenExit(i);
@ACTION_EXIT_CLOSE: ActionCloseExit(i);
@ACTION_PRINT_TEXT: ActionPrintText(i);
@ACTION_LASERCANNON_ON: ActionLaserCannonOn(i);
@ACTION_LASERCANNON_OFF: ActionLaserCannonOff(i);
@ACTION_FONTAINE_ON: ActionFontaineOn(i);
@ACTION_FONTAINE_OFF: ActionFontaineOff(i);
@ACTION_SET_GRAV: ActionSetGrav(i);
@ACTION_SWITCH_OFF: ActionSwitchOff(i);
@ACTION_SWITCH_ON: ActionSwitchOn(i);
@ACTION_SET_GRAV_BULK: ActionBulkGrav(i);
@ACTION_CLEAR_TEXT: ClearText();
end;
end;
end;
end;