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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
#include <precomp.h>
#include <api.h>
#ifdef WASABI_COMPILE_WND
#include <api/wnd/basewnd.h>
#include <tataki/canvas/bltcanvas.h>
#endif
#include <api/script/guru.h>
#include <api/script/script.h>
#include <api/script/vcpu.h>
#ifdef WASABI_COMPILE_SKIN
#include <api/skin/skin.h>
#endif
extern HINSTANCE hInstance;
#ifdef WASABI_COMPILE_WND
Guru::Guru()
{
fcount = 0;
txt=NULL;
code=0;
intinfo=0;
}
Guru::~Guru() {
}
#endif
void Guru::spawn(SystemObject *_script, int code, const wchar_t *pub, int intinfo) {
#ifdef WASABI_COMPILE_WND
script = _script;
if (WASABI_API_PALETTE->getSkinPartIterator() > last_iterator) {
mustquit = 0;
last_iterator = WASABI_API_PALETTE->getSkinPartIterator();
}
else
return;
#ifdef WASABI_COMPILE_SKIN
int oldlock = WASABI_API_SKIN->skin_getLockUI();
WASABI_API_SKIN->skin_setLockUI(0);
#endif
Guru g;
g.setCode(code);
g.setPublicTxt(pub);
g.setIntInfo(intinfo);
g.setStartHidden(1);
g.init(hInstance, INVALIDOSWINDOWHANDLE, TRUE);
RECT r;
Wasabi::Std::getViewport(&r, (POINT*)NULL);
r.left = r.left + ((r.right-r.left-640)/2);
r.right = r.left + 640;
TextInfoCanvas c(&g);
Wasabi::FontInfo fontInfo;
fontInfo.pointSize = WASABI_API_APP->getScaleY(14);
#ifdef WIN32
fontInfo.face = L"Lucida Console";
#else
fontInfo.face = L"Lucida";
#endif
fontInfo.bold = true;
r.bottom = r.top + c.getTextHeight(&fontInfo)* (script != NULL ? 9 : 7);
g.resize(&r);
g.setVisible(1);
g.bringToFront();
MSG msg = {0};
WASABI_API_WND->pushModalWnd(&g);
#ifdef WIN32
HWND old = SetCapture(g.gethWnd());
#endif
while (!mustquit) {
mustquit = !GetMessage(&msg, g.gethWnd(), 0, 0);
#ifdef WIN32
if (!msg.hwnd || !TranslateAccelerator(msg.hwnd, NULL, &msg)) {
#endif
TranslateMessage(&msg);
DispatchMessage(&msg);
#ifdef WIN32
}
#endif
}
WASABI_API_WND->popModalWnd(&g);
#ifdef WIN32
SetCapture(old);
#endif
#else
StringPrintfW t(L"Guru Meditation #%04X.%04X%04X.%d%s%s", code, (intinfo & 0xFFFF), VCPU::VIP & 0xFFFF, VCPU::VSD, pub?" ":"", pub?pub:"");
Std::messageBox(t, L"Guru Meditiation", 16);
#endif
#ifdef WASABI_COMPILE_SKIN
WASABI_API_SKIN->skin_setLockUI(oldlock);
#endif
}
#ifdef WASABI_COMPILE_WND
int Guru::onPaint(Canvas *canvas) {
GURU_PARENT::onPaint(canvas);
PaintBltCanvas paintcanvas;
if (canvas == NULL) {
paintcanvas.beginPaint(this);
canvas = &paintcanvas;
}
RECT r;
getClientRect(&r);
canvas->fillRect(&r, 0);
if (fcount%2==0)
{
int w;
Wasabi::FontInfo fontInfo;
fontInfo.color = RGB(0xFF,0,0);
fontInfo.pointSize = WASABI_API_APP->getScaleY(14);
#ifdef WIN32
fontInfo.face = L"Lucida Console";
#else
fontInfo.face = L"Lucida";
#endif
fontInfo.bold = true;
fontInfo.opaque = false;
w = canvas->getTextHeight(&fontInfo);
RECT s = {40, w*2, 560, w*3};
canvas->textOutCentered(&s, L"Winamp Script Failure. Press the left mouse button to continue.", &fontInfo);
StringPrintfW t(L"Guru Meditation #%04X.%04X%04X.%d%s%s", code, (intinfo & 0xFFFF), VCPU::VIP & 0xFFFF, VCPU::VSD, txt?L" ":L"", txt?txt:L"");
s.top=w*4;
s.bottom=s.top+w;
canvas->textOutCentered(&s, t, &fontInfo);
if (script != NULL) {
s.top=w*6;
s.bottom=s.top+w;
canvas->textOutCentered(&s, script->getFilename(), &fontInfo);
}
RECT z;
z.top = r.top + 5;
z.bottom = r.top + min(10, w-2);
z.left = r.left + 5;
z.right = r.right - 5;
canvas->fillRect(&z, RGB(0xFF,0,0));
z.top = r.top + 5;
z.bottom = r.bottom - 5;;
z.left = r.right - min(10, w-2);
z.right = r.right - 5;
canvas->fillRect(&z, RGB(0xFF,0,0));
z.top = r.bottom - min(10, w-2);
z.bottom = r.bottom - 5;
z.left = r.left + 5;
z.right = r.right - 5;
canvas->fillRect(&z, RGB(0xFF,0,0));
z.top = r.top + 5;
z.bottom = r.bottom - 5;;
z.left = r.left + 5;
z.right = r.left + min(10, w-2);
canvas->fillRect(&z, RGB(0xFF,0,0));
}
return 1;
}
int Guru::onLeftButtonUp(int x, int y) {
mustquit=1;
return GURU_PARENT::onLeftButtonUp(x,y);
}
int Guru::onInit() {
GURU_PARENT::onInit();
setTimer(GURU_TIMERID, 400);
return 1;
}
void Guru::setCode(int c) {
code = c;
}
void Guru::setPublicTxt(const wchar_t *t) {
txt = t;
}
void Guru::setIntInfo(int info) {
intinfo = info;
}
void Guru::timerCallback(int id) {
if (id == GURU_TIMERID) {
fcount++;
if (fcount > 7) {
killTimer(GURU_TIMERID);
}
invalidate();
return;
}
GURU_PARENT::timerCallback(id);
}
int Guru::mustquit = 0;
int Guru::last_iterator = -1;
SystemObject * Guru::script = NULL;
#endif
|