5 * Created by Alyssa Milburn on 28/07/2004.
6 * Copyright 2004 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
22 #include "PointerAgent.h"
29 CLAC (command) message (integer)
32 Sets the type of message sent to the TARG agent when clicked. If set to -1, no message
33 will be sent. Using this command will override and reset the value set with CLIK.
35 void caosVM::c_CLAC() {
37 VM_PARAM_INTEGER(message
)
41 targ
->clac
[0] = message
;
49 void caosVM::v_CLAC() {
53 result
.setInt(targ
->clac
[0]);
59 CLIK (command) msg1 (integer) msg2 (integer) msg3 (integer)
62 Sets three different message types that will sent to the TARG agent when clicked, on a
63 rotating basis. Setting any of the three types to -1 will cause it to be ignored. Using
64 this command will override and reset the value set by CLAC.
66 void caosVM::c_CLIK() {
68 VM_PARAM_INTEGER(msg3
)
69 VM_PARAM_INTEGER(msg2
)
70 VM_PARAM_INTEGER(msg1
)
81 CLIK (integer) data (integer)
84 void caosVM::v_CLIK() {
85 VM_PARAM_INTEGER(data
)
92 case 0: result
.setInt(targ
->clik
); break;
93 case 1: result
.setInt(targ
->clac
[0]); break;
94 case 2: result
.setInt(targ
->clac
[1]); break;
95 case 3: result
.setInt(targ
->clac
[2]); break;
100 IMSK (command) flags (integer)
103 Sets the input event flags for the target agent, which tell the engine which events the
104 agent requires scripts to be fired for. For example, setting the "key up" flag means the
105 target agent has the relevant script executed every time a key is released.
107 Add the following values together to calculate the flags parameter: 1 for key down, 2 for key up, 4 for mouse move, 8 for mouse down, 16 for mouse up, 32 for mouse wheel movement and 64 for (translated) keypress.
109 TODO: link to the script details (event numbers and parameters).
111 void caosVM::c_IMSK() {
112 VM_PARAM_INTEGER(flags
)
115 targ
->imsk_key_down
= (flags
& 1);
116 targ
->imsk_key_up
= (flags
& 2);
117 targ
->imsk_mouse_move
= (flags
& 4);
118 targ
->imsk_mouse_down
= (flags
& 8);
119 targ
->imsk_mouse_up
= (flags
& 16);
120 targ
->imsk_mouse_wheel
= (flags
& 32);
121 targ
->imsk_translated_char
= (flags
& 64);
129 Returns the input event flags for the target agent. See the IMSK command for details.
131 void caosVM::v_IMSK() {
133 result
.setInt(0); // TODO
137 KEYD (integer) keycode (integer)
140 Returns 1 if the specified key is held down, or 0 otherwise.
142 void caosVM::v_KEYD() {
143 VM_PARAM_INTEGER(keycode
) // keycodes are crazy broken windows things
145 if (engine
.backend
->keyDown(keycode
))
156 Returns the agent that is currently underneath the Hand.
157 NB: this command is not a real c1/c2 command, backported for convenience
159 void caosVM::v_HOTS() {
160 Agent
*a
= world
.agentAt(world
.hand()->pointerX(), world
.hand()->pointerY()); // TODO: use hotspot
169 Returns the PART of the agent (given by HOTS) that is currently underneath the Hand.
171 Transparency of the parts themselves is ignored.
173 void caosVM::v_HOTP() {
174 CompoundPart
*a
= world
.partAt(world
.hand()->pointerX(), world
.hand()->pointerY(), false);
176 result
.setInt(a
->id
);
182 PURE (command) value (integer)
185 Turns the normal pointing and clicking behavior of the Hand on (0) and off (1).
187 If set to off, CLIK and CLAC will not work, and clicking events must be handled by IMSK.
189 void caosVM::c_PURE() {
190 VM_PARAM_INTEGER(value
)
192 world
.hand()->handle_events
= !value
;
199 Returns whether the normal pointing and clicking behavior of the Hand is on or off.
201 void caosVM::v_PURE() {
202 // TODO: alex claims PURE is inverse behaviour for the command, is this true for this function too? (assuming it is for now)
203 if (world
.hand()->handle_events
)
213 Returns the current X coordinate of the Hand in the world.
215 void caosVM::v_MOPX() {
216 result
.setInt((int)world
.hand()->pointerX());
223 Returns the current Y coordinate of the Hand in the world.
225 void caosVM::v_MOPY() {
226 result
.setInt((int)world
.hand()->pointerY());
230 SCOL (integer) andmask (integer) eormask (integer) upspeeds (bytestring) downspeeds (bytestring)
233 void caosVM::v_SCOL() {
234 VM_PARAM_BYTESTR(downspeeds
)
235 VM_PARAM_BYTESTR(upspeeds
)
236 VM_PARAM_INTEGER(eormask
)
237 VM_PARAM_INTEGER(andmask
)
239 result
.setInt(0); // TODO
243 SCRL (command) enable (integer)
246 Turns on (1) or off (0) keyboard/mouse scrolling.
248 void caosVM::c_SCRL() {
249 VM_PARAM_INTEGER(enable
)
255 MOUS (command) behaviour (integer)
258 void caosVM::c_MOUS() {
259 VM_PARAM_INTEGER(behaviour
)