OSDN Git Service

7c668ba7a4777525f03f05c7f361b366657f83f1
[dtxmania/dtxmania.git] / DTXMania / コード / ステージ / 07.演奏 / CStage演奏画面共通_描画.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6 using SharpDX;
7 using FDK;
8 using System.Drawing;
9 using System.IO;
10 using System.Diagnostics;
11 using System.Drawing.Imaging;
12
13 using Rectangle = System.Drawing.Rectangle;
14
15 namespace DTXMania
16 {
17         internal partial class CStage演奏画面共通 : CStage
18         {
19                 void SudHidInvChip( EPart inst, ref CChip pChip )
20                 {
21                         if (CDTXMania.Instance.ConfigIni.eSudHidInv[inst] == ESudHidInv.SemiInv ||
22                                 CDTXMania.Instance.ConfigIni.eSudHidInv[inst] == ESudHidInv.FullInv)
23                         {
24                                 cInvisibleChip.SetInvisibleStatus(ref pChip);
25                         }
26                         else
27                         {
28                                 if (CDTXMania.Instance.ConfigIni.eSudHidInv[inst] == ESudHidInv.Sudden ||
29                                         CDTXMania.Instance.ConfigIni.eSudHidInv[inst] == ESudHidInv.SudHid)
30                                 {
31                                         if (pChip.nバーからの距離dot[inst] < CDTXMania.Instance.ConfigIni.nSuddenFrom[inst])
32                                         {
33                                                 pChip.b可視 = true;
34                                                 pChip.n透明度 = 0xff;
35                                         }
36                                         else if (pChip.nバーからの距離dot[inst] < CDTXMania.Instance.ConfigIni.nSuddenFrom[inst] + 100)
37                                         {
38                                                 pChip.b可視 = true;
39                                                 pChip.n透明度 = 0xff - (int)((pChip.nバーからの距離dot[inst] -
40                                                         CDTXMania.Instance.ConfigIni.nSuddenFrom[inst]) * 255.0 / 50.0);
41                                         }
42                                         else
43                                         {
44                                                 pChip.b可視 = false;
45                                                 pChip.n透明度 = 0;
46                                         }
47                                 }
48                                 if (CDTXMania.Instance.ConfigIni.eSudHidInv[inst] == ESudHidInv.Hidden ||
49                                         CDTXMania.Instance.ConfigIni.eSudHidInv[inst] == ESudHidInv.SudHid)
50                                 {
51                                         if (pChip.nバーからの距離dot[inst] < CDTXMania.Instance.ConfigIni.nHiddenFrom[inst])
52                                         {
53                                                 pChip.b可視 = false;
54                                         }
55                                         else if (pChip.nバーからの距離dot[inst] < CDTXMania.Instance.ConfigIni.nHiddenFrom[inst] + 100)
56                                         {
57                                                 pChip.b可視 = true;
58                                                 pChip.n透明度 = (int)((pChip.nバーからの距離dot[inst] -
59                                                         CDTXMania.Instance.ConfigIni.nHiddenFrom[inst]) * 255.0 / 50.0);
60                                         }
61                                 }
62                         }
63                 }
64
65
66                 /// <summary>
67                 /// ギター・ベースのチップ表示
68                 /// </summary>
69                 /// <param name="configIni"></param>
70                 /// <param name="dTX"></param>
71                 /// <param name="pChip">描画するチップ</param>
72                 /// <param name="inst">楽器種別</param>
73                 protected void t進行描画_チップ_ギターベース(ref CChip pChip, EPart inst)
74                 {
75                         if (CDTXMania.Instance.ConfigIni.bGuitar有効)
76                         {
77                                 SudHidInvChip(inst, ref pChip);
78
79                                 bool bChipHasR = pChip.bGuitarBass_R;
80                                 bool bChipHasG = pChip.bGuitarBass_G;
81                                 bool bChipHasB = pChip.bGuitarBass_B;
82                                 bool bChipHasW = pChip.bGuitarBass_Wailing;
83                                 bool bChipIsO = pChip.bGuitarBass_Open;
84
85                                 #region [ chip描画 ]
86                                 if (!pChip.bHit && pChip.b可視)
87                                 {
88                                         if (this.txチップGB != null)
89                                         {
90                                                 this.txチップGB.n透明度 = pChip.n透明度;
91                                         }
92
93                                         int barY = C演奏判定ライン座標共通.n判定ラインY座標(inst);
94                                         int y = CDTXMania.Instance.ConfigIni.bReverse[inst] ?
95                                                 barY - pChip.nバーからの距離dot[inst] :
96                                                 barY + pChip.nバーからの距離dot[inst];
97
98                                         int showRangeY0 = 0;
99                                         int showRangeY1 = SampleFramework.GameWindowSize.Height;
100
101                                         if ((showRangeY0 < y) && (y < showRangeY1))
102                                         {
103                                                 if (this.txチップGB != null)
104                                                 {
105                                                         int nアニメカウンタ現在の値 = this.ctチップ模様アニメ[inst].n現在の値;
106                                                         #region [ OPENチップの描画 ]
107                                                         if (pChip[(inst == EPart.Guitar) ? EChannel.Guitar_Open : EChannel.Bass_Open])
108                                                         {
109                                                                 int xo = CDTXMania.Instance.ConfigIni.cdInstX[inst][CDTXMania.Instance.ConfigIni.eActiveInst];
110                                                                 this.txチップGB.t2D描画(CDTXMania.Instance.Device, xo,
111                                                                         y - CDTXMania.Instance.Coordinates.ImgGtChipOpen.H / 2,
112                                                                         CDTXMania.Instance.Coordinates.ImgGtChipOpen.ApplyCounterY(nアニメカウンタ現在の値 % CDTXMania.Instance.Coordinates.ImgGtCountOpenChip, 2));
113                                                         }
114                                                         Rectangle rect = CDTXMania.Instance.Coordinates.ImgGtRGBButton.ApplyCounterY(nアニメカウンタ現在の値 % CDTXMania.Instance.Coordinates.ImgGtCountRGBChip, 2);
115                                                         #endregion
116                                                         #region [ RGBチップ描画 ]
117                                                         if (bChipHasR)
118                                                         {
119                                                                 this.txチップGB.t2D描画(CDTXMania.Instance.Device,
120                                                                         CDTXMania.Instance.ConfigIni.GetLaneX(inst == EPart.Guitar ? ELane.GtR : ELane.BsR) +
121                                                                         (CDTXMania.Instance.ConfigIni.GetLaneW(inst == EPart.Guitar ? ELane.GtR : ELane.BsR) - CDTXMania.Instance.Coordinates.ImgGtRGBButton.W) / 2,
122                                                                         y - rect.Height / 2, rect);
123                                                         }
124                                                         rect.X += rect.Width;
125                                                         if (bChipHasG)
126                                                         {
127                                                                 this.txチップGB.t2D描画(CDTXMania.Instance.Device,
128                                                                         CDTXMania.Instance.ConfigIni.GetLaneX(inst == EPart.Guitar ? ELane.GtG : ELane.BsG) +
129                                                                         (CDTXMania.Instance.ConfigIni.GetLaneW(inst == EPart.Guitar ? ELane.GtG : ELane.BsG) - CDTXMania.Instance.Coordinates.ImgGtRGBButton.W) / 2,
130                                                                         y - rect.Height / 2, rect);
131                                                         }
132                                                         rect.X += rect.Width;
133                                                         if (bChipHasB)
134                                                         {
135                                                                 this.txチップGB.t2D描画(CDTXMania.Instance.Device,
136                                                                         CDTXMania.Instance.ConfigIni.GetLaneX(inst == EPart.Guitar ? ELane.GtB : ELane.BsB) +
137                                                                         (CDTXMania.Instance.ConfigIni.GetLaneW(inst == EPart.Guitar ? ELane.GtB : ELane.BsB) - CDTXMania.Instance.Coordinates.ImgGtRGBButton.W) / 2,
138                                                                         y - rect.Height / 2, rect);
139                                                         }
140                                                         #endregion
141                                                 }
142                                         }
143                                 }
144                                 #endregion
145
146                                 // #35411 2015.08.20 chnmr0 modified
147                                 // 従来のAUTO処理に加えてプレーヤーゴーストの再生機能を追加
148                                 bool autoPlayCondition = (!pChip.bHit) && (pChip.nバーからの距離dot[inst] < 0);
149                                 if (autoPlayCondition)
150                                 {
151                                         cInvisibleChip.StartSemiInvisible(inst);
152                                 }
153
154                                 bool autoPick = (inst == EPart.Guitar) ?
155                                                                                 CDTXMania.Instance.ConfigIni.bAutoPlay.GtPick :
156                                                                                 CDTXMania.Instance.ConfigIni.bAutoPlay.BsPick;
157
158                                 autoPlayCondition = !pChip.bHit && autoPick;
159                                 long ghostLag = 0;
160                                 bool bUsePerfectGhost = true;
161
162                                 if ((pChip.e楽器パート == EPart.Guitar || pChip.e楽器パート == EPart.Bass) &&
163                                                 CDTXMania.Instance.ConfigIni.eAutoGhost[pChip.e楽器パート] != EAutoGhostData.Perfect &&
164                                                 CDTXMania.Instance.DTX.listAutoGhostLag[pChip.e楽器パート] != null &&
165                                                 0 <= pChip.n楽器パートでの出現順 &&
166                                                 pChip.n楽器パートでの出現順 < CDTXMania.Instance.DTX.listAutoGhostLag[pChip.e楽器パート].Count)
167                                 {
168                                         // #35411 (mod) Ghost data が有効なので 従来のAUTOではなくゴーストのラグを利用
169                                         // 発生時刻と現在時刻からこのタイミングで演奏するかどうかを決定
170                                         ghostLag = CDTXMania.Instance.DTX.listAutoGhostLag[pChip.e楽器パート][pChip.n楽器パートでの出現順];
171                                         bool resetCombo = ghostLag > 255;
172                                         ghostLag = (ghostLag & 255) - 128;
173                                         ghostLag -= (pChip.e楽器パート == EPart.Guitar ?
174                                                                                                 CDTXMania.Instance.ConfigIni.nInputAdjustTimeMs.Guitar :
175                                                                                                 CDTXMania.Instance.ConfigIni.nInputAdjustTimeMs.Bass);
176                                         autoPlayCondition &= (pChip.n発声時刻ms + ghostLag <= CSound管理.rc演奏用タイマ.n現在時刻ms);
177                                         if (resetCombo && autoPlayCondition)
178                                         {
179                                                 this.actCombo.dgbコンボ数[pChip.e楽器パート].ResetCombo();
180                                         }
181                                         bUsePerfectGhost = false;
182                                 }
183
184                                 if (bUsePerfectGhost)
185                                 {
186                                         // 従来のAUTOを使用する場合
187                                         autoPlayCondition &= (pChip.nバーからの距離dot[inst] < 0);
188                                 }
189
190                                 if (autoPlayCondition)
191                                 {
192                                         // lane offset
193                                         int lo = (inst == EPart.Guitar) ? 0 : 3;
194                                         bool autoR = (inst == EPart.Guitar) ? CDTXMania.Instance.ConfigIni.bAutoPlay.GtR : CDTXMania.Instance.ConfigIni.bAutoPlay.BsR;
195                                         bool autoG = (inst == EPart.Guitar) ? CDTXMania.Instance.ConfigIni.bAutoPlay.GtG : CDTXMania.Instance.ConfigIni.bAutoPlay.BsG;
196                                         bool autoB = (inst == EPart.Guitar) ? CDTXMania.Instance.ConfigIni.bAutoPlay.GtB : CDTXMania.Instance.ConfigIni.bAutoPlay.BsB;
197                                         bool pushingR = CDTXMania.Instance.Pad.b押されている(inst == EPart.Guitar ? EPad.GtR : EPad.BsR);
198                                         bool pushingG = CDTXMania.Instance.Pad.b押されている(inst == EPart.Guitar ? EPad.GtG : EPad.BsG);
199                                         bool pushingB = CDTXMania.Instance.Pad.b押されている(inst == EPart.Guitar ? EPad.GtB : EPad.BsB);
200
201                                         #region [ Chip Fire effects (auto時用) ]
202                                         // autoPickでない時の処理は、 t入力処理・ギターベース(E楽器パート) で行う
203                                         bool bSuccessOPEN = bChipIsO && (autoR || !pushingR) && (autoG || !pushingG) && (autoB || !pushingB);
204                                         {
205                                                 if ((bChipHasR && (autoR || pushingR)) || bSuccessOPEN)
206                                                 {
207                                                         this.actChipFireGB.Start(0 + lo);
208                                                 }
209                                                 if ((bChipHasG && (autoG || pushingG)) || bSuccessOPEN)
210                                                 {
211                                                         this.actChipFireGB.Start(1 + lo);
212                                                 }
213                                                 if ((bChipHasB && (autoB || pushingB)) || bSuccessOPEN)
214                                                 {
215                                                         this.actChipFireGB.Start(2 + lo);
216                                                 }
217                                         }
218                                         #endregion
219                                         #region [ autopick ]
220                                         {
221                                                 bool bMiss = true;
222                                                 if (bChipHasR == autoR && bChipHasG == autoG && bChipHasB == autoB)   // autoレーンとチップレーン一致時はOK
223                                                 {                                     // この条件を加えないと、同時に非autoレーンを押下している時にNGとなってしまう。
224                                                         bMiss = false;
225                                                 }
226                                                 else if ((autoR || (bChipHasR == pushingR)) && (autoG || (bChipHasG == pushingG)) && (autoB || (bChipHasB == pushingB)))
227                                                 // ( bChipHasR == ( pushingR | autoR ) ) && ( bChipHasG == ( pushingG | autoG ) ) && ( bChipHasB == ( pushingB | autoB ) ) )
228                                                 {
229                                                         bMiss = false;
230                                                 }
231                                                 else if (((bChipIsO == true) && (!pushingR | autoR) && (!pushingG | autoG) && (!pushingB | autoB))) // OPEN時
232                                                 {
233                                                         bMiss = false;
234                                                 }
235                                                 pChip.bHit = true;
236                                                 this.tサウンド再生(pChip, CSound管理.rc演奏用タイマ.n前回リセットした時のシステム時刻 + pChip.n発声時刻ms + ghostLag,
237                                                         inst, CDTXMania.Instance.DTX.nモニタを考慮した音量(inst), false, bMiss);
238                                                 this.r次にくるギターChip = null;
239                                                 if (!bMiss)
240                                                 {
241                                                         this.tチップのヒット処理(pChip.n発声時刻ms + ghostLag, pChip);
242                                                 }
243                                                 else
244                                                 {
245                                                         pChip.nLag = 0;   // tチップのヒット処理()の引数最後がfalseの時はpChip.nLagを計算しないため、ここでAutoPickかつMissのLag=0を代入
246                                                         this.tチップのヒット処理(pChip.n発声時刻ms + ghostLag, pChip, false);
247                                                 }
248                                                 EChannel chWailingChip = (inst == EPart.Guitar) ? EChannel.Guitar_Wailing : EChannel.Bass_Wailing;
249                                                 CChip item = this.r指定時刻に一番近い未ヒットChip(pChip.n発声時刻ms + ghostLag, chWailingChip, CDTXMania.Instance.ConfigIni.nInputAdjustTimeMs[inst], 140);
250                                                 if (item != null && !bMiss)
251                                                 {
252                                                         this.queWailing[inst].Enqueue(item);
253                                                 }
254                                         }
255                                         #endregion
256                                         // #35411 modify end
257                                 }
258                                 SetGhostTargetOnGraph(inst);
259                                 return;
260                         } // end of "if configIni.bGuitar有効"
261                         else
262                         {
263                                 // Guitar/Bass無効の場合は、自動演奏する
264                                 if ((!pChip.bHit && (pChip.nバーからの距離dot[inst] < 0)))
265                                 {
266                                         pChip.bHit = true;
267                                         this.tサウンド再生(pChip, CSound管理.rc演奏用タイマ.n前回リセットした時のシステム時刻 + pChip.n発声時刻ms, inst, CDTXMania.Instance.DTX.nモニタを考慮した音量(inst));
268                                 }
269                         }
270                 }
271
272                 private void SetGhostTargetOnGraph(EPart inst)
273                 {
274                         if (inst != EPart.Unknown)
275                         {
276                                 // #35411 2015.08.21 chnmr0 add
277                                 // 目標値グラフにゴーストの達成率を渡す
278                                 if (CDTXMania.Instance.ConfigIni.eTargetGhost[inst] != ETargetGhostData.None &&
279                                                 CDTXMania.Instance.DTX.listTargetGhsotLag[inst] != null)
280                                 {
281                                         double val = 0;
282                                         if (CDTXMania.Instance.ConfigIni.eTargetGhost[inst] == ETargetGhostData.Online)
283                                         {
284                                                 if (CDTXMania.Instance.DTX.n可視チップ数[inst] > 0)
285                                                 {
286                                                         // Online Stats の計算式
287                                                         val = 100 *
288                                                                         (this.nヒット数_TargetGhost[inst].Perfect * 17 +
289                                                                          this.nヒット数_TargetGhost[inst].Great * 7 +
290                                                                          this.n最大コンボ数_TargetGhost[inst] * 3) / (20.0 * CDTXMania.Instance.DTX.n可視チップ数[inst]);
291                                                 }
292                                         }
293                                         else
294                                         {
295                                                 val = CScoreIni.t演奏型スキルを計算して返す(
296                                                                                 CDTXMania.Instance.DTX.n可視チップ数[inst],
297                                                                                 this.nヒット数_TargetGhost[inst].Perfect,
298                                                                                 this.nヒット数_TargetGhost[inst].Great,
299                                                                                 this.nヒット数_TargetGhost[inst].Good,
300                                                                                 this.nヒット数_TargetGhost[inst].Poor,
301                                                                                 this.nヒット数_TargetGhost[inst].Miss,
302                                                                                 EPart.Drums, false);
303                                         }
304                                         if (val < 0)
305                                         {
306                                                 val = 0;
307                                         }
308                                         if (val > 100)
309                                         {
310                                                 val = 100;
311                                         }
312                                         this.actGraph.dbTarget[inst] = val;
313                                 }
314                         }
315                 }
316
317
318                 protected void t進行描画_チップ_小節線_拍線(ref CChip pChip)
319                 {
320                         int n小節番号plus1 = pChip.n発声位置 / 384;
321                         if (!pChip.bHit && (pChip.nバーからの距離dot.Drums < 0))
322                         {
323                                 pChip.bHit = true;
324                                 this.actPlayInfo.n小節番号 = n小節番号plus1 - 1;
325                                 if (CDTXMania.Instance.ConfigIni.bWaveAdjust && (bIsDirectSound || CDTXMania.Instance.ConfigIni.bUseOSTimer))
326                                 {
327                                         CDTXMania.Instance.DTX.tWave再生位置自動補正();
328                                 }
329                                 // dTX.tWaveBGM再生位置表示();            //デバッグ用
330                         }
331
332                         EPart ePhraseNumberDisplayInst = EPart.Drums;
333                         if (!CDTXMania.Instance.DTX.bチップがある.Drums)
334                         {
335                                 ePhraseNumberDisplayInst = EPart.Guitar;
336                                 if (!CDTXMania.Instance.DTX.bチップがある.Guitar)
337                                 {
338                                         ePhraseNumberDisplayInst = EPart.Bass;
339                                 }
340                         }
341
342                         for (EPart inst = EPart.Drums; inst <= EPart.Bass; ++inst)
343                         {
344                                 if (CDTXMania.Instance.ConfigIni.b楽器有効(inst) && CDTXMania.Instance.DTX.bチップがある[inst])
345                                 {
346                                         if ((inst == EPart.Guitar || inst == EPart.Bass) && pChip[EChannel.BeatLine])
347                                         {
348                                                 continue;
349                                         }
350                                         this.txチップ.n透明度 = 255;
351
352                                         int y = C演奏判定ライン座標共通.n判定ラインY座標(inst);
353                                         int ymin = 0;
354                                         int ymax = SampleFramework.GameWindowSize.Height;
355
356                                         int dy = 0;
357                                         Rectangle rc = pChip[EChannel.BeatLine] ?
358                                                 CDTXMania.Instance.Coordinates.ImgBeatLine :
359                                                 CDTXMania.Instance.Coordinates.ImgBarLine;
360
361                                         if (
362                                                 (inst == EPart.Drums && !CDTXMania.Instance.ConfigIni.bReverse.Drums) ||
363                                                 (inst != EPart.Drums && CDTXMania.Instance.ConfigIni.bReverse[inst])
364                                                 )
365                                         {
366                                                 // 上から下へくるパターン
367                                                 y = y - (int)(pChip.nバーからの距離dot[inst]) - rc.Height / 2;
368                                                 dy = -dy;
369                                         }
370                                         else if (
371                                                 (inst == EPart.Drums && CDTXMania.Instance.ConfigIni.bReverse.Drums) ||
372                                                 (inst != EPart.Drums && !CDTXMania.Instance.ConfigIni.bReverse[inst])
373                                                 )
374                                         {
375                                                 // 下から上へくるパターン
376                                                 y = y + (int)(pChip.nバーからの距離dot[inst]) - rc.Height / 2;
377                                         }
378
379                                         // Reverse時の小節線消失位置を、RGBボタンの真ん中程度に。
380                                         // 非Reverse時の消失処理は、従来通りt進行描画・チップ()にお任せ。
381                                         // int n小節線消失距離dot = C演奏判定ライン座標共通.n判定ラインY座標(inst, false, true) - dy;
382
383                                         if ((CDTXMania.Instance.DTX.bチップがある[(int)inst]) && (ymin < y) && (y < ymax) &&
384                                                 (CDTXMania.Instance.ConfigIni.eDark == EDark.Off ||
385                                                 (CDTXMania.Instance.ConfigIni.eDark == EDark.Half && ( pChip[EChannel.BarLine] || pChip[EChannel.BeatLine] ))))
386                                                 /*&& (pChip.nバーからの距離dot[(int)inst] >= n小節線消失距離dot)*/
387                                         {
388                                                 int jx = CDTXMania.Instance.ConfigIni.cdInstX[inst][CDTXMania.Instance.ConfigIni.eActiveInst].Value;
389                                                 int jy = CDTXMania.Instance.ConfigIni.cdJudgeLineY[inst];
390                                                 int jw = CDTXMania.Instance.Coordinates.Instrument[inst].W;
391                                                 //小節線・拍線
392                                                 if (pChip.b可視)
393                                                 {
394                                                         for ( int offsetX = 0; offsetX < jw; offsetX += rc.Width )
395                                                         {
396                                                                 int x = jx + offsetX;
397                                                                 if ( offsetX + rc.Width > jw )
398                                                                 {
399                                                                         rc.Width = jw - offsetX;
400                                                                 }
401                                                                 this.txチップ.t2D描画( CDTXMania.Instance.Device, x, y, rc );
402                                                         }
403                                                 }
404                                                 if (
405                                                         pChip[EChannel.BarLine] &&
406                                                         CDTXMania.Instance.ConfigIni.bDebugInfo &&
407                                                         (CDTXMania.Instance.ConfigIni.eDark == EDark.Off) &&
408                                                         inst == ePhraseNumberDisplayInst)
409                                                 {
410                                                         // 小節番号の表示
411                                                         int n小節番号 = n小節番号plus1 - 1;
412                                                         int x = jx + jw + CDTXMania.Instance.Coordinates.ImgConsoleFont.W;
413                                                         CDTXMania.Instance.act文字コンソール.tPrint(x, y - CDTXMania.Instance.Coordinates.ImgConsoleFont.H / 2,
414                                                                 C文字コンソール.Eフォント種別.白, n小節番号.ToString()
415                                                         );
416                                                 }
417                                         }
418                                 }
419                         }
420                 }
421
422                 private void t進行描画_判定ライン()
423                 {
424                         if (CDTXMania.Instance.ConfigIni.eDark != EDark.Full)
425                         {
426                                 for (EPart inst = EPart.Drums; inst <= EPart.Bass; ++inst)
427                                 {
428                                         if (CDTXMania.Instance.ConfigIni.b楽器有効(inst) && CDTXMania.Instance.DTX.bチップがある[inst])
429                                         {
430                                                 // #31602 2016.2.11 yyagi 描画遅延対策として、判定ラインの表示位置をオフセット調整できるようにする
431                                                 int y = C演奏判定ライン座標共通.n判定ラインY座標(inst, false, true);
432                                                 if (this.txヒットバー != null)
433                                                 {
434                                                         int lineLength = CDTXMania.Instance.Coordinates.Instrument[inst].W;
435                                                         Rectangle rc = CDTXMania.Instance.Coordinates.ImgJudgeLine;
436                                                         int barHeight = rc.Height;
437                                                         for (int tmpW = 0; tmpW < lineLength; tmpW += rc.Width)
438                                                         {
439                                                                 if (tmpW + rc.Width > lineLength)
440                                                                 {
441                                                                         rc.Width = lineLength - tmpW;
442                                                                 }
443                                                                 this.txヒットバー.t2D描画(CDTXMania.Instance.Device,
444                                                                         CDTXMania.Instance.ConfigIni.cdInstX[ inst ][ CDTXMania.Instance.ConfigIni.eActiveInst ] + tmpW, y - barHeight / 2, rc );
445                                                         }
446                                                 }
447                                         }
448                                 }
449                         }
450                 }
451
452                 private void t背景テクスチャの生成()
453                 {
454                         string bgfilename = null;
455
456                         if ((CDTXMania.Instance.ConfigIni.b楽器有効(EPart.Drums) == false) &&  (CDTXMania.Instance.DTX.BACKGROUND_GR != null) && (CDTXMania.Instance.DTX.BACKGROUND_GR.Length > 0))
457                         {
458                                 bgfilename = CDTXMania.Instance.DTX.BACKGROUND_GR;
459                         }
460                         else if ((CDTXMania.Instance.DTX.BACKGROUND != null) && (CDTXMania.Instance.DTX.BACKGROUND.Length > 0))
461                         {
462                                 bgfilename = CDTXMania.Instance.DTX.BACKGROUND;
463                         }
464
465                         if (bgfilename != null && bgfilename.Length > 0)
466                         {
467                                 bgfilename = CDTXMania.Instance.DTX.strフォルダ名 + bgfilename;
468                         }
469
470                         using (Bitmap bgbitmap = new Bitmap(SampleFramework.GameWindowSize.Width, SampleFramework.GameWindowSize.Height))
471                         {
472                                 if (bgfilename != null && File.Exists(bgfilename))
473                                 {
474                                         using (Bitmap originalBackground = new Bitmap(bgfilename))
475                                         {
476                                                 float W = originalBackground.Width;
477                                                 float H = originalBackground.Height;
478
479                                                 float mag = 1;
480                                                 // VGA補正
481                                                 if (W > 0 && H > 0)
482                                                 {
483                                                         float mx = SampleFramework.GameWindowSize.Width / W;
484                                                         float my = SampleFramework.GameWindowSize.Height / H;
485
486                                                         mag = Math.Min(mx, my);
487                                                 }
488
489                                                 using (Graphics graphic2 = Graphics.FromImage(bgbitmap))
490                                                 {
491                                                         float x = (SampleFramework.GameWindowSize.Width - W * mag) / 2;
492                                                         float y = (SampleFramework.GameWindowSize.Height - H * mag) / 2;
493                                                         graphic2.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
494                                                         graphic2.DrawImage(originalBackground, x, y, W * mag, H * mag);
495                                                 }
496                                         }
497                                 }
498
499                                 using (Bitmap image = new Bitmap(CSkin.Path(@"Graphics\ScreenPlayDrums-background-center.png")))
500                                 {
501                                         // フレーム画像合成
502                                         using (Graphics graphics3 = Graphics.FromImage(image))
503                                         {
504                                                 graphics3.DrawImage(bgbitmap, new Rectangle(0, 0, image.Width, image.Height));
505
506                                                 #region [ BGA領域黒抜き・テクスチャ変換・Full再生透明度 ]
507                                                 if ((CDTXMania.Instance.DTX.listBMP.Count > 0) || (CDTXMania.Instance.DTX.listBMPTEX.Count > 0) || CDTXMania.Instance.DTX.listAVI.Count > 0)
508                                                 {
509                                                         graphics3.FillRectangle(Brushes.Black,
510                                                                 new Rectangle(
511                                                                         CDTXMania.Instance.ConfigIni.cdMovieX[CDTXMania.Instance.ConfigIni.eActiveInst],
512                                                                         CDTXMania.Instance.ConfigIni.cdMovieY[CDTXMania.Instance.ConfigIni.eActiveInst],
513                                                                         CDTXMania.Instance.Coordinates.Movie.W, CDTXMania.Instance.Coordinates.Movie.H));
514                                                 }
515                                                 #endregion
516                                         }
517                                         TextureFactory.tテクスチャの解放(ref this.tx背景);
518                                         this.tx背景 = TextureFactory.tテクスチャの生成(image, true);
519                                 }
520                         }
521                 }
522
523                 private void t進行描画_チップ_ドラムス(ref CChip pChip)
524                 {
525                         if (CDTXMania.Instance.ConfigIni.bDrums有効)
526                         {
527                                 SudHidInvChip(EPart.Drums, ref pChip);
528
529                                 if (!pChip.bHit && pChip.b可視)
530                                 {
531                                         if (this.txチップ != null)
532                                         {
533                                                 this.txチップ.n透明度 = pChip.n透明度;
534                                         }
535                                         int jy = C演奏判定ライン座標共通.n判定ラインY座標(EPart.Drums);
536                                         int y = CDTXMania.Instance.ConfigIni.bReverse.Drums ? (int)(jy + pChip.nバーからの距離dot.Drums) : (int)(jy - pChip.nバーからの距離dot.Drums);
537
538                                         if (this.txチップ != null)
539                                         {
540                                                 this.txチップ.vc拡大縮小倍率 = new Vector3((float)(pChip.dbチップサイズ倍率), (float)pChip.dbチップサイズ倍率, 1f);
541                                         }
542
543                                         int num9 = this.ctチップ模様アニメ.Drums.n現在の値 % CDTXMania.Instance.Coordinates.ImgDrCountChip;
544                                         int x = CDTXMania.Instance.ConfigIni.GetLaneX(EnumConverter.LaneFromChannel(pChip.eチャンネル番号)) +
545                                                 (int)((CDTXMania.Instance.ConfigIni.GetLaneW(EnumConverter.LaneFromChannel(pChip.eチャンネル番号))
546                                                 - (CDTXMania.Instance.Coordinates.ImgDrChip[EnumConverter.PadFromChannel(pChip.eチャンネル番号)].W * (pChip.dbチップサイズ倍率))) / 2.0);
547                                         if (this.txチップ != null)
548                                         {
549                                                 this.txチップ.t2D描画(CDTXMania.Instance.Device, x,
550                                                         y - CDTXMania.Instance.Coordinates.ImgDrChip[EnumConverter.PadFromChannel(pChip.eチャンネル番号)].H / 2,
551                                                         CDTXMania.Instance.Coordinates.ImgDrChip[EnumConverter.PadFromChannel(pChip.eチャンネル番号)].ApplyCounterY(num9, 2));
552                                         }
553
554                                         // Chip Decoration
555                                         switch (pChip.eチャンネル番号)
556                                         {
557                                                 case EChannel.Cymbal:
558                                                         if (this.txチップ != null)
559                                                         {
560                                                                 this.txチップ.t2D描画(CDTXMania.Instance.Device, x,
561                                                                         y - CDTXMania.Instance.Coordinates.ImgDrChipCYDeco.H / 2, CDTXMania.Instance.Coordinates.ImgDrChipCYDeco);
562                                                         }
563                                                         break;
564
565                                                 case EChannel.HiHatOpen:
566                                                         if (this.txチップ != null)
567                                                         {
568                                                                 this.txチップ.t2D描画(CDTXMania.Instance.Device, x, y - CDTXMania.Instance.Coordinates.ImgDrChipHHODeco.H / 2, CDTXMania.Instance.Coordinates.ImgDrChipHHODeco);
569                                                         }
570                                                         break;
571
572                                                 case EChannel.RideCymbal:
573                                                         if (this.txチップ != null)
574                                                         {
575                                                                 this.txチップ.t2D描画(CDTXMania.Instance.Device, x, y - CDTXMania.Instance.Coordinates.ImgDrChipHHODeco.H / 2, CDTXMania.Instance.Coordinates.ImgDrChipHHODeco);
576                                                         }
577                                                         break;
578
579                                                 case EChannel.LeftCymbal:
580                                                         if (this.txチップ != null)
581                                                         {
582                                                                 this.txチップ.t2D描画(CDTXMania.Instance.Device, x, y - CDTXMania.Instance.Coordinates.ImgDrChipCYDeco.H / 2, CDTXMania.Instance.Coordinates.ImgDrChipCYDeco);
583                                                         }
584                                                         break;
585                                         }
586                                         if (this.txチップ != null)
587                                         {
588                                                 this.txチップ.vc拡大縮小倍率 = new Vector3(1f, 1f, 1f);
589                                                 this.txチップ.n透明度 = 0xff;
590                                         }
591                                 }
592
593                                 // #35411 chnmr0 modified
594                                 bool autoPlayCondition = (CDTXMania.Instance.ConfigIni.bAutoPlay[EnumConverter.PadFromChannel(pChip.eチャンネル番号)] && !pChip.bHit);
595                                 bool UsePerfectGhost = true;
596                                 long ghostLag = 0;
597
598                                 if (CDTXMania.Instance.ConfigIni.eAutoGhost.Drums != EAutoGhostData.Perfect &&
599                                                 CDTXMania.Instance.DTX.listAutoGhostLag.Drums != null &&
600                                                 0 <= pChip.n楽器パートでの出現順 && pChip.n楽器パートでの出現順 < CDTXMania.Instance.DTX.listAutoGhostLag.Drums.Count)
601                                 {
602                                         // ゴーストデータが有効 : ラグに合わせて判定
603                                         ghostLag = CDTXMania.Instance.DTX.listAutoGhostLag.Drums[pChip.n楽器パートでの出現順];
604                                         ghostLag = (ghostLag & 255) - 128;
605                                         ghostLag -= CDTXMania.Instance.ConfigIni.nInputAdjustTimeMs.Drums;
606                                         autoPlayCondition &= !pChip.bHit && (ghostLag + pChip.n発声時刻ms <= CSound管理.rc演奏用タイマ.n現在時刻ms);
607                                         UsePerfectGhost = false;
608                                 }
609                                 if (UsePerfectGhost)
610                                 {
611                                         // 従来の AUTO : バー下で判定
612                                         autoPlayCondition &= (pChip.nバーからの距離dot.Drums < 0);
613                                 }
614
615                                 if (autoPlayCondition)
616                                 {
617                                         pChip.bHit = true;
618                                         this.actLaneFlushD.Start(EnumConverter.LaneFromChannel(pChip.eチャンネル番号), ((float)CInput管理.n通常音量) / 127f);
619                                         bool flag = this.bフィルイン中;
620                                         bool flag2 = this.bフィルイン中 && this.bフィルイン区間の最後のChipである(pChip);
621                                         //bool flag3 = flag2;
622                                         // #31602 2013.6.24 yyagi 判定ラインの表示位置をずらしたら、チップのヒットエフェクトの表示もずらすために、nJudgeLine..を追加
623                                         this.actChipFireD.Start(EnumConverter.LaneFromChannel(pChip.eチャンネル番号), flag, flag2, flag2);
624                                         this.actPad.Hit(EnumConverter.PadFromChannel(pChip.eチャンネル番号));
625                                         this.tサウンド再生(pChip, CSound管理.rc演奏用タイマ.n前回リセットした時のシステム時刻 + pChip.n発声時刻ms + ghostLag, EPart.Drums, CDTXMania.Instance.DTX.nモニタを考慮した音量(EPart.Drums));
626                                         this.tチップのヒット処理(pChip.n発声時刻ms + ghostLag, pChip);
627                                         cInvisibleChip.StartSemiInvisible(EPart.Drums);
628                                 }
629                                 // #35411 modify end
630
631                                 SetGhostTargetOnGraph(EPart.Drums);
632                                 return;
633                         }
634                         else
635                         {
636                                 if (!pChip.bHit && (pChip.nバーからの距離dot.Drums < 0))
637                                 {
638                                         this.tサウンド再生(pChip, CSound管理.rc演奏用タイマ.n前回リセットした時のシステム時刻 + pChip.n発声時刻ms, EPart.Drums, CDTXMania.Instance.DTX.nモニタを考慮した音量(EPart.Drums));
639                                         pChip.bHit = true;
640                                 }
641                         }
642                 }
643         }
644 }