Develop and Download Open Source Software

Browse Subversion Repository

Contents of /Plugin/Flactale.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations) (download) (as text)
Wed Feb 10 18:21:00 2010 UTC (14 years, 3 months ago) by sho1get
File MIME type: text/x-c++src
File size: 1438 byte(s)


1 #include "StdAfx.h"
2 #include "Flactale.h"
3
4 //////////////////////////////////////////////////////////////////////////
5
6 CFlactale::CFlactale()
7 {
8 }
9
10 CFlactale::~CFlactale()
11 {
12 }
13
14 void CFlactale::Initialize(FLACTALE Params)
15 {
16 SetParameters(Params);
17 DefPalette();
18 PrintLevel();
19 }
20
21 void CFlactale::DefPalette()
22 {
23 m_nLvlMax = 4095;
24 m_nPalMax = 4096;
25 m_nLvlPal.SetSize(m_nLvlMax + 2);
26 m_Color.SetSize(m_nPalMax + 2);
27
28 m_Color[0] = RGB(0, 0, 0);
29 m_Color[4096] = RGB(160, 160, 160);
30
31 int i = 1;
32 for (int r = 1; r <= 16; r++)
33 {
34 for (int g = 1; g <= 16; g++)
35 {
36 for (int b = 1; b <= 16; b++)
37 {
38 m_Color[i++] = RGB(r * 16 - 1, g * 16 - 1, b * 16 - 1);
39 }
40 }
41 }
42
43 for (int i = 0; i <= m_nLvlMax + 1; i++)
44 {
45 m_nLvlPal[i] = static_cast<int>(m_Color[i]);
46 }
47 }
48
49 void CFlactale::PrintLevel()
50 {
51 int st, ed, pal0, pal1;
52 int nCountMax = m_Flactale.nCountMax;
53
54 m_nPal.SetSize(nCountMax + 1);
55
56 for (int i = 1; i <= m_nLvlMax; i++)
57 {
58 st = static_cast<int>(nCountMax * (i - 1) / m_nLvlMax);
59 ed = static_cast<int>(nCountMax * i / m_nLvlMax) - 1;
60
61 if (st > ed)
62 {
63 continue;
64 }
65
66 pal0 = m_nLvlPal[i];
67 pal1 = m_nLvlPal[m_nLvlMax + 1];
68
69 for (int j = st; j <= ed; j++)
70 {
71 m_nPal[j] = (j % 2 == 0) ? pal0 : pal1;
72 }
73
74 m_nPal[nCountMax] = m_nLvlPal[0];
75 }
76 }
77
78 //////////////////////////////////////////////////////////////////////////

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26