NarumiSTG_HyperSnowDrifter/script/Package_MenuLib.dnh

593 lines
33 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

task TConfigScene{
// Credit: Kobito
let bEndTitleScene = false;
// BGM, SE, Life, BG, Skip, PlayerShot, Item
let settingDefault = [100, 100, 3, 100, 60, 60, 0];
let setting = [0, 0, 0, 0, 0, 0, 0];
let settingMax = [100, 100, 999, 100, 100, 100, 3];
let holdInterval = [2, 2, 1, 2, 2, 2, 30];
setting[0] = GetAreaCommonData("Config", "BGMVol", 100);
setting[1] = GetAreaCommonData("Config", "SEVol", 100);
setting[2] = GetAreaCommonData("Config", "StartingLife", 3);
setting[3] = GetAreaCommonData("Config", "BGOpacity", 255);
setting[4] = GetAreaCommonData("Config", "PlayerShotOpacity", 60);
setting[5] = GetAreaCommonData("Config", "ItemOpacity", 60);
setting[6] = GetAreaCommonData("Config", "EffectCut", 0);
let selectIndex = 0;
var countMenu = 8;
let texts = [0, 0, 0, 0, 0, 0, 0, 0];
let objWarning = CreateTextObject(
GetScreenWidth()/2, 9*GetScreenHeight()/12, [32, 40][lang],
["High scores are only saved with 3 starting lives or fewer.[r]Press X/Cancel to save settings and return to the menu.",
"ライフカウンター<=3たらだけハイスコアは記録します。[r]X/CANCELコンフィグをセーブとメニューに帰る"][lang], "コーポレート・ロゴ(ラウンド) ver2 Bold",
0xFFFFFF, 0xFFFFFF,
0xFF6D64, 35/10,
2
);
ObjText_SetHorizontalAlignment(objWarning, ALIGNMENT_CENTER);
function <int> TMenuItem(
let index,
float mx, my, size,
string text
)
{
let objText = CreateTextObject(
mx, my, size,
text, "コーポレート・ロゴ(ラウンド) ver2 Bold",
0xFFFFFF, 0xFFFFFF,
0x000000, size/10,
2
);
//ObjText_SetHorizontalAlignment(objText, ALIGNMENT_CENTER);
async{
while(!bEndTitleScene)
{
if(index == selectIndex){ObjRender_SetColor(objText, 255, 255, 255);}
else{ObjRender_SetColor(objText, 100, 100, 100);}
yield;
}
Obj_Delete(objText);
}
return objText;
}
float mx = GetScreenWidth()/2-GetScreenWidth()/3;
float my = 1.5*GetScreenHeight()/12;
ascent(i in 0..8){texts[i] = TMenuItem(i, mx, my+i*GetScreenHeight()/15, 35, "");}
ObjText_SetText(texts[7], ["Reset to Default", "DEFAULT"][lang]);
function ChangeSetting(a, b){
setting[a] += b;
if(setting[a] < 0){setting[a] = settingMax[a];}
else if(setting[a] > settingMax[a]){setting[a] = 0;}
}
let configText = [
["BGM Volume: ", "SFX Volume:", "Starting Lives:", "Background Opacity:", "Player Shot Opacity:", "Item Opacity: ", "Effect Cut Level: "],
["BGM Vol: ", "SFX Vol: ", "ライフカウンター: ", "背景の透明:", "プレイヤーショットの透明: ", "アイテムの透明:", "エフェクトカット:"]
];
function UpdateTexts{
ObjText_SetText(texts[0], configText[lang][0]~" " ~ IntToString(setting[0]));
ObjText_SetText(texts[1], configText[lang][1]~" " ~ IntToString(setting[1]));
ObjText_SetText(texts[2], configText[lang][2]~" " ~ IntToString(setting[2]));
ObjText_SetText(texts[3], configText[lang][3]~" " ~ IntToString(setting[3]) ~ "%");
alternative(setting[4])
case(0){ObjText_SetText(texts[4], configText[lang][4]~" " ~ IntToString(setting[4]) ~ [" (Why???)", " (なんで???)"][lang]);}
case(60){ObjText_SetText(texts[4],configText[lang][4]~" " ~ IntToString(setting[4]) ~ [" (Recommended)", " (推薦)"][lang]);}
case(100){ObjText_SetText(texts[4],configText[lang][4]~" " ~ IntToString(setting[4]) ~ [" (Eye-Blinding)", " (逆上)"][lang]);}
others{ObjText_SetText(texts[4], configText[lang][4]~" " ~ IntToString(setting[4]));}
alternative(setting[5])
case(0){ObjText_SetText(texts[5], configText[lang][5]~" " ~ IntToString(setting[5]) ~ [" (Why???)", " (なんで???)"][lang]);}
case(60){ObjText_SetText(texts[5], configText[lang][5]~" " ~ IntToString(setting[5]) ~ [" (Recommended)", " (推薦)"][lang]);}
case(100){ObjText_SetText(texts[5], configText[lang][5]~" " ~ IntToString(setting[5]) ~ [" (Eye-Blinding)", " (逆上)"][lang]);}
others{ObjText_SetText(texts[5], configText[lang][5]~" " ~ IntToString(setting[5]));}
alternative(setting[6])
case(0){ObjText_SetText(texts[6], configText[lang][6]~ " " ~ IntToString(setting[6]) ~ [" (Full Effects)", " (全部エフェクト)"][lang]);}
case(1){ObjText_SetText(texts[6], configText[lang][6]~ " " ~ IntToString(setting[6]) ~ [" (No Item Popups)", " (アイテムポップアップじゃない)"][lang]);}
case(2){ObjText_SetText(texts[6], configText[lang][6]~ " " ~ IntToString(setting[6]) ~ [" (No Explosion Effects)", " (爆発エフェクトじゃない)"][lang]);}
case(3){ObjText_SetText(texts[6], configText[lang][6]~ " " ~ IntToString(setting[6]) ~ [" (No Effects)", " (エフェクトじゃない)"][lang]);}
others{ObjText_SetText(texts[6], configText[lang][6]~ " " ~ IntToString(setting[6]));}
}
UpdateTexts();
while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}
let frameKeyHold = 0;
let frameKeyHoldSide = 0;
loop{
UpdateTexts();
if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){
TTitleScene();
break;
}
// Select option to configure
if(GetVirtualKeyState(VK_UP) == KEY_PUSH){selectIndex--;}
else if(GetVirtualKeyState(VK_DOWN) == KEY_PUSH){selectIndex++;}
else if(GetVirtualKeyState(VK_UP) == KEY_HOLD){
frameKeyHold++;
if(frameKeyHold == 30 || (frameKeyHold > 30 && (frameKeyHold % 10 == 0))){selectIndex--;}
}
else if(GetVirtualKeyState(VK_DOWN) == KEY_HOLD){
frameKeyHold++;
if(frameKeyHold == 30 || (frameKeyHold > 30 && (frameKeyHold % 10 == 0))){selectIndex++;}
}
else{frameKeyHold = 0;}
if(selectIndex < 0) {selectIndex = countMenu - 1;}
else{selectIndex %= countMenu;}
if(GetVirtualKeyState(VK_RIGHT) == KEY_HOLD || GetVirtualKeyState(VK_LEFT) == KEY_HOLD){frameKeyHoldSide++;}
else{frameKeyHoldSide = 0;}
if(GetVirtualKeyState(VK_RIGHT) == KEY_PUSH || GetVirtualKeyState(VK_RIGHT) == KEY_HOLD){
if(GetVirtualKeyState(VK_RIGHT) == KEY_PUSH || (frameKeyHoldSide >= 30 && frameKeyHoldSide % holdInterval[selectIndex] == 0)){
if (selectIndex > 7){}
else{ChangeSetting(selectIndex, 1);}
}
}
else if(GetVirtualKeyState(VK_LEFT) == KEY_PUSH || GetVirtualKeyState(VK_LEFT) == KEY_HOLD){
if(GetVirtualKeyState(VK_LEFT) == KEY_PUSH || (frameKeyHoldSide >= 30 && frameKeyHoldSide % holdInterval[selectIndex] == 0)){
if (selectIndex > 7){}
else{ChangeSetting(selectIndex, -1);}
}
}
if(selectIndex == 7 && GetVirtualKeyState(VK_OK) == KEY_PUSH){
ascent(i in 0..6){
setting[i] = settingDefault[i];
selectIndex = 0;
}
}
SetAreaCommonData("Config", "BGMVol", setting[0]);
SetAreaCommonData("Config", "SEVol", setting[1]);
SetAreaCommonData("Config", "StartingLife", setting[2]);
SetAreaCommonData("Config", "BGOpacity", setting[3]);
SetAreaCommonData("Config", "PlayerShotOpacity", setting[4]);
SetAreaCommonData("Config", "ItemOpacity", setting[5]);
SetAreaCommonData("Config", "EffectCut", setting[6]);
ObjSound_SetVolumeRate(objTitleBGM, 75*GetAreaCommonData("Config", "BGMVol", 100)*0.01);
ObjText_SetText(texts[7], ["Reset to Default", "DEFAULT"][lang]);
ObjText_SetText(objWarning, ["High scores are only saved with 3 starting lives or fewer.[r]Press X/Cancel to save settings and return to the menu.", "ライフカウンター<=3たらだけハイスコアは記録します。[r]X/CANCELコンフィグをセーブとメニューに帰る"][lang]);
//SetSoundDivisionVolumeRate(SOUND_BGM, GetAreaCommonData("Config", "BGMVol", 100)*0.01);
//SetSoundDivisionVolumeRate(SOUND_SE, GetAreaCommonData("Config", "SEVol", 100)*0.01);
yield;
}
SaveCommonDataAreaA2("Config", "script/GunnerParade/config.dat");
bEndTitleScene = true;
Obj_Delete(objWarning);
}
task TDifficultySelect(){
//メニュー配置
let mx = GetScreenWidth()/2;
let my = 1*GetScreenHeight()/5;
bool bEndTitleScene = false;
int text = CreateTextObject(
mx, my*4, 36,
"", "Unispace",
0xFFFFFF, 0xFFFFFF,
0x000000, 4,
4
);
ObjText_SetHorizontalAlignment(text, ALIGNMENT_CENTER);
ObjText_SetAutoTransCenter(text, true);
let textArray = [
"A beginner-friendly difficulty.[r]Enemy patterns are reigned in for a more lighthearted experience.[r][font size=30 tc=(255, 132, 141)]EXTENDS AT: 250m, 500m, 1b, 1.8b",
"The usual, hectic experience.[r]The game tailors its difficulty to your skill level fully.[r][font size=30 tc=(255, 132, 141)]EXTENDS AT: 400m, 800m, 1.5b, 2.5b",
"The ultimate difficulty.[r]Rank is locked to its highest - there's no holding back![r][font size=30 tc=(255, 132, 141)]EXTENDS AT: EVERY 1BIL"
];
int img_NV = _Create2DImage(dirLib ~ "Difficulty_Novice.png" , [0, 0, 1200, 1080]);
int img_ST = _Create2DImage(dirLib ~ "Difficulty_Standard.png" , [0, 0, 1200, 1080]);
int img_EX = _Create2DImage(dirLib ~ "Difficulty_Extra.png" , [0, 0, 1200, 1080]);
int[] imgArr = [img_NV, img_ST, img_EX];
ascent(i in 0..3){
ObjSprite2D_SetDestCenter(imgArr[i]);
ObjRender_SetScaleXYZ(imgArr[i], 0.75);
ObjRender_SetAlpha(imgArr[i], 180);
Obj_SetRenderPriorityI(imgArr[i], 3);
ObjRender_SetPosition(imgArr[i], (1.5 + 2 * i) * GetScreenWidth()/7, GetScreenHeight()/2-64, 1);
Obj_SetValue(imgArr[i], 'V', i);
}
//Obj_SetVisible(imgArcade, false);
//Obj_SetVisible(imgGentle, false);
let INDEX_NOVICE = 0;
let INDEX_STANDARD = 1;
let INDEX_EXTRA = 2;
let selectIndex = 0;//選択位置
int countMenu = 3;
//キー状態がリセットされるまで待機
while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}
//メニュー選択処理
let frameKeyHold = 0;//キー押しっぱなしフレーム数
loop
{
// Visibility
for each (int img in ref imgArr){
if (Obj_GetValue(img, "V") == selectIndex)
{
ObjRender_SetAlpha(img, 255);
}
else
{
ObjRender_SetAlpha(img, 120);
}
}
ObjText_SetText(text, textArray[selectIndex]);
if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){
TTitleScene();
break;
}
else if(GetVirtualKeyState(VK_OK) == KEY_PUSH)
{
if(selectIndex == INDEX_NOVICE)
{
SetCommonData("Difficulty", "Novice");
TPlayer();
}
else if(selectIndex == INDEX_STANDARD)
{
SetCommonData("Difficulty", "Standard");
TPlayer();
}
else if(selectIndex == INDEX_EXTRA)
{
SetCommonData("Difficulty", "Extra");
TPlayer();
}
break;
}
//カーソル移動
if(GetVirtualKeyState(VK_LEFT) == KEY_PUSH)
{
selectIndex--;
}
else if(GetVirtualKeyState(VK_RIGHT) == KEY_PUSH)
{
selectIndex++;
}
else if(GetVirtualKeyState(VK_LEFT) == KEY_HOLD)
{
frameKeyHold++;
if(frameKeyHold == 30 || (frameKeyHold > 30 && (frameKeyHold % 10 == 0)))
{
selectIndex--;
}
}
else if(GetVirtualKeyState(VK_RIGHT) == KEY_HOLD)
{
frameKeyHold++;
if(frameKeyHold == 30 || (frameKeyHold > 30 && (frameKeyHold % 10 == 0)))
{
selectIndex++;
}
}
else
{
frameKeyHold = 0;
}
if(selectIndex < 0)
{
selectIndex = countMenu - 1;
}
else
{
selectIndex %= countMenu;
}
yield;
}
bEndTitleScene = true;
Obj_Delete(imgArr[0]);
Obj_Delete(imgArr[1]);
Obj_Delete(imgArr[2]);
Obj_Delete(text);
}
task TPlayer(){
bool bEndTitleScene = false;
let INDEX_LAVENDER= 0;
let INDEX_KOURYUU = 1;
let DATA_ARR = [["Lavender", GetCommonData("Difficulty", "Standard")], ["Kouryuu", GetCommonData("Difficulty", "Standard")]];
let selectIndex = 0;//選択位置
//メニュー配置
let mx = GetScreenWidth()/2;
let my = 4*GetScreenHeight()/5;
int text = CreateTextObject(
mx, my, 36,
"", "Unispace",
0xFFFFFF, 0xFFFFFF,
0x000000, 2,
8
);
int nameText = CreateTextObject(
mx, my-72, 48,
"", "Unispace",
0xFFFFFF, 0xFFFFFF,
0x000000, 4,
8
);
ObjText_SetHorizontalAlignment(text, ALIGNMENT_CENTER);
ObjText_SetAutoTransCenter(text, true);
ObjText_SetHorizontalAlignment(nameText, ALIGNMENT_CENTER);
ObjText_SetAutoTransCenter(nameText, true);
let textArray = [
"A talented potion-making witch with a wide-reaching shottype.[r]Her wide range and ammo-efficient special weapon allow for a balanced playstyle.",
"A half-dragon blacksmith with a highly precise forwards shottype.[r]His special weapon is ammo-consuming but erases bullets,[r]making it ideal for defensive purposes."
];
int img_LM = _Create2DImage(dirLib ~ "Character_Lavender.png" , [0, 0, 960, 1080]);
int img_KE = _Create2DImage(dirLib ~ "Character_Kouryuu.png" , [0, 0, 960, 1080]);
int[] imgArr = [img_LM, img_KE];
ascent(i in 0..2){
ObjSprite2D_SetDestCenter(imgArr[i]);
ObjRender_SetScaleXYZ(imgArr[i], 1);
ObjRender_SetAlpha(imgArr[i], 180);
Obj_SetRenderPriorityI(imgArr[i], 3);
Obj_SetValue(imgArr[i], 'V', i);
}
ObjRender_SetPosition(imgArr[0], 1 * GetScreenWidth()/3 - 96, GetScreenHeight()/2, 1);
ObjRender_SetPosition(imgArr[1], 2 * GetScreenWidth()/3 + 96, GetScreenHeight()/2, 1);
var countMenu = 2;
//キー状態がリセットされるまで待機
while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}
//メニュー選択処理
let frameKeyHold = 0;//キー押しっぱなしフレーム数
loop
{
ObjText_SetText(nameText,
"HIGH SCORE: [font bc=(255,178,36)]" ~ DigitToCommaArray(GetAreaCommonData("Data_" ~ DATA_ARR[selectIndex][0], "HighScore_" ~ DATA_ARR[selectIndex][1], 0))
);
if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){
TTitleScene();
break;
}
else if(GetVirtualKeyState(VK_OK) == KEY_PUSH)
{
if(selectIndex == INDEX_LAVENDER)
{
pathPlayer = PlayerArray[0];
TStageScene("", pathPlayer, GetAreaCommonData("Config", "StartingLife", 3), GetAreaCommonData("Config", "DialogueSkip", 0), false);
}
else if(selectIndex == INDEX_KOURYUU)
{
pathPlayer = PlayerArray[1];
TStageScene("", pathPlayer, GetAreaCommonData("Config", "StartingLife", 3), GetAreaCommonData("Config", "DialogueSkip", 0), false);
}
break;
}
if(selectIndex == INDEX_LAVENDER)
{
ObjText_SetText(text, textArray[0]);
ObjRender_SetAlpha(img_LM, 255);
ObjRender_SetAlpha(img_KE, 160);
}
else if(selectIndex == INDEX_KOURYUU)
{
ObjText_SetText(text, textArray[1]);
ObjRender_SetAlpha(img_KE, 255);
ObjRender_SetAlpha(img_LM, 160);
}
//カーソル移動
if(GetVirtualKeyState(VK_LEFT) == KEY_PUSH)
{
selectIndex--;
}
else if(GetVirtualKeyState(VK_RIGHT) == KEY_PUSH)
{
selectIndex++;
}
else if(GetVirtualKeyState(VK_LEFT) == KEY_HOLD)
{
frameKeyHold++;
if(frameKeyHold == 30 || (frameKeyHold > 30 && (frameKeyHold % 10 == 0)))
{
selectIndex--;
}
}
else if(GetVirtualKeyState(VK_RIGHT) == KEY_HOLD)
{
frameKeyHold++;
if(frameKeyHold == 30 || (frameKeyHold > 30 && (frameKeyHold % 10 == 0)))
{
selectIndex++;
}
}
else
{
frameKeyHold = 0;
}
if(selectIndex < 0)
{
selectIndex = countMenu - 1;
}
else
{
selectIndex %= countMenu;
}
yield;
}
Obj_Delete(img_LM);
Obj_Delete(img_KE);
Obj_Delete(text);
Obj_Delete(nameText);
bEndTitleScene = true;
}
task TManualScene(){
//メニュー配置
let mx = GetScreenWidth()/2;
let my = 1*GetScreenHeight()/5;
bool bEndTitleScene = false;
int img_1 = _Create2DImage(dirLib ~ "NarumiSTG_Manual.png", [0, 0, 1280, 720]);
ascent(i in 0..1){
ObjSprite2D_SetDestCenter(img_1);
ObjRender_SetScaleXYZ(img_1, 1);
ObjRender_SetAlpha(img_1, 255);
Obj_SetRenderPriorityI(img_1, 3);
ObjRender_SetPosition(img_1, 1280/2, 720/2, 1);
Obj_SetValue(img_1, 'V', i);
}
//Obj_SetVisible(imgArcade, false);
//Obj_SetVisible(imgGentle, false);
let INDEX_1 = 0;
let selectIndex = 0;//選択位置
int countMenu = 1;
//キー状態がリセットされるまで待機
while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}
//メニュー選択処理
let frameKeyHold = 0;//キー押しっぱなしフレーム数
loop
{
// Visibility
if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){
TTitleScene();
break;
}
//カーソル移動
if(GetVirtualKeyState(VK_LEFT) == KEY_PUSH)
{
selectIndex--;
}
else if(GetVirtualKeyState(VK_RIGHT) == KEY_PUSH)
{
selectIndex++;
}
else if(GetVirtualKeyState(VK_LEFT) == KEY_HOLD)
{
frameKeyHold++;
if(frameKeyHold == 30 || (frameKeyHold > 30 && (frameKeyHold % 10 == 0)))
{
selectIndex--;
}
}
else if(GetVirtualKeyState(VK_RIGHT) == KEY_HOLD)
{
frameKeyHold++;
if(frameKeyHold == 30 || (frameKeyHold > 30 && (frameKeyHold % 10 == 0)))
{
selectIndex++;
}
}
else
{
frameKeyHold = 0;
}
if(selectIndex < 0)
{
selectIndex = countMenu - 1;
}
else
{
selectIndex %= countMenu;
}
yield;
}
bEndTitleScene = true;
Obj_Delete(img_1);
}