author | S.D. |
Sun, 16 Oct 2022 13:14:16 +0300 | |
changeset 15908 | 014f4edd0421 |
permissions | -rw-r--r-- |
15908
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
1 |
(* |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
2 |
* Hedgewars, a free turn based strategy game |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
3 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
4 |
* |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
8 |
* |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
13 |
* |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
17 |
*) |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
18 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
19 |
{$INCLUDE "options.inc"} |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
20 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
21 |
unit uDrawing; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
22 |
(* |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
23 |
* This unit defines the Drawing mode, which allows drawing some graphics |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
24 |
* private to the members of a clan. |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
25 |
*) |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
26 |
interface |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
27 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
28 |
procedure initModule; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
29 |
procedure freeModule; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
30 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
31 |
function isDrawingModeActive(): boolean; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
32 |
procedure onModeButtonPressed(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
33 |
procedure onModeButtonReleased(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
34 |
procedure onFocusStateChanged(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
35 |
procedure onCursorMoved(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
36 |
procedure onLeftMouseButtonPressed(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
37 |
procedure onLeftMouseButtonReleased(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
38 |
procedure onRightMouseButtonPressed(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
39 |
procedure onMiddleMouseButtonPressed(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
40 |
procedure handleIPCInput(cmd : shortstring); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
41 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
42 |
implementation |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
43 |
uses uTypes, uConsts, uVariables, uVisualGearsList, uUtils, uDebug, uIO, SDLh, Math; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
44 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
45 |
const |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
46 |
cColorsCount = 9; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
47 |
cColors : array [0..cColorsCount - 1] of LongWord = ( |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
48 |
$ff020400, |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
49 |
$4980c100, |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
50 |
$1de6ba00, |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
51 |
$b541ef00, |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
52 |
$e55bb000, |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
53 |
$20bf0000, |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
54 |
$fe8b0e00, |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
55 |
$8f590200, |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
56 |
$ffff0100 |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
57 |
); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
58 |
// Reserve one color for the local user |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
59 |
cKnownUsersMax = cColorsCount - 1; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
60 |
cPointRadius = 25; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
61 |
cBeaconDuration = 125; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
62 |
cEffectDuration = 500; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
63 |
cMaxDrawingRadius = 150; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
64 |
cEffectGearsCountMax = 4; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
65 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
66 |
type |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
67 |
TDrawingState = (drwDisabled, drwStart, drwPoint, drwArrow); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
68 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
69 |
TVisualEffect = record |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
70 |
vGears : array [0..cEffectGearsCountMax - 1] of PVisualGear; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
71 |
gearsCount : integer; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
72 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
73 |
TDrawingContext = record |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
74 |
state : TDrawingState; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
75 |
currVEffect : TVisualEffect; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
76 |
prevAutoCameraOn : boolean; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
77 |
startCursorX : LongInt; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
78 |
startCursorY : LongInt; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
79 |
knownUsers : array [0..cKnownUsersMax - 1] of shortstring; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
80 |
knownUsersCount : integer; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
81 |
lastReplacedUserIdx : integer; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
82 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
83 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
84 |
var drawingCtx : TDrawingContext; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
85 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
86 |
procedure AddKnownUser(user : shortstring); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
87 |
var i : integer; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
88 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
89 |
with drawingCtx do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
90 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
91 |
for i:= 0 to knownUsersCount - 1 do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
92 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
93 |
if knownUsers[i] = user then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
94 |
exit; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
95 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
96 |
if knownUsersCount < cKnownUsersMax then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
97 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
98 |
knownUsers[knownUsersCount]:= user; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
99 |
Inc(knownUsersCount); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
100 |
end |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
101 |
else |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
102 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
103 |
lastReplacedUserIdx:= (lastReplacedUserIdx + 1) mod cKnownUsersMax; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
104 |
knownUsers[lastReplacedUserIdx]:= user; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
105 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
106 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
107 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
108 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
109 |
function GetUserColor(user : shortstring) : LongWord; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
110 |
var i : integer; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
111 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
112 |
if user = '' then // local user |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
113 |
exit(cColors[0]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
114 |
with drawingCtx do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
115 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
116 |
for i:= 0 to knownUsersCount - 1 do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
117 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
118 |
if knownUsers[i] = user then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
119 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
120 |
exit(cColors[i + 1]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
121 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
122 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
123 |
exit(cColors[0]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
124 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
125 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
126 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
127 |
procedure recalcArrowParams(var arrow: TVisualEffect; X1, Y1, X2, Y2 : real); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
128 |
var tmp, tmpSin, tmpCos : real; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
129 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
130 |
with arrow.vGears[0]^ do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
131 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
132 |
X:= X1; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
133 |
Y:= Y1; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
134 |
dX:= X2; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
135 |
dY:= Y2; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
136 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
137 |
// Compute arrow pointer coordinates |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
138 |
if X2 = X1 then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
139 |
if Y2 > Y1 then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
140 |
tmp:= PI / 2 |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
141 |
else |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
142 |
tmp:= -PI / 2 |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
143 |
else |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
144 |
tmp:= arctan2(Y2 - Y1, X2 - X1); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
145 |
tmpSin:= sin(tmp - PI / 4); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
146 |
tmpCos:= cos(tmp - PI / 4); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
147 |
with arrow.vGears[1]^ do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
148 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
149 |
X:= X2; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
150 |
Y:= Y2; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
151 |
dX:= X2 - 50 * tmpCos; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
152 |
dY:= Y2 - 50 * tmpSin; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
153 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
154 |
tmpSin:= sin(tmp + PI / 4); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
155 |
tmpCos:= cos(tmp + PI / 4); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
156 |
with arrow.vGears[2]^ do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
157 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
158 |
X:= X2; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
159 |
Y:= Y2; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
160 |
dX:= X2 - 50 * tmpCos; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
161 |
dY:= Y2 - 50 * tmpSin; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
162 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
163 |
// Compute circle center |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
164 |
with arrow.vGears[3]^ do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
165 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
166 |
X:= (X1 + X2) / 2; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
167 |
Y:= (Y1 + Y2) / 2; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
168 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
169 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
170 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
171 |
procedure doStepPoint(Gear: PVisualGear; Steps: Longword); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
172 |
var tmp: LongInt; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
173 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
174 |
if Gear^.FrameTicks <= Steps then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
175 |
DeleteVisualGear(Gear) |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
176 |
else |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
177 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
178 |
dec(Gear^.FrameTicks, Steps); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
179 |
if Gear^.Tag = 0 then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
180 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
181 |
tmp:= round(Gear^.FrameTicks * $FF / cEffectDuration); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
182 |
if tmp > $FF then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
183 |
tmp:= $FF; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
184 |
if tmp >= 0 then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
185 |
Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or Longword(tmp); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
186 |
end |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
187 |
else if Gear^.Tag = 1 then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
188 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
189 |
Gear^.State:= round(Gear^.FrameTicks * 2048 / cBeaconDuration); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
190 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
191 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
192 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
193 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
194 |
procedure doStepArrow(Gear: PVisualGear; Steps: Longword); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
195 |
var tmp: LongInt; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
196 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
197 |
if Gear^.Tag = 100 then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
198 |
exit; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
199 |
if Gear^.FrameTicks <= Steps then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
200 |
DeleteVisualGear(Gear) |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
201 |
else |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
202 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
203 |
dec(Gear^.FrameTicks, Steps); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
204 |
if Gear^.Tag < 3 then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
205 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
206 |
tmp:= round(Gear^.FrameTicks * $FF / cEffectDuration); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
207 |
if tmp > $FF then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
208 |
tmp:= $FF; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
209 |
if tmp >= 0 then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
210 |
Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or Longword(tmp); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
211 |
end |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
212 |
else if Gear^.Tag = 3 then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
213 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
214 |
Gear^.State:= round(Gear^.FrameTicks * 2048 / cBeaconDuration); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
215 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
216 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
217 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
218 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
219 |
function isEffectEmpty(var vEffect : TVisualEffect) : boolean; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
220 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
221 |
isEffectEmpty:= vEffect.gearsCount = 0; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
222 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
223 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
224 |
function AddVEffectCircle(user : shortstring; X, Y : LongInt) : TVisualEffect; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
225 |
var vGear : PVisualGear; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
226 |
vEffect : TVisualEffect; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
227 |
color : LongWord; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
228 |
i : integer; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
229 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
230 |
color:= GetUserColor(user); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
231 |
for i:= 0 to 1 do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
232 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
233 |
vGear := AddVisualGear(X, Y, vgtCircle, cPointRadius, true, 1); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
234 |
if vGear = nil then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
235 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
236 |
OutError('uDrawing: AddVisualGear returned nil', false); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
237 |
vEffect.gearsCount:= 0; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
238 |
exit(vEffect); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
239 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
240 |
vGear^.Tint:= color or $FF; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
241 |
vGear^.Angle:= 0; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
242 |
vGear^.Timer:= 10; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
243 |
vGear^.Tag:= i; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
244 |
vGear^.doStep:= @doStepPoint; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
245 |
vEffect.vGears[i]:= vGear; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
246 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
247 |
vEffect.vGears[0]^.Tint:= color or $FF; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
248 |
vEffect.vGears[0]^.FrameTicks:= cEffectDuration; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
249 |
vEffect.vGears[1]^.Tint:= color or $3F; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
250 |
vEffect.vGears[1]^.FrameTicks:= cBeaconDuration; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
251 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
252 |
vEffect.gearsCount:= 2; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
253 |
AddVEffectCircle:= vEffect; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
254 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
255 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
256 |
function AddVEffectArrow(user : shortstring; X1, Y1, X2, Y2 : LongInt) : TVisualEffect; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
257 |
var vGear : PVisualGear; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
258 |
vEffect : TVisualEffect; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
259 |
color : LongWord; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
260 |
i : integer; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
261 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
262 |
color:= GetUserColor(user); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
263 |
for i:= 0 to 2 do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
264 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
265 |
vGear := AddVisualGear(0, 0, vgtLine, 10, true, 1); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
266 |
if vGear = nil then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
267 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
268 |
OutError('uDrawing: AddVisualGear returned nil', false); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
269 |
vEffect.gearsCount:= 0; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
270 |
exit(vEffect); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
271 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
272 |
vGear^.Tint:= color or $FF; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
273 |
vGear^.FrameTicks:= cEffectDuration; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
274 |
vGear^.Tag:= 100; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
275 |
vGear^.doStep:= @doStepArrow; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
276 |
vEffect.vGears[i]:= vGear; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
277 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
278 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
279 |
vGear := AddVisualGear(0, 0, vgtCircle, 2048, true, 1); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
280 |
if vGear = nil then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
281 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
282 |
OutError('uDrawing: AddVisualGear returned nil', false); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
283 |
vEffect.gearsCount:= 0; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
284 |
exit(vEffect); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
285 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
286 |
vGear^.Tint:= color; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
287 |
vGear^.Angle:= 0; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
288 |
vGear^.FrameTicks:= cBeaconDuration; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
289 |
vGear^.Timer:= 10; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
290 |
vGear^.Tag:= 100; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
291 |
vGear^.doStep:= @doStepArrow; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
292 |
vEffect.vGears[3]:= vGear; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
293 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
294 |
vEffect.gearsCount:= 4; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
295 |
recalcArrowParams(vEffect, X1, Y1, X2, Y2); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
296 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
297 |
AddVEffectArrow:= vEffect; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
298 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
299 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
300 |
procedure VEffectArrowStart(var vEffect : TVisualEffect); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
301 |
var i : integer; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
302 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
303 |
for i:= 0 to vEffect.gearsCount - 1 do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
304 |
vEffect.vGears[i]^.Tag:= i; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
305 |
vEffect.vGears[3]^.Tint:= (vEffect.vGears[3]^.Tint and $FFFFFF00) or $3F; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
306 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
307 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
308 |
procedure DeleteVEffect(var vEffect : TVisualEffect); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
309 |
var i : integer; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
310 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
311 |
for i:= 0 to vEffect.gearsCount - 1 do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
312 |
DeleteVisualGear(vEffect.vGears[i]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
313 |
vEffect.gearsCount:= 0; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
314 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
315 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
316 |
function isDrawingModeActive() : boolean; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
317 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
318 |
isDrawingModeActive:= drawingCtx.state <> drwDisabled; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
319 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
320 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
321 |
procedure SendIPCArrow(X1, Y1, X2, Y2: LongInt); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
322 |
var s: shortstring; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
323 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
324 |
s[0]:= #18; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
325 |
s[1]:= 'O'; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
326 |
s[2]:= 'a'; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
327 |
SDLNet_Write32(X1, @s[3]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
328 |
SDLNet_Write32(Y1, @s[7]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
329 |
SDLNet_Write32(X2, @s[11]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
330 |
SDLNet_Write32(Y2, @s[15]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
331 |
SendIPC(s) |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
332 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
333 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
334 |
procedure SendIPCCircle(X1, Y1: LongInt); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
335 |
var s: shortstring; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
336 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
337 |
s[0]:= #10; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
338 |
s[1]:= 'O'; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
339 |
s[2]:= 'c'; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
340 |
SDLNet_Write32(X1, @s[3]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
341 |
SDLNet_Write32(Y1, @s[7]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
342 |
SendIPC(s) |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
343 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
344 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
345 |
procedure handleIPCInput(cmd: shortstring); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
346 |
var i, drwCmdOffset : integer; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
347 |
userNameLen : Byte; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
348 |
user : shortstring; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
349 |
X1, Y1, X2, Y2 : LongInt; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
350 |
VEffect : TVisualEffect; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
351 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
352 |
case cmd[1] of |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
353 |
'u' : begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
354 |
userNameLen:= Byte(cmd[2]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
355 |
for i:= 0 to userNameLen do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
356 |
user[i]:= cmd[2 + i]; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
357 |
drwCmdOffset:= 2 + userNameLen + 1; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
358 |
if Length(cmd) < drwCmdOffset then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
359 |
exit; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
360 |
AddKnownUser(user); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
361 |
case cmd[drwCmdOffset] of |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
362 |
'a' : begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
363 |
if Length(cmd) < drwCmdOffset + 4 * 4 then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
364 |
exit; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
365 |
X1:= SDLNet_Read32(@cmd[drwCmdOffset + 1]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
366 |
Y1:= SDLNet_Read32(@cmd[drwCmdOffset + 1 + 4]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
367 |
X2:= SDLNet_Read32(@cmd[drwCmdOffset + 1 + 8]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
368 |
Y2:= SDLNet_Read32(@cmd[drwCmdOffset + 1 + 12]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
369 |
VEffect:= AddVEffectArrow(user, X1, Y1, X2, Y2); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
370 |
if not isEffectEmpty(VEffect) then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
371 |
VEffectArrowStart(VEffect); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
372 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
373 |
'c' : begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
374 |
if Length(cmd) < drwCmdOffset + 4 * 2 then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
375 |
exit; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
376 |
X1:= SDLNet_Read32(@cmd[drwCmdOffset + 1]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
377 |
Y1:= SDLNet_Read32(@cmd[drwCmdOffset + 1 + 4]); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
378 |
VEffect:= AddVEffectCircle(user, X1, Y1); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
379 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
380 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
381 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
382 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
383 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
384 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
385 |
procedure onModeButtonPressed(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
386 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
387 |
drawingCtx.state:= drwStart; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
388 |
drawingCtx.prevAutoCameraOn:= autoCameraOn; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
389 |
autoCameraOn:= false; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
390 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
391 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
392 |
procedure onModeButtonReleased(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
393 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
394 |
DeleteVEffect(drawingCtx.currVEffect); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
395 |
if drawingCtx.state <> drwDisabled then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
396 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
397 |
drawingCtx.state:= drwDisabled; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
398 |
autoCameraOn:= drawingCtx.prevAutoCameraOn; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
399 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
400 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
401 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
402 |
procedure onFocusStateChanged(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
403 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
404 |
if not cHasFocus then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
405 |
onModeButtonReleased(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
406 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
407 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
408 |
procedure onLeftMouseButtonPressed(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
409 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
410 |
if not isDrawingModeActive() then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
411 |
exit; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
412 |
case drawingCtx.state of |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
413 |
drwStart: begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
414 |
drawingCtx.startCursorX:= CursorPoint.X; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
415 |
drawingCtx.startCursorY:= CursorPoint.Y; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
416 |
drawingCtx.state:= drwPoint; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
417 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
418 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
419 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
420 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
421 |
procedure onLeftMouseButtonReleased(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
422 |
var tmpX, tmpY, tmpX2, tmpY2 : LongInt; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
423 |
vEffect : TVisualEffect; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
424 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
425 |
if not isDrawingModeActive() then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
426 |
exit; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
427 |
case drawingCtx.state of |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
428 |
drwPoint: begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
429 |
tmpX:= drawingCtx.startCursorX - WorldDx; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
430 |
tmpY:= cScreenHeight - drawingCtx.startCursorY - WorldDy; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
431 |
vEffect:= AddVEffectCircle('', tmpX, tmpY); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
432 |
if not isEffectEmpty(vEffect) then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
433 |
SendIPCCircle(tmpX, tmpY); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
434 |
drawingCtx.state:= drwStart; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
435 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
436 |
drwArrow: begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
437 |
tmpX2:= CursorPoint.X - WorldDx; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
438 |
tmpY2:= cScreenHeight - CursorPoint.Y - WorldDy; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
439 |
with drawingCtx do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
440 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
441 |
tmpX:= startCursorX - WorldDx; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
442 |
tmpY:= cScreenHeight - startCursorY - WorldDy; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
443 |
recalcArrowParams(currVEffect, tmpX, tmpY, tmpX2, tmpY2); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
444 |
VEffectArrowStart(currVEffect); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
445 |
SendIPCArrow(tmpX, tmpY, tmpX2, tmpY2); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
446 |
currVEffect.gearsCount:= 0; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
447 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
448 |
drawingCtx.state:= drwStart; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
449 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
450 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
451 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
452 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
453 |
procedure onRightMouseButtonPressed(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
454 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
455 |
if not isDrawingModeActive() then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
456 |
exit; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
457 |
DeleteVEffect(drawingCtx.currVEffect); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
458 |
drawingCtx.state:= drwStart; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
459 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
460 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
461 |
procedure onMiddleMouseButtonPressed(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
462 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
463 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
464 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
465 |
procedure onCursorMoved(); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
466 |
var tmpX, tmpY, tmpX2, tmpY2, dX, dY : LongInt; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
467 |
h : real; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
468 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
469 |
if not isDrawingModeActive() then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
470 |
exit; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
471 |
autoCameraOn:= false; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
472 |
dX:= CursorPoint.X - drawingCtx.startCursorX; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
473 |
dY:= CursorPoint.Y - drawingCtx.startCursorY; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
474 |
h:= sqrt(dX * dX + dY * dY); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
475 |
if (drawingCtx.state <> drwStart) and (h > cMaxDrawingRadius) then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
476 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
477 |
CursorPoint.X:= drawingCtx.startCursorX + round(dX * cMaxDrawingRadius / h); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
478 |
CursorPoint.Y:= drawingCtx.startCursorY + round(dY * cMaxDrawingRadius / h); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
479 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
480 |
case drawingCtx.state of |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
481 |
drwPoint : begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
482 |
if h > cPointRadius then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
483 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
484 |
tmpX:= drawingCtx.startCursorX - WorldDx; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
485 |
tmpY:= cScreenHeight - drawingCtx.startCursorY - WorldDy; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
486 |
tmpX2:= CursorPoint.X - WorldDx; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
487 |
tmpY2:= cScreenHeight - CursorPoint.Y - WorldDy; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
488 |
drawingCtx.currVEffect:= AddVEffectArrow('', tmpX, tmpY, tmpX2, tmpY2); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
489 |
if not isEffectEmpty(drawingCtx.currVEffect) then |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
490 |
drawingCtx.state:= drwArrow |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
491 |
else |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
492 |
drawingCtx.state:= drwStart; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
493 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
494 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
495 |
drwArrow : begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
496 |
tmpX:= drawingCtx.startCursorX - WorldDx; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
497 |
tmpY:= cScreenHeight - drawingCtx.startCursorY - WorldDy; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
498 |
tmpX2:= CursorPoint.X - WorldDx; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
499 |
tmpY2:= cScreenHeight - CursorPoint.Y - WorldDy; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
500 |
with drawingCtx do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
501 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
502 |
recalcArrowParams(currVEffect, tmpX, tmpY, tmpX2, tmpY2); |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
503 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
504 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
505 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
506 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
507 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
508 |
procedure initModule; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
509 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
510 |
with drawingCtx do |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
511 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
512 |
state:= drwDisabled; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
513 |
currVEffect.gearsCount:= 0; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
514 |
startCursorX:= 0; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
515 |
startCursorY:= 0; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
516 |
knownUsersCount:= 0; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
517 |
lastReplacedUserIdx:= 0; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
518 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
519 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
520 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
521 |
procedure freeModule; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
522 |
begin |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
523 |
end; |
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
524 |
|
014f4edd0421
Add Drawing mode, which allows drawing some graphics private to the members of a clan
S.D.
parents:
diff
changeset
|
525 |
end. |