-
Notifications
You must be signed in to change notification settings - Fork 128
/
Copy pathCreditsThread.cpp
644 lines (541 loc) · 18 KB
/
CreditsThread.cpp
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
//this file is part of eMule
//Copyright (C)2002-2008 Merkur ( strEmail.Format("%s@%s", "devteam", "emule-project.net") / http://www.emule-project.net )
//
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either
//version 2 of the License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "stdafx.h"
#include "emule.h"
#include "CreditsThread.h"
#include "OtherFunctions.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// define mask color
#define MASK_RGB (COLORREF)0xFFFFFF
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC(CCreditsThread, CGDIThread)
BEGIN_MESSAGE_MAP(CCreditsThread, CGDIThread)
//{{AFX_MSG_MAP(CCreditsThread)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CCreditsThread::CCreditsThread(CWnd* pWnd, HDC hDC, CRect rectScreen)
: CGDIThread(pWnd,hDC)
{
m_rectScreen = rectScreen;
m_rgnScreen.CreateRectRgnIndirect(m_rectScreen);
m_nScrollPos = 0;
m_pbmpOldBk = NULL;
m_pbmpOldCredits = NULL;
m_pbmpOldScreen = NULL;
m_pbmpOldMask = NULL;
m_nCreditsBmpWidth = 0;
m_nCreditsBmpHeight = 0;
}
CCreditsThread::~CCreditsThread()
{
}
BOOL CCreditsThread::InitInstance()
{
InitThreadLocale();
BOOL bResult = CGDIThread::InitInstance();
// NOTE: Because this is a separate thread, we have to delete our GDI objects here (while
// the handle maps are still available.)
if(m_dcBk.m_hDC != NULL && m_pbmpOldBk != NULL)
{
m_dcBk.SelectObject(m_pbmpOldBk);
m_pbmpOldBk = NULL;
m_bmpBk.DeleteObject();
}
if(m_dcScreen.m_hDC != NULL && m_pbmpOldScreen != NULL)
{
m_dcScreen.SelectObject(m_pbmpOldScreen);
m_pbmpOldScreen = NULL;
m_bmpScreen.DeleteObject();
}
if(m_dcCredits.m_hDC != NULL && m_pbmpOldCredits != NULL)
{
m_dcCredits.SelectObject(m_pbmpOldCredits);
m_pbmpOldCredits = NULL;
m_bmpCredits.DeleteObject();
}
if(m_dcMask.m_hDC != NULL && m_pbmpOldMask != NULL)
{
m_dcMask.SelectObject(m_pbmpOldMask);
m_pbmpOldMask = NULL;
m_bmpMask.DeleteObject();
}
// clean up the fonts we created
for(int n = 0; n < m_arFonts.GetSize(); n++)
{
m_arFonts.GetAt(n)->DeleteObject();
delete m_arFonts.GetAt(n);
}
m_arFonts.RemoveAll();
return bResult;
}
// wait for vertical retrace
// makes scrolling smoother, especially at fast speeds
// NT does not like this at all
void waitvrt(void)
{
__asm {
mov dx,3dah
VRT:
in al,dx
test al,8
jnz VRT
NoVRT:
in al,dx
test al,8
jz NoVRT
}
}
void CCreditsThread::SingleStep()
{
// if this is our first time, initialize the credits
if(m_dcCredits.m_hDC == NULL)
{
CreateCredits();
}
// track scroll position
static int nScrollY = 0;
// timer variables
LARGE_INTEGER nFrequency;
LARGE_INTEGER nStart;
LARGE_INTEGER nEnd;
int nTimeInMilliseconds;
BOOL bTimerValid;
nStart.QuadPart = 0;
if(!QueryPerformanceFrequency(&nFrequency))
{
bTimerValid = FALSE;
}
else
{
bTimerValid = TRUE;
// get start time
QueryPerformanceCounter(&nStart);
}
CGDIThread::m_csGDILock.Lock();
{
PaintBk(&m_dcScreen);
m_dcScreen.BitBlt(0, 0, m_nCreditsBmpWidth, m_nCreditsBmpHeight, &m_dcCredits, 0, nScrollY, SRCINVERT);
m_dcScreen.BitBlt(0, 0, m_nCreditsBmpWidth, m_nCreditsBmpHeight, &m_dcMask, 0, nScrollY, SRCAND);
m_dcScreen.BitBlt(0, 0, m_nCreditsBmpWidth, m_nCreditsBmpHeight, &m_dcCredits, 0, nScrollY, SRCINVERT);
// wait for vertical retrace
if(m_bWaitVRT) waitvrt();
m_dc.BitBlt(m_rectScreen.left, m_rectScreen.top, m_rectScreen.Width(), m_rectScreen.Height(), &m_dcScreen, 0, 0, SRCCOPY);
GdiFlush();
}
CGDIThread::m_csGDILock.Unlock();
// continue scrolling
nScrollY += m_nScrollInc;
if(nScrollY >= m_nCreditsBmpHeight) nScrollY = 0; // scrolling up
if(nScrollY < 0) nScrollY = m_nCreditsBmpHeight; // scrolling down
// delay scrolling by the specified time
if(bTimerValid)
{
QueryPerformanceCounter(&nEnd);
nTimeInMilliseconds = (int)((nEnd.QuadPart - nStart.QuadPart) * 1000 / nFrequency.QuadPart);
if(nTimeInMilliseconds < m_nDelay)
{
Sleep(m_nDelay - nTimeInMilliseconds);
}
}
else
{
Sleep(m_nDelay);
}
}
void CCreditsThread::PaintBk(CDC* pDC)
{
//save background the first time
if (m_dcBk.m_hDC == NULL)
{
m_dcBk.CreateCompatibleDC(&m_dc);
m_bmpBk.CreateCompatibleBitmap(&m_dc, m_rectScreen.Width(), m_rectScreen.Height());
m_pbmpOldBk = m_dcBk.SelectObject(&m_bmpBk);
m_dcBk.BitBlt(0, 0, m_rectScreen.Width(), m_rectScreen.Height(), &m_dc, m_rectScreen.left, m_rectScreen.top, SRCCOPY);
}
pDC->BitBlt(0, 0, m_rectScreen.Width(), m_rectScreen.Height(), &m_dcBk, 0, 0, SRCCOPY);
}
void CCreditsThread::CreateCredits()
{
InitFonts();
InitColors();
InitText();
m_dc.SelectClipRgn(&m_rgnScreen);
m_dcScreen.CreateCompatibleDC(&m_dc);
m_bmpScreen.CreateCompatibleBitmap(&m_dc, m_rectScreen.Width(), m_rectScreen.Height());
m_pbmpOldScreen = m_dcScreen.SelectObject(&m_bmpScreen);
m_nCreditsBmpWidth = m_rectScreen.Width();
m_nCreditsBmpHeight = CalcCreditsHeight();
m_dcCredits.CreateCompatibleDC(&m_dc);
m_bmpCredits.CreateCompatibleBitmap(&m_dc, m_nCreditsBmpWidth, m_nCreditsBmpHeight);
m_pbmpOldCredits = m_dcCredits.SelectObject(&m_bmpCredits);
m_dcCredits.FillSolidRect(0, 0, m_nCreditsBmpWidth, m_nCreditsBmpHeight, MASK_RGB);
CFont* pOldFont;
pOldFont = m_dcCredits.SelectObject(m_arFonts.GetAt(0));
m_dcCredits.SetBkMode(TRANSPARENT);
int y = 0;
int nFont;
int nColor;
int nLastFont = -1;
int nLastColor = -1;
int nTextHeight = m_dcCredits.GetTextExtent(_T("Wy")).cy;
for(int n = 0; n < m_arCredits.GetSize(); n++)
{
CString sType = m_arCredits.GetAt(n).Left(1);
if(sType == 'B')
{
// it's a bitmap
CBitmap bmp;
if(! bmp.LoadBitmap(m_arCredits.GetAt(n).Mid(2)))
{
CString str;
str.Format(_T("Could not find bitmap resource \"%s\". Be sure to assign the bitmap a QUOTED resource name"), m_arCredits.GetAt(n).Mid(2));
AfxMessageBox(str);
return;
}
BITMAP bmInfo;
bmp.GetBitmap(&bmInfo);
CDC dc;
dc.CreateCompatibleDC(&m_dcCredits);
CBitmap* pOldBmp = dc.SelectObject(&bmp);
// draw the bitmap
m_dcCredits.BitBlt((m_rectScreen.Width() - bmInfo.bmWidth) / 2, y, bmInfo.bmWidth, bmInfo.bmHeight, &dc, 0, 0, SRCCOPY);
dc.SelectObject(pOldBmp);
bmp.DeleteObject();
y += bmInfo.bmHeight;
}
else if(sType == 'S')
{
// it's a vertical space
y += _ttoi(m_arCredits.GetAt(n).Mid(2));
}
else
{
// it's a text string
nFont = _ttoi(m_arCredits.GetAt(n).Left(2));
nColor = _ttoi(m_arCredits.GetAt(n).Mid(3,2));
if(nFont != nLastFont)
{
m_dcCredits.SelectObject(m_arFonts.GetAt(nFont));
nTextHeight = m_arFontHeights.GetAt(nFont);
}
if(nColor != nLastColor)
{
m_dcCredits.SetTextColor(m_arColors.GetAt(nColor));
}
CRect rect(0, y, m_rectScreen.Width(), y + nTextHeight);
m_dcCredits.DrawText(m_arCredits.GetAt(n).Mid(6), &rect, DT_CENTER);
y += nTextHeight;
}
}
m_dcCredits.SetBkColor(MASK_RGB);
m_dcCredits.SelectObject(pOldFont);
// create the mask bitmap
m_dcMask.CreateCompatibleDC(&m_dcScreen);
m_bmpMask.CreateBitmap(m_nCreditsBmpWidth, m_nCreditsBmpHeight, 1, 1, NULL);
// select the mask bitmap into the appropriate dc
m_pbmpOldMask = m_dcMask.SelectObject(&m_bmpMask);
// build mask based on transparent color
m_dcMask.BitBlt(0, 0, m_nCreditsBmpWidth, m_nCreditsBmpHeight, &m_dcCredits, 0, 0, SRCCOPY);
}
void CCreditsThread::InitFonts()
{
// create each font we'll need and add it to the fonts array
CDC dcMem;
dcMem.CreateCompatibleDC(&m_dc);
CFont* pOldFont;
int nTextHeight;
LOGFONT lf;
// font 0
// SMALL ARIAL
CFont* font0 = new CFont;
memset((void*)&lf, 0, sizeof(lf));
lf.lfHeight = 12;
lf.lfWeight = 500;
lf.lfQuality = NONANTIALIASED_QUALITY;
_tcscpy(lf.lfFaceName, _T("Arial"));
font0->CreateFontIndirect(&lf);
m_arFonts.Add(font0);
pOldFont = dcMem.SelectObject(font0);
nTextHeight = dcMem.GetTextExtent(_T("Wy")).cy;
m_arFontHeights.Add(nTextHeight);
// font 1
// MEDIUM BOLD ARIAL
CFont* font1 = new CFont;
memset((void*)&lf, 0, sizeof(lf));
lf.lfHeight = 14;
lf.lfWeight = 600;
lf.lfQuality = NONANTIALIASED_QUALITY;
_tcscpy(lf.lfFaceName, _T("Arial"));
font1->CreateFontIndirect(&lf);
m_arFonts.Add(font1);
dcMem.SelectObject(font1);
nTextHeight = dcMem.GetTextExtent(_T("Wy")).cy;
m_arFontHeights.Add(nTextHeight);
// font 2
// LARGE ITALIC HEAVY BOLD TIMES ROMAN
CFont* font2 = new CFont;
memset((void*)&lf, 0, sizeof(lf));
lf.lfHeight = 16;
lf.lfWeight = 700;
//lf.lfItalic = TRUE;
lf.lfQuality = afxIsWin95() ? NONANTIALIASED_QUALITY : ANTIALIASED_QUALITY;
_tcscpy(lf.lfFaceName, _T("Arial"));
font2->CreateFontIndirect(&lf);
m_arFonts.Add(font2);
dcMem.SelectObject(font2);
nTextHeight = dcMem.GetTextExtent(_T("Wy")).cy;
m_arFontHeights.Add(nTextHeight);
// font 3
CFont* font3 = new CFont;
memset((void*)&lf, 0, sizeof(lf));
lf.lfHeight = 25;
lf.lfWeight = 900;
lf.lfQuality = afxIsWin95() ? NONANTIALIASED_QUALITY : ANTIALIASED_QUALITY;
_tcscpy(lf.lfFaceName, _T("Arial"));
font3->CreateFontIndirect(&lf);
m_arFonts.Add(font3);
dcMem.SelectObject(font3);
nTextHeight = dcMem.GetTextExtent(_T("Wy")).cy;
m_arFontHeights.Add(nTextHeight);
dcMem.SelectObject(pOldFont);
}
void CCreditsThread::InitColors()
{
// define each color we'll be using
m_arColors.Add(PALETTERGB(0, 0, 0)); // 0 = BLACK
m_arColors.Add(PALETTERGB(90, 90, 90)); // 1 = very dark gray
m_arColors.Add(PALETTERGB(128, 128, 128)); // 2 = DARK GRAY
m_arColors.Add(PALETTERGB(192, 192, 192)); // 3 = LIGHT GRAY
m_arColors.Add(PALETTERGB(200, 50, 50)); // 4 = very light gray
m_arColors.Add(PALETTERGB(255, 255, 128)); // 5 white
m_arColors.Add(PALETTERGB(0, 0, 128)); // 6 dark blue
m_arColors.Add(PALETTERGB(128, 128, 255)); // 7 light blue
m_arColors.Add(PALETTERGB(0, 106, 0)); // 8 dark green
}
void CCreditsThread::InitText()
{
// 1st pair of digits identifies the font to use
// 2nd pair of digits identifies the color to use
// B = Bitmap
// S = Space (moves down the specified number of pixels)
CString sTmp;
/*
You may NOT modify this copyright message. You may add your name, if you
changed or improved this code, but you mot not delete any part of this message,
make it invisible etc.
*/
// start at the bottom of the screen
sTmp.Format(_T("S:%d"), m_rectScreen.Height());
m_arCredits.Add(sTmp);
m_arCredits.Add(_T("03:00:eMule"));
sTmp.Format(_T("02:01:Version %s"),theApp.m_strCurVersionLong);
m_arCredits.Add(sTmp);
m_arCredits.Add(_T("01:06:Copyright (C) 2002-2015 Merkur"));
m_arCredits.Add(_T("S:50"));
m_arCredits.Add(_T("02:04:Developers"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Ornis"));
m_arCredits.Add(_T("S:50"));
m_arCredits.Add(_T("02:04:Tester"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Monk"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Daan"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Elandal"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Frozen_North"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:kayfam"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Khandurian"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Masta2002"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:mrLabr"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Nesi-San"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:SeveredCross"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Skynetman"));
m_arCredits.Add(_T("S:50"));
m_arCredits.Add(_T("02:04:Retired Members"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Merkur (the Founder)"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:tecxx"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Pach2"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Juanjo"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Barry"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Dirus"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Unknown1"));
m_arCredits.Add(_T("S:50"));
m_arCredits.Add(_T("02:04:Thanks to these programmers"));
m_arCredits.Add(_T("02:04:for publishing useful codeparts"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Paolo Messina (ResizableDialog class)"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:6:PJ Naughter (HttpDownload Dialog)"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Jim Connor (Scrolling Credits)"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Yury Goltsman (extended Progressbar)"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Magomed G. Abdurakhmanov (Hyperlink ctrl)"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Arthur Westerman (Titled menu)"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Tim Kosse (AsyncSocket-Proxysupport)"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:Keith Rule (Memory DC)"));
m_arCredits.Add(_T("S:50"));
m_arCredits.Add(_T("02:07:And thanks to the following"));
m_arCredits.Add(_T("02:07:people for translating eMule"));
m_arCredits.Add(_T("02:07:into different languages:"));
m_arCredits.Add(_T("S:20"));
m_arCredits.Add(_T("01:06:Arabic: Dody"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Albanian: Besmir"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Basque: TXiKi"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Breton: KAD-Korvigelloù an Drouizig"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Bulgarian: DapKo, Dumper"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Catalan: LeChuck"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Chinese simplyfied: Tim Chen, Qilu T."));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Chinese Traditional: CML, Donlong, Ryan"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Czech: Patejl"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Danish: Tiede, Cirrus, Itchy"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Estonian: Symbio"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Dutch: Mr.Bean"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Finnish: Nikerabbit"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:French: Motte, Emzc, Lalrobin"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Galician: Juan, Emilio R."));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Greek: Michael Papadakis"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Italian: Trevi, FrankyFive"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Japanese: DukeDog, Shinro T."));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Hebrew: Avi-3k"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Hungarian: r0ll3r"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Korean: pooz"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Latvian: Zivs"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Lithuanian: Daan"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Maltese: Reuben"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Norwegian (Bokmal): Iznogood"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Norwegian (Nynorsk): Hallvor"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Polish: Tomasz \"TMouse\" Broniarek"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Portugese: Filipe, Luís Claro"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Portugese Brasilian: DarthMaul,Brasco,Ducho"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Romanian: Dragos"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Russian: T-Mac, BRMAIL"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Slowenian: Rok Kralj"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Spanish Castellano: Azuredraco, Javier L., |_Hell_|"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Swedish: Andre"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Turkish: Burak Y."));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Ukrainian: Kex"));
m_arCredits.Add(_T("S:05"));
m_arCredits.Add(_T("01:06:Vietnamese: Paul Tran HQ Loc"));
m_arCredits.Add(_T("S:50"));
m_arCredits.Add(_T("02:04:Part of eMule is based on Kademlia:"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("02:04:Peer-to-peer routing based on the XOR metric."));
m_arCredits.Add(_T("S:10"));
m_arCredits.Add(_T("01:06:Copyright (C) 2002 Petar Maymounkov"));
m_arCredits.Add(_T("S:5"));
m_arCredits.Add(_T("01:06:http://kademlia.scs.cs.nyu.edu"));
// pause before repeating
m_arCredits.Add(_T("S:100"));
}
int CCreditsThread::CalcCreditsHeight()
{
int nHeight = 0;
for(int n = 0; n < m_arCredits.GetSize(); n++)
{
CString sType = m_arCredits.GetAt(n).Left(1);
if(sType == 'B')
{
// it's a bitmap
CBitmap bmp;
if (! bmp.LoadBitmap(m_arCredits.GetAt(n).Mid(2)))
{
CString str;
str.Format(_T("Could not find bitmap resource \"%s\". Be sure to assign the bitmap a QUOTED resource name"), m_arCredits.GetAt(n).Mid(2));
AfxMessageBox(str);
return -1;
}
BITMAP bmInfo;
bmp.GetBitmap(&bmInfo);
nHeight += bmInfo.bmHeight;
}
else if(sType == 'S')
{
// it's a vertical space
nHeight += _ttoi(m_arCredits.GetAt(n).Mid(2));
}
else
{
// it's a text string
int nFont = _ttoi(m_arCredits.GetAt(n).Left(2));
nHeight += m_arFontHeights.GetAt(nFont);
}
}
return nHeight;
}