OSDN Git Service

#39822 adjusted drum RD pad position/size
[dtxmania/dtxmania.git] / DTXMania / コード / 全体 / Coordinates.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Runtime.Serialization;
6 using System.Xml;
7 using DTXMania;
8
9 namespace DTXMania.Coordinates
10 {
11         [DataContract]
12         public class CX
13         {
14                 public CX(int x)
15                 {
16                         X = x;
17                 }
18                 [DataMember]
19                 public int X;
20         }
21
22         [DataContract]
23         public class CY
24         {
25                 public CY(int y)
26                 {
27                         Y = y;
28                 }
29                 [DataMember]
30                 public int Y;
31         }
32
33         [DataContract]
34         public class CXY : CX
35         {
36                 public CXY(int x, int y)
37                         : base(x)
38                 {
39                         Y = y;
40                 }
41
42                 [DataMember]
43                 public int Y;
44         }
45
46         [DataContract]
47         public class CXW : CX
48         {
49                 public CXW(int x, int w)
50                         : base(x)
51                 {
52                         W = w;
53                 }
54                 [DataMember]
55                 public int W;
56         }
57
58         [DataContract]
59         public class CXYW : CXY
60         {
61                 public CXYW(int x, int y, int w)
62                         : base(x, y)
63                 {
64                         W = w;
65                 }
66                 [DataMember]
67                 public int W;
68         }
69
70         [DataContract]
71         public class CRange
72         {
73                 public CRange(int min, int max)
74                 {
75                         Min = min;
76                         Max = max;
77                 }
78                 [DataMember]
79                 public int Min;
80                 [DataMember]
81                 public int Max;
82         }
83
84         [DataContract]
85         public class CW
86         {
87                 public CW(int w)
88                 {
89                         W = w;
90                 }
91                 [DataMember]
92                 public int W;
93         }
94
95         [DataContract]
96         public class CWH : CW
97         {
98                 public CWH(int w, int h)
99                         : base(w)
100                 {
101                         H = h;
102                 }
103
104                 [DataMember]
105                 public int H;
106         }
107
108         [DataContract]
109         public class CRect : CXY
110         {
111                 public System.Drawing.Rectangle rc;
112                 public System.Drawing.Rectangle rcTmp;
113
114                 public CRect(int x, int y, int w, int h)
115                         : base(x, y)
116                 {
117                         W = w;
118                         H = h;
119                         rc = new System.Drawing.Rectangle(X, Y, W, H);
120                         rcTmp = new System.Drawing.Rectangle(X, Y, W, H);
121                 }
122
123                 public static implicit operator System.Drawing.Rectangle(CRect x)
124                 {
125                         return x.rcTmp;
126                 }
127
128                 public System.Drawing.Rectangle ApplyCounterY(int counter, int overlap)
129                 {
130                         rcTmp.Y = rc.Y + (rc.Height - overlap) * counter;
131                         return rcTmp;
132                 }
133                 public System.Drawing.Rectangle ApplyCounterX(int counter, int overlap)
134                 {
135                         rcTmp.X = rc.X + (rc.Width - overlap) * counter;
136                         return rcTmp;
137                 }
138                 public System.Drawing.Rectangle ApplyCounterXY(int counterX, int counterY, int overlapX, int overlapY)
139                 {
140                         rcTmp.X = rc.X + (rc.Width - overlapX) * counterX;
141                         rcTmp.Y = rc.Y + (rc.Height - overlapY) * counterY;
142                         return rcTmp;
143                 }
144                 [DataMember]
145                 public int W;
146                 [DataMember]
147                 public int H;
148
149                 // Deserialize後、WとHは初期化されるが、rc, rcTmpが初期化されない問題への対処。
150                 [OnDeserialized()]
151                 private void OnDeserializedMethod(StreamingContext context)
152                 {
153                         rc = new System.Drawing.Rectangle( X, Y, W, H );
154                         rcTmp = new System.Drawing.Rectangle( X, Y, W, H );
155                 }
156         }
157
158         public class CCoordinates
159         {
160                 public CXY Gauge;
161                 public int GaugeMax;
162                 public STDGBSValue<CWH> Graph;
163                 public CRange Danger;
164                 public STDGBSValue<CW> Instrument;
165                 public STDGBSValue<CY> Score;
166                 public CW StatusPanel;
167                 public CXY Panel;
168                 public CWH Movie;
169                 public STDGBSValue<CY> LaneFlash;
170
171                 public CY DrPad;
172                 public STPadValue<CY> DrPadOffset;
173
174                 public CRect ImgGtChipOpen;
175                 public int ImgGtCountOpenChip;
176                 public CRect ImgGtRGBButton;
177                 public int ImgGtCountRGBChip;
178                 public int ImgGtCountWailingChip;
179                 public CRect ImgGtWailingBonus;
180                 public CRect ImgGtLaneFlash;
181                 public CRect ImgGtWailingChip;
182                 public CRect ImgGtWailingFrame;
183                 public CRect ImgGtButtonR;
184                 public CRect ImgGtButtonG;
185                 public CRect ImgGtButtonB;
186                 public CRect ImgGtPressingButtonR;
187                 public CRect ImgGtPressingButtonG;
188                 public CRect ImgGtPressingButtonB;
189                 public CRect ImgDrLaneFlash;
190
191                 public STPadValue<CRect> ImgDrChip;
192                 public CRect ImgDrChipCYDeco;
193                 public CRect ImgDrChipHHODeco;
194                 public int ImgDrCountChip;
195
196                 public STPadValue<CRect> ImgDrPad;
197                 public CRect ImgJudgeLine;
198                 public CRect ImgBarLine;
199                 public CRect ImgBeatLine;
200                 public CRect ImgComboCombo;
201                 public CRect ImgComboOneDigit;
202                 public CRect ImgGaugeOrange;
203                 public CRect ImgGaugeNormal;
204                 public CRect ImgGaugeLight;
205                 public CRect ImgGaugeTopLight;
206                 public CRect ImgGaugeStar;
207                 public CRect ImgScoreOneDigit;
208                 public CRect ImgSpeedPanel;
209                 public CRect ImgConsoleFont;
210                 public CRect ImgJudgeString;
211                 public CRect ImgDanger;
212
213                 public CWH ImgOptionPanel;
214
215                 public STDGBSValue<CY>[] OffsetGuitarBassSwap;
216                 public STDGBSValue<CXY> PointFullCombo;
217
218                 public STDGBSValue<CXY> OptionPanelSelect;
219
220                 /// <summary>
221                 /// シリアル化対象メンバはここで初期値を与えます。XMLが存在しない場合一度これらの値が書きだされ、
222                 /// もう一度デシリアライズされます。XMLが存在する場合、これらの値は全て無効になります。
223                 /// </summary>
224                 public CCoordinates()
225                 {
226                         ImgJudgeLine = new CRect(0, 0, 64, 16);
227
228                         ImgGtChipOpen = new CRect(72 * 3, 0, 72 * 3, 14);
229                         ImgGtRGBButton = new CRect(0, 0, 72, 14);
230                         ImgGtWailingChip = new CRect(0, 590, 70, 120);
231                         ImgGtCountWailingChip = 5;
232                         ImgGtCountRGBChip = 48;
233                         ImgGtCountOpenChip = 48;
234
235                         ImgDanger = new CRect(0, 0, 64, 256);
236
237                         ImgGtButtonR = new CRect(0, 0, 72, 72);
238                         ImgGtButtonG = new CRect(72, 0, 72, 72);
239                         ImgGtButtonB = new CRect(144, 0, 72, 72);
240                         ImgGtPressingButtonR = new CRect(0, 72, 72, 72);
241                         ImgGtPressingButtonG = new CRect(72, 72, 72, 72);
242                         ImgGtPressingButtonB = new CRect(144, 72, 72, 72);
243                         ImgGtWailingBonus = new CRect(0, 0, 78, 549);
244
245                         ImgComboCombo = new CRect(100, 140, 110, 30);
246                         ImgComboOneDigit = new CRect(0, 0, 50, 70);
247
248                         ImgGtWailingFrame = new CRect(0, 0, 70, 120);
249                         ImgSpeedPanel = new CRect(0, 0, 45, 164);
250
251                         ImgConsoleFont = new CRect(0, 0, 16, 32);
252                         ImgJudgeString = new CRect(0, 0, 256, 36);
253
254                         ImgDrCountChip = 48;
255                         ImgDrChip = new STPadValue<CRect>();
256                         ImgDrChip.LC = new CRect(99 + 72 * 5, 16, 85, 18);
257                         ImgDrChip.BD = new CRect(0, 20, 99, 22);
258                         ImgDrChip.HH = new CRect(99, 16, 72, 18);
259                         ImgDrChip.SD = new CRect(99 + 72, 16, 72, 18);
260                         ImgDrChip.HT = new CRect(99 + 72 * 2, 16, 72, 18);
261                         ImgDrChip.LT = new CRect(99 + 72 * 3, 16, 72, 18);
262                         ImgDrChip.FT = new CRect(99 + 72 * 4, 16, 72, 18);
263                         ImgDrChip.CY = new CRect(99 + 72 * 5, 16, 85, 18);
264                         ImgDrChipCYDeco = new CRect(99 + 72 * 5, 786, 85, 64);
265                         ImgDrChip.RD = new CRect(99 + 72 * 5 + 85, 16, 58, 18);
266                         ImgDrChip.HHO = new CRect(99 + 72 * 5 + 85, 16, 58, 18);
267                         ImgDrChipHHODeco = new CRect(99 + 72 * 5 + 85, 791, 58, 30);
268
269                         ImgDrPad = new STPadValue<CRect>();
270                         ImgDrPad.LC = new CRect(0, 0, 170, 130);
271                         ImgDrPad.HH = new CRect(170, 0, 170, 130);
272                         ImgDrPad.SD = new CRect(340, 0, 170, 130);
273                         ImgDrPad.BD = new CRect(0, 130, 170, 130);
274                         ImgDrPad.HT = new CRect(170, 130, 170, 130);
275                         ImgDrPad.LT = new CRect(340, 130, 170, 130);
276                         ImgDrPad.FT = new CRect(0, 260, 170, 130);
277                         ImgDrPad.CY = new CRect(170, 260, 170, 130);
278                         ImgDrPad.RD = new CRect(340, 260, 170, 130);
279
280                         ImgBarLine = new CRect(0, 982, 480, 3);
281                         ImgBeatLine = new CRect(0, 985, 480, 2);
282
283                         ImgGaugeOrange = new CRect(48, 0, 48, 61);
284                         ImgGaugeNormal = new CRect(0, 0, 48, 61);
285                         ImgGaugeLight = new CRect(0, 0, 48, 576);
286                         ImgGaugeTopLight = new CRect(144, 0, 48, 36);
287                         ImgGaugeStar = new CRect(0, 72, 96, 72);
288
289                         ImgScoreOneDigit = new CRect(0, 0, 30, 38);
290
291                         // w無効
292                         ImgGtLaneFlash = new CRect(0, 0, -1, 512);
293                         // w無効
294                         ImgDrLaneFlash = new CRect(0, 0, -1, 768);
295
296                         ImgOptionPanel = new CWH(72, 27);
297
298                         // #24063 2011.1.27 yyagi
299                         OffsetGuitarBassSwap = new STDGBSValue<CY>[2];
300                         OffsetGuitarBassSwap[0] = new STDGBSValue<CY>();
301                         OffsetGuitarBassSwap[0].Drums = new CY(0);
302                         OffsetGuitarBassSwap[0].Guitar = new CY((int)(21 * Scale.Y));
303                         OffsetGuitarBassSwap[0].Bass = new CY((int)(42 * Scale.Y));
304                         OffsetGuitarBassSwap[1].Drums = new CY(0);
305                         OffsetGuitarBassSwap[1].Guitar = new CY((int)(42 * Scale.Y));
306                         OffsetGuitarBassSwap[1].Bass = new CY((int)(21 * Scale.Y));
307
308                         PointFullCombo = new STDGBSValue<CXY>();
309                         PointFullCombo.Drums = new CXY((int)(0x80 * Scale.X), (int)(0xed * Scale.Y));
310                         PointFullCombo.Guitar = new CXY((int)(0xdf * Scale.X), (int)(0xed * Scale.Y));
311                         PointFullCombo.Bass = new CXY((int)(0x141 * Scale.X), (int)(0xed * Scale.Y));
312
313                         DrPadOffset = new STPadValue<CY>();
314
315                         DrPadOffset.LC = new CY(0); // <- 非対象化
316                         DrPadOffset.HH = new CY(10);
317                         DrPadOffset.HHO = new CY(10);
318                         DrPadOffset.SD = new CY(22);
319                         DrPadOffset.BD = new CY(30);
320                         DrPadOffset.HT = new CY(0);
321                         DrPadOffset.LT = new CY(15);
322                         DrPadOffset.FT = new CY(30);
323                         DrPadOffset.CY = new CY(15);
324                         DrPadOffset.RD = new CY(50);
325                         DrPad = new CY(930);
326
327                         Instrument = new STDGBSValue<CW>();
328                         Instrument.Drums = new CW(72 * 5 + 85 * 2 + 99);
329                         Instrument.Guitar = new CW(72 * 4);
330                         Instrument.Bass = new CW(72 * 4);
331
332                         Gauge = new CXY(0, 1080); // <- 左固定
333                         GaugeMax = 1080;
334                         Danger = new CRange(0, SampleFramework.GameWindowSize.Width - 64);
335                         StatusPanel = new CW(45);
336                         Score = new STDGBSValue<CY>();
337                         Score.Drums = new CY(30);
338                         Score.Guitar = new CY(30);
339                         Score.Bass = new CY(30);
340
341                         Panel = new CXY(SampleFramework.GameWindowSize.Width, 0);
342                         Movie = new CWH(556, 710);
343
344                         LaneFlash = new STDGBSValue<CY>();
345                         LaneFlash.Drums = new CY(SampleFramework.GameWindowSize.Height - 768);
346                         LaneFlash.Guitar = new CY(0);
347                         LaneFlash.Bass = new CY(0);
348
349                         OptionPanelSelect = new STDGBSValue<CXY>();
350                         OptionPanelSelect.Drums = new CXY(1107, 23);
351                         OptionPanelSelect.Guitar = new CXY(1107, 50);
352                         OptionPanelSelect.Bass = new CXY(1107, 77);
353                         
354                         Graph.Drums = new CWH(62, 1080);
355                         Graph.Guitar = new CWH(62, 1080);
356                         Graph.Bass = new CWH(62, 1080);
357
358                 }
359         }
360 }