ScarletBlackMarket/script/Gay_Package.dnh

1229 lines
58 KiB
Plaintext

#東方弾幕風[Package]
#Title["be gay do crimes"]
#Text["NOOOO I DON'T WANNA MAKE MENUS *dies*"]
// Font installation: Anke Calligraph, Connecting Chain Handserif, Unispace, etc.
string pathPlayer = "";
string pathStage = "";
string[] PlayerArray =
["script/player/PrideJam_ByakMiko/ByakMiko_Main.dnh",
"script/player/PrideJam_RinnoRemi/RinnoRemi_Main.dnh"];
string[] StageArray =
["script/game/Stage_Arcade.dnh",
"script/game/Stage_Gentle.dnh"];
@Initialize
{
if(IsCommonDataAreaExists("PIV") == false){
CreateCommonDataArea("PIV");
SetAreaCommonData("PIV", "currentvalue", 10000);
}
else{
SetAreaCommonData("PIV", "currentvalue", 10000);
}
TInstallFont();
LanguageSelect();
BackgroundRendering();
let diffIndex = 0;
let playerIndex = 0;
}
let dirSystem = "script/KevinSystem/";
int lang = GetCommonData("Language", 0);
function TInstallFont{
// JP Text
InstallFont(dirSystem ~ "./font/FOT-NewCinemaAStd-D_1.otf");
InstallFont(dirSystem ~ "./font/Corporate-Logo-Rounded.otf");
// English Text
InstallFont(dirSystem ~ "./font/Revue Regular.ttf");
InstallFont(dirSystem ~ "./font/Uni Sans Heavy.otf");
InstallFont(dirSystem ~ "./font/Exotic 350 Demi Bold BT.ttf");
InstallFont(dirSystem ~ "./font/unispace rg.ttf");
InstallFont(dirSystem ~ "./font/Connecting Chain Handserif.ttf");
InstallFont(dirSystem ~ "./font/AnkeCall.ttf");
// Misc
InstallFont(dirSystem ~ "./font/origa___.ttf");
}
// Initialize common data: Configurations, high scores for difficulties and players
/* CONFIG
BGM Volume
Sound Volume
Starting Lives Setting (0 to 999) (but why would you want to set your starting lives to 0??????)
Background Opacity (255 to 0, disables background rendering if at 0)
Dialogue Skip Setting (ON/OFF)
*/
// Load/create common data for config
if(LoadCommonDataAreaA2("Config", "script/game/config.dat") == false){
CreateCommonDataArea("Config");
SetAreaCommonData("Config", "BGMVol", 100);
SetAreaCommonData("Config", "SEVol", 100);
SetAreaCommonData("Config", "StartingLife", 3);
SetAreaCommonData("Config", "BGOpacity", 100); // By percentage
SetAreaCommonData("Config", "DialogueSkip", 0); // 0: no, 1: yes
// v0.91a
SetAreaCommonData("Config", "PlayerShotOpacity", 60);
SetAreaCommonData("Config", "ItemOpacity", 60);
SaveCommonDataAreaA2("Config", "script/game/config.dat");
}else{
LoadCommonDataAreaA2("Config", "script/game/config.dat");
}
// To-do: Read from common data in the stage scripts
@MainLoop
{
lang = GetCommonData("Language", 0);
yield;
}
@Finalize
{
}
// Lol mkm
function CreateTextObject(
float mx, my, size,
string text, font,
int colorTop, colorBottom,
int borderColor, borderWidth,
int renderPriority
){
let obj = ObjText_Create();
ObjText_SetText(obj, text);
ObjText_SetFontSize(obj, size);
ObjText_SetFontType(obj, font);
ObjText_SetFontColorTop(obj, colorTop);
ObjText_SetFontColorBottom(obj, colorBottom);
ObjText_SetFontBorderType(obj, BORDER_FULL);
ObjText_SetFontBorderColor(obj, borderColor);
ObjText_SetFontBorderWidth(obj, borderWidth);
Obj_SetRenderPriorityI(obj, renderPriority);
ObjRender_SetX(obj, mx);
ObjRender_SetY(obj, my);
return obj;
}
function <int> _Create2DImage(imgpath, int[] rectarray){
int imgname = ObjPrim_Create(OBJ_SPRITE_2D);
ObjPrim_SetTexture(imgname, imgpath);
ObjSprite2D_SetSourceRect(imgname, rectarray);
ObjSprite2D_SetDestCenter(imgname);
//ObjRender_SetPosition(imgname, positionstart)
return imgname;
}
//----------------------------------------------------
// タイトルシーン
//----------------------------------------------------
task BackgroundRendering(){
int image = _Create2DImage("script/game/resourceLib/title.png", [0, 0, 1920, 1080]);
LoadTextureEx(image, true, true);
Obj_SetRenderPriorityI(image, 1);
ObjSprite2D_SetDestRect(image, 0, 0, 1920, 1080);
}
task LanguageSelect(){
let bEndTitleScene = false;
task TMenuItem(
let index,
float mx, my, size,
string text
)
{
let objText = CreateTextObject(
mx, my, size,
text, "コーポレート・ロゴ(ラウンド) ver2 Bold",
0xFFFFFF, 0xFFFFFF,
0xAA0E2B, size/10,
2
);
let objSelect = CreateTextObject(
mx, my, size,
text, "コーポレート・ロゴ(ラウンド) ver2 Bold",
0xFFFFFF, 0xFFFFFF,
0xAA0E2B, size/10,
2
);
//ObjText_SetMaxWidth(objText, GetScreenWidth());
ObjText_SetHorizontalAlignment(objText, ALIGNMENT_CENTER);
//ObjText_SetMaxWidth(objSelect, GetScreenWidth);
ObjText_SetHorizontalAlignment(objSelect, ALIGNMENT_CENTER);
ObjRender_SetBlendType(objSelect, BLEND_ADD_RGB);
while(!bEndTitleScene)
{
Obj_SetVisible(objSelect, index == selectIndex);
yield;
}
Obj_Delete(objText);
Obj_Delete(objSelect);
}
let INDEX_ENG = 0;
let INDEX_JP = 1;
let selectIndex = 0;//選択位置
//メニュー配置
let mx = GetScreenWidth()/2;
let my = 1*GetScreenHeight()/5;
let texts = ["English", "日本語"];
var countMenu = length(texts);
ascent(var iText in 0 .. countMenu)
{
TMenuItem(iText, mx, my, 90, texts[iText]);
my += 120;
}
//キー状態がリセットされるまで待機
while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}
//メニュー選択処理
let frameKeyHold = 0;//キー押しっぱなしフレーム数
loop
{
//決定
if(GetVirtualKeyState(VK_OK) == KEY_PUSH)
{
if(selectIndex == INDEX_ENG)
{
SetCommonData("Language", 0); // English
TTitleScene();
}
else if(selectIndex == INDEX_JP)
{
SetCommonData("Language", 1); // Japanese
TTitleScene();
}
break;
}
//カーソル移動
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;
}
yield;
}
bEndTitleScene = true;
}
task TTitleScene
{
//タイトルシーン終了フラグ
if(IsCommonDataAreaExists("PIV") == false){
CreateCommonDataArea("PIV");
SetAreaCommonData("PIV", "currentvalue", 10000);
}
else{
SetAreaCommonData("PIV", "currentvalue", 10000);
}
let bEndTitleScene = false;
//メニュー
task TMenuItem(
let index,
float mx, my, size,
string text
)
{
let objText = CreateTextObject(
mx, my, size,
text, "コーポレート・ロゴ(ラウンド) ver2 Bold",
0xFFFFFF, 0xFFFFFF,
0xAA0E2B, size/10,
2
);
let objSelect = CreateTextObject(
mx, my, size,
text, "コーポレート・ロゴ(ラウンド) ver2 Bold",
0xFFFFFF, 0xFFFFFF,
0xAA0E2B, size/10,
2
);
//ObjText_SetMaxWidth(objText, GetScreenWidth());
ObjText_SetHorizontalAlignment(objText, ALIGNMENT_CENTER);
//ObjText_SetMaxWidth(objSelect, GetScreenWidth);
ObjText_SetHorizontalAlignment(objSelect, ALIGNMENT_CENTER);
ObjRender_SetBlendType(objSelect, BLEND_ADD_RGB);
while(!bEndTitleScene)
{
Obj_SetVisible(objSelect, index == selectIndex);
yield;
}
Obj_Delete(objText);
Obj_Delete(objSelect);
}
let INDEX_START = 0;
let INDEX_REPLAY = 1;
let INDEX_CONFIG = 2;
let INDEX_QUIT = 3;
let selectIndex = 0;//選択位置
//メニュー配置
let mx = GetScreenWidth()/2;
let my = 3*GetScreenHeight()/5;
let texts = ["START GAME", "VIEW REPLAY", "OPTIONS", "END GAME"];
var countMenu = length(texts);
ascent(var iText in 0 .. countMenu)
{
TMenuItem(iText, mx, my, 48, texts[iText]);
my += 60;
}
//キー状態がリセットされるまで待機
while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}
//メニュー選択処理
let frameKeyHold = 0;//キー押しっぱなしフレーム数
loop
{
//決定
if(GetVirtualKeyState(VK_OK) == KEY_PUSH)
{
if(selectIndex == INDEX_START)
{
TDifficultySelect();
}
else if(selectIndex == INDEX_REPLAY)
{
TReplaySelectScene();
}
else if(selectIndex == INDEX_CONFIG)
{
TConfigScene();
}
else if(selectIndex == INDEX_QUIT)
{
ClosePackage();
}
break;
}
//カーソル移動
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;
}
yield;
}
bEndTitleScene = true;
}
// Configurations
task TConfigScene{
// Credit: Kobito
int image = _Create2DImage("script/game/PackageLib/PlaceholderTitleImage_Empty.png", [0, 0, 1920, 1080]);
LoadTextureEx(image, true, true);
Obj_SetRenderPriorityI(image, 1);
ObjRender_SetAlpha(image, 125);
ObjSprite2D_SetDestRect(image, 0, 0, 1920, 1080);
let bEndTitleScene = false;
// BGM, SE, Life, BG, Skip, PlayerShot, Item
let settingDefault = [100, 100, 3, 100, 0, 60, 60];
let setting = [0, 0, 0, 0, 0, 0, 0];
let settingMax = [100, 100, 999, 100, 1, 100, 100];
let holdInterval = [2, 2, 1, 2, 30, 2, 2];
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", "DialogueSkip", 0);
setting[5] = GetAreaCommonData("Config", "PlayerShotOpacity", 60);
setting[6] = GetAreaCommonData("Config", "ItemOpacity", 60);
let selectIndex = 0;
var countMenu = 8;
let texts = [0, 0, 0, 0, 0, 0, 0, 0];
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()/5;
float my = 2*GetScreenHeight()/12;
ascent(i in 0..8){texts[i] = TMenuItem(i, mx, my+i*GetScreenHeight()/12, 45, "");}
ObjText_SetText(texts[7], "Reset to Default");
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:", "Dialogue/Cutscenes:", "Player Shot Opacity:", "Item Opacity: "],
["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]));
alternative(setting[2])
case(3){ObjText_SetText(texts[2], configText[lang][2]~" " ~ IntToString(setting[2]) ~ " (Default)");}
case(69){ObjText_SetText(texts[2], configText[lang][2]~" " ~ IntToString(setting[2]) ~ " (Nice)");}
case(420){ObjText_SetText(texts[2], configText[lang][2]~" " ~ IntToString(setting[2]) ~ " (Don't Do Drugs)");}
others{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]~" ON");}
case(1){ObjText_SetText(texts[4], configText[lang][4]~" OFF");}
alternative(setting[5])
case(0){ObjText_SetText(texts[5], configText[lang][5]~" " ~ IntToString(setting[5]) ~ " (なんで????)");}
case(60){ObjText_SetText(texts[5],configText[lang][5]~" " ~ IntToString(setting[5]) ~ " (Recommended)");}
case(100){ObjText_SetText(texts[5],configText[lang][5]~" " ~ IntToString(setting[5]) ~ " (Eye-Blinding)");}
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]) ~ " (Why????)");}
case(60){ObjText_SetText(texts[6], configText[lang][6]~" " ~ IntToString(setting[6]) ~ " (Recommended)");}
case(100){ObjText_SetText(texts[6], configText[lang][6]~" " ~ IntToString(setting[6]) ~ " (Eye-Blinding)");}
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)){
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)){
ChangeSetting(selectIndex, -1);
}
}
if(selectIndex == 7 && GetVirtualKeyState(VK_OK) == KEY_PUSH){
ascent(i in -1..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", "DialogueSkip", setting[4]);
SetAreaCommonData("Config", "PlayerShotOpacity", setting[5]);
SetAreaCommonData("Config", "ItemOpacity", setting[6]);
//SetSoundDivisionVolumeRate(SOUND_BGM, GetAreaCommonData("Config", "BGMVol", 100)*0.01);
//SetSoundDivisionVolumeRate(SOUND_SE, GetAreaCommonData("Config", "SEVol", 100)*0.01);
yield;
}
SaveCommonDataAreaA2("Config", "script/game/config.dat");
bEndTitleScene = true;
Obj_Delete(image);
}
//----------------------------------------------------
// ステージシーン
//----------------------------------------------------
task TDifficultySelect(){
bool bEndTitleScene = false;
//Obj_SetVisible(imgArcade, false);
//Obj_SetVisible(imgGentle, false);
task TMenuItem(
let index,
float mx, my, size,
string text
)
{
let objText = CreateTextObject(
mx, my, size,
text, "コーポレート・ロゴ(ラウンド) ver2 Bold",
0xFFFFFF, 0xFFFFFF,
0xAA0E2B, size/10,
2
);
let objSelect = CreateTextObject(
mx, my, size,
text, "コーポレート・ロゴ(ラウンド) ver2 Bold",
0xFFFFFF, 0xFFFFFF,
0xAA0E2B, size/10,
2
);
//ObjText_SetMaxWidth(objText, GetScreenWidth());
ObjText_SetHorizontalAlignment(objText, ALIGNMENT_CENTER);
//ObjText_SetMaxWidth(objSelect, GetScreenWidth);
ObjText_SetHorizontalAlignment(objSelect, ALIGNMENT_CENTER);
ObjRender_SetBlendType(objSelect, BLEND_ADD_RGB);
while(!bEndTitleScene)
{
Obj_SetVisible(objSelect, false);
Obj_SetVisible(objText, false);
yield;
}
Obj_Delete(objText);
Obj_Delete(objSelect);
}
let INDEX_NORMAL = 0;
let INDEX_HARD = 1;
let INDEX_LUNATIC = 2;
let selectIndex = 0;//選択位置
//メニュー配置
let mx = GetScreenWidth()/3;
let my = 2*GetScreenHeight()/5;
let texts = ["Arcade Mode", "Gentle Mode"];
var countMenu = length(texts);
ascent(var iText in 0 .. countMenu)
{
TMenuItem(iText, mx, my, 65, texts[iText]);
mx *= 2;
}
//キー状態がリセットされるまで待機
while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}
//メニュー選択処理
let frameKeyHold = 0;//キー押しっぱなしフレーム数
loop
{
if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){
TTitleScene();
break;
}
else if(GetVirtualKeyState(VK_OK) == KEY_PUSH)
{
if(selectIndex == INDEX_NORMAL)
{
SetCommonData("Difficulty", "Normal");
TPlayerSelect();
}
else if(selectIndex == INDEX_HARD)
{
SetCommonData("Difficulty", "Hard");
TPlayerSelect();
}
else if(selectIndex == INDEX_LUNATIC)
{
SetCommonData("Difficulty", "Lunatic");
TPlayerSelect();
}
break;
}
//カーソル移動
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;
}
yield;
}
bEndTitleScene = true;
Obj_Delete(image);
}
task TPlayerSelect(){
bool bEndTitleScene = false;
int image = _Create2DImage("script/game/PackageLib/PlaceholderTitleImage_Player.png", [0, 0, 1920, 1080]);
LoadTextureEx(image, true, true);
Obj_SetRenderPriorityI(image, 1);
ObjSprite2D_SetDestRect(image, 0, 0, 1920, 1080);
int imgByakMiko = _Create2DImage("script/game/PackageLib/ByakMiko_Select.png", [0, 0, 1800, 1080]);
LoadTextureEx(imgByakMiko, true, true);
Obj_SetRenderPriorityI(imgByakMiko, 2);
ObjRender_SetPosition(imgByakMiko, GetScreenWidth()/2, 2*GetScreenHeight()/5+120, 0);
ObjRender_SetScaleXYZ(imgByakMiko, 0.84);
int imgRinnoRemi = _Create2DImage("script/game/PackageLib/RinnoRemi_Select.png", [0, 0, 1800, 1080]);
LoadTextureEx(imgRinnoRemi, true, true);
Obj_SetRenderPriorityI(imgRinnoRemi, 2);
ObjRender_SetPosition(imgRinnoRemi, GetScreenWidth()/2, 2*GetScreenHeight()/5+120, 0);
ObjRender_SetScaleXYZ(imgRinnoRemi, 0.84);
Obj_SetVisible(imgByakMiko, false);
Obj_SetVisible(imgRinnoRemi, false);
task TMenuItem(
let index,
float mx, my, size,
string text
)
{
let objText = CreateTextObject(
mx, my, size,
text, "Unispace",
0xFFFFFF, 0xFFFFFF,
0xAA0E2B, size/10,
2
);
let objSelect = CreateTextObject(
mx, my, size,
text, "Unispace",
0xFFFFFF, 0xFFFFFF,
0xAA0E2B, size/10,
2
);
//ObjText_SetMaxWidth(objText, GetScreenWidth());
ObjText_SetHorizontalAlignment(objText, ALIGNMENT_CENTER);
//ObjText_SetMaxWidth(objSelect, GetScreenWidth);
ObjText_SetHorizontalAlignment(objSelect, ALIGNMENT_CENTER);
ObjRender_SetBlendType(objSelect, BLEND_ADD_RGB);
while(!bEndTitleScene)
{
Obj_SetVisible(objSelect, false);
Obj_SetVisible(objText, false);
yield;
}
Obj_Delete(objText);
Obj_Delete(objSelect);
}
let INDEX_BYAKMIKO = 0;
let INDEX_RINNOREMI = 1;
let selectIndex = 0;//選択位置
//メニュー配置
let mx = GetScreenWidth()/3;
let my = 2*GetScreenHeight()/5;
let texts = ["Byakuren Hijiri &[r]Toyosatomimi no Miko", "Rinnosuke Morichika &[r]Remilio Scarlet"];
var countMenu = length(texts);
ascent(var iText in 0 .. countMenu)
{
TMenuItem(iText, mx, my, 35, texts[iText]);
mx *= 2;
}
//キー状態がリセットされるまで待機
while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}
//メニュー選択処理
let frameKeyHold = 0;//キー押しっぱなしフレーム数
loop
{
if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){
TTitleScene();
break;
}
else if(GetVirtualKeyState(VK_OK) == KEY_PUSH)
{
if(selectIndex == INDEX_BYAKMIKO)
{
pathPlayer = PlayerArray[0];
TStageScene("", pathStage, pathPlayer, GetAreaCommonData("Config", "StartingLife", 5), GetAreaCommonData("Config", "DialogueSkip", 0), false);
}
else if(selectIndex == INDEX_RINNOREMI)
{
pathPlayer = PlayerArray[1];
TStageScene("", pathStage, pathPlayer, GetAreaCommonData("Config", "StartingLife", 5), GetAreaCommonData("Config", "DialogueSkip", 0), false);
}
break;
}
if(selectIndex == INDEX_BYAKMIKO)
{
Obj_SetVisible(imgByakMiko, true);
Obj_SetVisible(imgRinnoRemi, false);
}
else if(selectIndex == INDEX_RINNOREMI)
{
Obj_SetVisible(imgRinnoRemi, true);
Obj_SetVisible(imgByakMiko, false);
}
//カーソル移動
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(image);
Obj_Delete(imgByakMiko);
Obj_Delete(imgRinnoRemi);
}
task TStageScene(let pathReplay, let pathDifficulty, let pathPlayer, let pathLives, let modeDialog, bool isRetry)
{
let dirCurrent = GetCurrentScriptDirectory();
let dirModule = GetModuleDirectory();
if(IsCommonDataAreaExists("PIV") == false){
CreateCommonDataArea("PIV");
SetAreaCommonData("PIV", "currentvalue", 10000);
}
else{
SetAreaCommonData("PIV", "currentvalue", 10000);
}
//--------------------------------
//画面遷移
RenderSceneToTransitionTexture();
TTransition();
//--------------------------------
//ステージ初期化
InitializeStageScene();
if(length(pathReplay) > 0)
{
SetStageReplayFile(pathReplay);
}
//--------------------------------
//初期ステージ設定
let indexStage = 0; //ステージインデックス
SetStageIndex(indexStage);
SetStageMainScript(pathDifficulty);
SetStagePlayerScript("script/player/Chimata/Chimata_Main.dnh");
SetCommonData("Starting Lives", pathLives);
if(!isRetry){SetCommonData("Dialogue Skip Mode", modeDialog);}
else{}
StartStageScene();
//--------------------------------
//ステージ操作
loop
{
//--------------------------------
//一時停止チェック
if(GetVirtualKeyState(VK_PAUSE) == KEY_PUSH)
{
let resPause = RunPauseScene();
alternative(resPause)
case(RESULT_RETRY)
{
//最初からやり直す
if(!IsReplay())
{
//リトライ
TerminateStageScene();
TStageScene("", pathStage, pathPlayer, GetAreaCommonData("Config", "StartingLife", 3), GetAreaCommonData("Config", "Dialogue Skip Mode", 0), true);
return;
}
}
case(RESULT_END)
{
//一時停止中の終了
TerminateStageScene();
}
}
if(!IsReplay() && GetKeyState(KEY_BACK) == KEY_PUSH)
{
//リトライ
TerminateStageScene();
TStageScene("", pathStage, pathPlayer, GetAreaCommonData("Config", "StartingLife", 3), GetAreaCommonData("Config", "Dialogue Skip Mode", 0), true);
return;
}
//--------------------------------
//ステージ完了待ち
let stgSceneState = GetStageSceneState();
if(stgSceneState == STAGE_STATE_FINISHED)
{
//ステージ終了結果を取得
let stageResult = GetStageSceneResult();
alternative(stageResult)
case(STAGE_RESULT_CLEARED)
{
TEndScene();
break;
}
case(STAGE_RESULT_PLAYER_DOWN)
{
//自機残機0
TEndScene();
break;
}
case(STAGE_RESULT_BREAK_OFF)
{
TTitleScene();
break;
}
}
yield;
}
TTransition();
}
//----------------------------------------------------
// 終了シーン
//----------------------------------------------------
task TEndScene()
{
if(IsReplay())
{
TTitleScene();
return;
}
//--------------------------------
//ステージ終了処理
FinalizeStageScene();
//--------------------------------
//終了シーンスクリプト起動
let dirModule = GetModuleDirectory();
let pathScript = "script/KevinSystem/kevin_system/Kevin_EndScene.txt";
let idScript = LoadScript(pathScript);
StartScript(idScript);
while(!IsCloseScript(idScript))
{
yield;
}
//--------------------------------
//終了シーン結果処理
let result = GetScriptResult(idScript);
alternative(result)
case(RESULT_SAVE_REPLAY)
{
//リプレイ保存
TReplaySaveScene();
}
case(RESULT_END)
{
//再生終了
TTitleScene();
}
case(RESULT_RETRY)
{
//リトライ
TStageScene("", pathStage, pathPlayer, GetAreaCommonData("Config", "StartingLife", 5), GetAreaCommonData("DialogueSkip", 0), true);
}
}
//----------------------------------------------------
// 一時停止シーン
//----------------------------------------------------
function RunPauseScene()
{
RenderSceneToTransitionTexture();
PauseStageScene(true);
let dirModule = GetModuleDirectory();
let pathScript = "script/KevinSystem/kevin_system/Kevin_Pause.txt";
//--------------------------------
//一時停止シーンンスクリプト起動
let idScript = LoadScript(pathScript);
StartScript(idScript);
while(!IsCloseScript(idScript))
{
yield;
}
PauseStageScene(false);
let res = GetScriptResult(idScript);
return res;
}
//----------------------------------------------------
// リプレイ選択シーン
//----------------------------------------------------
task TReplaySelectScene()
{
LoadReplayList();
let dirCurrent = GetCurrentScriptDirectory();
let pathScript = "script/ExRumia/ExRumia_Package_ReplaySelectScene.txt";
//--------------------------------
//リプレイ選択シーンスクリプト起動
let idScript = LoadScript(pathScript);
StartScript(idScript);
while(!IsCloseScript(idScript))
{
yield;
}
//--------------------------------
//リプレイ選択シーン結果処理
LoadReplayList();
let result = GetScriptResult(idScript);
let resultStage, resultTeam;
if(result == 99999999*69420)
{
//タイトルシーンへ戻る
TTitleScene();
}
else
{
let resultPath = GetReplayInfo(result, REPLAY_FILE_PATH);
if(GetReplayUserData(result, "Difficulty") == "Arcade"){resultStage = StageArray[0]; SetCommonData("Difficulty", "Arcade");}
else{resultStage = StageArray[1]; SetCommonData("Difficulty", "Gentle");}
if(GetReplayInfo(result, REPLAY_PLAYER_NAME) == "ByakMiko"){resultTeam = PlayerArray[0];}
else{resultTeam = PlayerArray[1];}
//リプレイ再生開始
TStageScene(resultPath,
resultStage,
resultTeam,
GetReplayUserData(result, "Starting Lives"),
GetReplayUserData(result, "Dialogue Skip"),
false
);
}
}
//----------------------------------------------------
// リプレイ保存シーン
//----------------------------------------------------
task TReplaySaveScene()
{
LoadReplayList();
let dirModule = GetModuleDirectory();
let pathScript = dirModule ~ "script/KevinSystem/kevin_system/Kevin_ReplaySave.txt";
//--------------------------------
//リプレイ保存シーンスクリプト起動
let idScript = LoadScript(pathScript);
StartScript(idScript);
while(!IsCloseScript(idScript))
{
yield;
}
//--------------------------------
//タイトルシーンへ遷移
TTitleScene();
}
//----------------------------------------------------
// 画面遷移エフェクト
//----------------------------------------------------
function RenderSceneToTransitionTexture()
{
//現在のシーン内容を画面遷移用テクスチャに描画
let textureName = GetTransitionRenderTargetName();
RenderToTextureA1(textureName, 0, 100, true);
}
task TTransition
{
let textureName = GetTransitionRenderTargetName();
let objImage = ObjPrim_Create(OBJ_SPRITE_2D); //2Dスプライトオブジェクト生成
Obj_SetRenderPriorityI(objImage, 100); //描画優先度を設定
ObjPrim_SetTexture(objImage, textureName); //テクスチャを設定
ObjSprite2D_SetSourceRect(objImage, 0, 0, 1920, 1080);
ObjSprite2D_SetDestRect(objImage, 0, 0, 1920, 1080);
let alpha = 255;
while(alpha > 0)
{
ObjRender_SetAlpha(objImage, alpha);
alpha -= 16;
yield;
}
Obj_Delete(objImage);
}