では、StatusWindowクラスで実際にこれらのアイテムを使う処理を見ていく。
[StatusWindowクラス ]
public void eventStart(GameData gdt) {
int cursorPlus=0;
int pushKey=0;
if (gData.pPlatform.keyPush[4]) { gData.pPlatform.keyPush[4]=false; pushKey=1;
}
if (gData.pPlatform.keyPush[5]) { gData.pPlatform.keyPush[5]=false; pushKey=2;
}
if (gData.pPlatform.keyPush[0]) { gData.pPlatform.keyPush[0]=false; cursorPos[mode]--;
}
if (gData.pPlatform.keyPush[1]) { gData.pPlatform.keyPush[1]=false; cursorPos[mode]++;
}
if (gData.pPlatform.keyPush[2]) { gData.pPlatform.keyPush[2]=false; cursorPos[mode]-=20;
}
if (gData.pPlatform.keyPush[3]) { gData.pPlatform.keyPush[3]=false; cursorPos[mode]+=20;
}
if (cursorPos[mode] > cursorMax[mode]) { cursorPos[mode]=0; //if (mode==20) pagePlus++;
}
if (cursorPos[mode] < 0) { cursorPos[mode]=cursorMax[mode]; //if (mode==20) pagePlus--;
}
↑ここから上はいじってないはず。
switch (mode) {
case 1://総合メニュー if (pushKey==1) mainMenuMode0(); if (pushKey==2) stWinEnd=true; break;
case 2: //ステータスを見るキャラを選択するモード if (pushKey==1) { if (unitLiveCheck(cursorPos[mode]) ) { selectUnitNumber=cursorPos[mode]; modeChange=3; } } if (pushKey==2) modeChange=1; break;
case 3: if (pushKey==2) modeChange=2; break;
case 4: //item Use Mode if (pushKey==1) { ItemData cItem=gData.siData[cursorPos[mode]]; if (cItem.category==4 && (cItem.type>=1 && cItem.type<=5) ) { healPlusInit(); if (cItem.type==1 || cItem.type==4) healPlus[0]=cItem.power; if (cItem.type==2 || cItem.type==4) healPlus[1]=cItem.power; if (cItem.type==3 || cItem.type==4) healPlus[2]=cItem.power; if (cItem.type==5) healPlus[3]=cItem.power; selectItemNumber=cursorPos[mode]; modeChange=5; //アイテム使用する相手を決めるモードに移る。使用できるアイテム以外無視する } } if (pushKey==2) modeChange=1; break;
case 5://アイテムを使う対象を決める if (pushKey==1) { UnitData cUnit=gData.uData[cursorPos[mode]]; if (cUnit.live) { healPlus[4]=cursorPos[mode]; heal(); modeChange=6; } } if (pushKey==2) modeChange=1; break;
case 6://アイテム使用を実行中 itemUsing(); break;
case 7: if (pushKey==2) modeChange=1; break;
}
if (timer[1]>=1 && timer[0]
if (modeChange>=1) { mode=modeChange; modeChange=0; count=0; timerSet(0);
}
}
追加したのはcase 4 5 6 7
7は次回の装備で使う。今回は入り口しか作ってない。
case 4:
使うアイテムを選ぶ。
if (cItem.category==4 && (cItem.type>=1 && cItem.type<=5) ) {
gSet.rectSet2(g,177,100+10,450,480,0,200);
int nx=210;
int ny=140;
int nys=ny;
int page=cursorPos[4]/40;
int kz=cursorPos[4]-page*40;
for (int i=0;i<=39;i++) { ItemData cItem=gData.siData[i+page*40]; String word=cItem.name; if (cItem.category==4) word+=" ("+cItem.quantity+")"; if (cItem.category==0) word="――――――――"; gSet.wordDisp_short2(g,word,nx,ny,0); ny+=22; if (i==19) { nx+=200; ny=nys; }
}
int px=0;
if (kz >=20) px=200;
int cy=cursorPos[4]%20;
gSet.wordDisp_short2(g,"→",cursorX[4]+px,cursorY[4]+cy*22,2);
gSet.wordDisp_short2(g,"No."+cursorPos[4],450,580,0);
gSet.wordDisp_short2(g,"Page "+page+"/ 4",530,580,0);
}
if (mode==5 || mode==6) { cSelWinDraw(mode);
}
if (mode==6) { healResultDisp(mode); //回復魔法でも使えるので関数にする
}
if (cItem.category==4) word+=" ("+cItem.quantity+")";
一枠に複数キープできる消耗品は、アイテム名+枠内の数量も同時に描画しておく。
if (cItem.category==0) word="――――――――";
カテゴリー0のアイテムは存在しないとみなし、棒線一本だけ描画する。
gSet.wordDisp_short2(g,word,nx,ny,0);
ny+=22;
if (i==19) { nx+=200; ny=nys;
}
int stx=600;
int sty=240;
gSet.rectSet2(g,stx-24,sty-24,144,100,0,0);
String[] moji= {"HP","MP","KP"};
gSet.wordDisp_short2(g,charaName[healPlus[4]],stx+10,sty,0);
for (int i=0;i<=2;i++) { if (healPlus[i]!=0) { if (healPlus[i]>=1) gSet.wordDisp_short2(g,moji[i]+" +"+healPlus[i],stx+10,sty+22+i*22,0); if (healPlus[i]<=-1) gSet.wordDisp_short2(g,moji[i]+" "+healPlus[i],stx+10,sty+22+i*22,0); }
}
if (healPlus[i]>=1) gSet.wordDisp_short2(g,moji[i]+" +"+healPlus[i],stx+10,sty+22+i*22,0);
if (healPlus[i]<=-1) gSet.wordDisp_short2(g,moji[i]+" "+healPlus[i],stx+10,sty+22+i*22,0);