ScarletBlackMarket/KevinSystem/kevin_system/Kevin_ReplaySave.txt

422 lines
10 KiB
Plaintext
Raw Normal View History

//リプレイ保存スクリプト
int STGWIDTH = GetStgFrameWidth();
int STGHEIGHT = GetStgFrameHeight();
@Initialize
{
SetAutoDeleteObject(true);
LoadReplayList();
TBackgroundNew(0, 0);
TReplayIndexSelection();
}
@MainLoop
{
yield;
}
@Finalize
{
}
let MENU_INDEX_SELECTION = 1;
let MENU_NAME_ENTRY = 2;
let menuMode = MENU_INDEX_SELECTION;
function CreateTextObject(let mx, let my, float size, let text)
{
let obj = ObjText_Create();
ObjText_SetText(obj, text);
ObjText_SetFontSize(obj, size);
ObjText_SetFontType(obj, "Unispace");
ObjText_SetFontBold(obj, true);
ObjText_SetHorizontalAlignment(obj, ALIGNMENT_LEFT);
//ObjText_SetMaxWidth(obj, STGWIDTH);
ObjText_SetFontColorTop(obj, 155, 45, 175);
ObjText_SetFontColorBottom(obj, 200, 80, 255);
ObjText_SetFontBorderType(obj, BORDER_FULL);
ObjText_SetFontBorderColor(obj, 255, 255, 255);
ObjText_SetFontBorderWidth(obj, 3);
Obj_SetRenderPriorityI(obj, 10);
ObjRender_SetX(obj, mx);
ObjRender_SetY(obj, my);
return obj;
}
// renderX and renderY will be TOP-LEFT COORDS
task TBackgroundNew(float renderX, renderY){
let obj = ObjPrim_Create(OBJ_SPRITE_2D);
Obj_SetRenderPriorityI(obj, 1);
let currentFrameTexture = GetTransitionRenderTargetName();
ObjPrim_SetTexture(obj, currentFrameTexture);
ObjSprite2D_SetSourceRect(obj, 0, 0, GetScreenWidth(), GetScreenHeight());
ObjSprite2D_SetDestRect(obj, 0, 0, GetScreenWidth(), GetScreenHeight());
ObjRender_SetColor(obj, 0x593DA3);
}
task TReplayIndexSelection()
{
let cursorY = 0;
let page = 0;
let countMaxItem = REPLAY_INDEX_DIGIT_MAX - REPLAY_INDEX_DIGIT_MIN + 1;
let countItemPerPage = 20;
let pageMax = trunc((countMaxItem - 1) / countItemPerPage);
pageMax = max(pageMax, 1);
let lastPageMaxCursorY = trunc(countMaxItem / countItemPerPage);
task TMenuItem(let itemY)
{
let objText = CreateTextObject(90, 45 + 50 * itemY, 35, "");
let objSelect = CreateTextObject(90, 45 + 50 * itemY, 35, "");
ObjRender_SetAlpha(objText, 125);
ObjRender_SetAlpha(objSelect, 80);
ObjRender_SetBlendType(objSelect, BLEND_ADD_ARGB);
let oldPage = -1;
while(menuMode == MENU_INDEX_SELECTION)
{
if(page != oldPage)
{
let index = page * countItemPerPage + itemY + 1;
let text = rtos("00", index) ~ " ";
if(IsValidReplayIndex(index))
{
text = text ~ vtos("-8s", GetReplayInfo(index, REPLAY_USER_NAME)) ~ " ";
text = text ~ GetReplayInfo(index, REPLAY_DATE_TIME) ~ " ";
text = text ~ rtos("000000000000", GetReplayInfo(index, REPLAY_TOTAL_SCORE)) ~ " ";
text = text ~ GetReplayInfo(index, REPLAY_PLAYER_NAME) ~ " ";
text = text ~ GetReplayUserData(index, "Difficulty");
/*SetReplayUserData("Starting Lives", GetCommonData("Starting Lives Selected", 5));
SetReplayUserData("Player Team", GetReplayInfo(index, REPLAY_PLAYER_NAME));
SetReplayUserData("Difficulty", GetCommonData("Difficulty", "Arcade"));*/
}
else
{
text = text ~ "Entry Blank";
}
ObjText_SetText(objText, text);
ObjText_SetText(objSelect, text);
oldPage = page;
}
if(page == pageMax && itemY >= lastPageMaxCursorY)
{
Obj_SetVisible(objText, false);
Obj_SetVisible(objSelect, false);
}
else
{
Obj_SetVisible(objText, true);
Obj_SetVisible(objSelect, itemY == cursorY);
}
yield;
}
Obj_Delete(objText);
Obj_Delete(objSelect);
}
ascent(let iItem in 0 .. countItemPerPage)
{
TMenuItem(iItem);
}
//キー状態がリセットされるまで待機
while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}
//キー処理
let frameKeyHold = 0;//キー押しっぱなしフレーム数
while(menuMode == MENU_INDEX_SELECTION)
{
//決定
if(GetVirtualKeyState(VK_OK) == KEY_PULL)
{
menuMode = MENU_NAME_ENTRY;
let index = page * countItemPerPage + cursorY + 1;
TNameEntry(index);
break;
}
if(GetVirtualKeyState(VK_CANCEL) == KEY_PUSH){
SetScriptResult(RESULT_END);
CloseScript(GetOwnScriptID());
}
//カーソル移動
if(GetVirtualKeyState(VK_UP) == KEY_PUSH || GetVirtualKeyState(VK_UP) == KEY_HOLD)
{
frameKeyHold++;
if(GetVirtualKeyState(VK_UP) == KEY_PUSH ||
frameKeyHold == 20 ||
(frameKeyHold > 20 && (frameKeyHold % 10 == 0)))
{
cursorY--;
}
}
else if(GetVirtualKeyState(VK_DOWN) == KEY_PUSH || GetVirtualKeyState(VK_DOWN) == KEY_HOLD)
{
frameKeyHold++;
if(GetVirtualKeyState(VK_DOWN) == KEY_PUSH ||
frameKeyHold == 20 ||
(frameKeyHold > 20 && (frameKeyHold % 10 == 0)))
{
cursorY++;
}
}
else if(GetVirtualKeyState(VK_LEFT) == KEY_PUSH || GetVirtualKeyState(VK_LEFT) == KEY_HOLD)
{
frameKeyHold++;
if(GetVirtualKeyState(VK_LEFT) == KEY_PUSH ||
frameKeyHold == 20 ||
(frameKeyHold > 20 && (frameKeyHold % 10 == 0)))
{
page--;
}
}
else if(GetVirtualKeyState(VK_RIGHT) == KEY_PUSH || GetVirtualKeyState(VK_RIGHT) == KEY_HOLD)
{
frameKeyHold++;
if(GetVirtualKeyState(VK_RIGHT) == KEY_PUSH ||
frameKeyHold == 20 ||
(frameKeyHold > 20 && (frameKeyHold % 10 == 0)))
{
page++;
}
}
else
{
frameKeyHold = 0;
}
if(page < 0)
{
page = pageMax;
}
else if(page > pageMax)
{
page = 0;
}
if(page != pageMax)
{
if(cursorY < 0)
{
cursorY = countItemPerPage - 1;
}
else if(cursorY >= countItemPerPage)
{
cursorY = 0;
}
}
else
{
if(cursorY < 0)
{
cursorY = lastPageMaxCursorY - 1;
}
else if(cursorY >= lastPageMaxCursorY)
{
cursorY = 0;
}
}
yield;
}
}
task TNameEntry(let replayIndex)
{
let strTextIn =
[
["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P"],
["Q","R","S","T","U","V","W","X","Y","Z",".",",",":",";","_","@"],
["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p"],
["q","r","s","t","u","v","w","x","y","z","+","-","/","*","=","%"],
["0","1","2","3","4","5","6","7","8","9","0","!","?","'","\"","$"],
["(",")","{","}","[","]","<",">","&","#","|","~","^"," "," ","終"]
];
let strTextView =
[
["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P"],
["Q","R","S","T","U","V","W","X","Y","Z",".",",",":",";","_","@"],
["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p"],
["q","r","s","t","u","v","w","x","y","z","+","-","/","*","=","%"],
["0","1","2","3","4","5","6","7","8","9","0","!","?","'","\"","$"],
["(",")","{","}","&osb;","&csb;","<",">","&","#","|","~","^"," "," ","»"]
];
let cursorX = 0;
let cursorY = 0;
let maxCursorX = length(strTextIn[0]);
let maxCursorY = length(strTextIn);
task TMenuItem(let itemX, let itemY)
{
let objText = CreateTextObject(360 + GetStgFrameWidth()/4 + itemX * 42, 400 + itemY * 42, 40, strTextView[itemY][itemX]);
let objSelect = CreateTextObject(360 + GetStgFrameWidth()/4+ itemX * 42, 400 + itemY * 42, 40, strTextView[itemY][itemX]);
ObjRender_SetBlendType(objSelect, BLEND_ADD_ARGB);
while(menuMode == MENU_NAME_ENTRY)
{
Obj_SetVisible(objSelect, itemX == cursorX && itemY == cursorY);
yield;
}
Obj_Delete(objText);
Obj_Delete(objSelect);
}
ascent(let iY in 0..maxCursorY)
{
ascent(let iX in 0 .. maxCursorX)
{
TMenuItem(iX, iY);
}
}
//キー状態がリセットされるまで待機
while(GetVirtualKeyState(VK_OK) != KEY_FREE){yield;}
//入力済み文字
let userName = "";
let objName = CreateTextObject(360+GetStgFrameWidth()/4, 200, 45, "");
task TNameCursor()
{
let objCursor = CreateTextObject(360+GetStgFrameWidth()/4, 200, 45, "_");
while(menuMode == MENU_NAME_ENTRY)
{
let nameLength = length(userName);
ObjRender_SetX(objCursor, 360+GetStgFrameWidth()/4 + nameLength * 30);
Obj_SetVisible(objCursor, nameLength < 8);
yield;
}
Obj_Delete(objCursor);
}
TNameCursor;
//キー処理
let frameKeyHold = 0;//キー押しっぱなしフレーム数
while(menuMode == MENU_NAME_ENTRY)
{
if(GetVirtualKeyState(VK_OK) == KEY_PULL)
{
//決定
let nameLength = length(userName);
if(cursorX == maxCursorX-1 && cursorY == maxCursorY-1)
{
//終了キー
if(nameLength == 0)
{
userName = "Gay";
}
else
{
SetReplayUserData("Starting Lives", GetCommonData("Starting Lives Selected", 5));
SetReplayUserData("Player Team", GetCommonData("Player Team", "ByakMiko"));
SetReplayUserData("Difficulty", GetCommonData("Difficulty", "Arcade"));
SetReplayUserData("Dialogue Skip", GetCommonData("Dialogue Skip Mode", 0));
SaveReplay(replayIndex, userName);
SetScriptResult(RESULT_END);
CloseScript(GetOwnScriptID());
return;
}
}
else if(nameLength < 8)
{
userName = userName ~ strTextIn[cursorY][cursorX];
}
}
if(GetVirtualKeyState(VK_CANCEL) == KEY_PULL)
{
//キャンセル
let nameLength = length(userName);
if(nameLength > 0)
{
userName = userName[0..nameLength-1];
}
else{menuMode = MENU_INDEX_SELECTION; TReplayIndexSelection(); break;}
}
ObjText_SetText(objName, userName);
//カーソル移動
if(GetVirtualKeyState(VK_UP) == KEY_PUSH || GetVirtualKeyState(VK_UP) == KEY_HOLD)
{
frameKeyHold++;
if(GetVirtualKeyState(VK_UP) == KEY_PUSH ||
frameKeyHold == 20 ||
(frameKeyHold > 20 && (frameKeyHold % 10 == 0)))
{
cursorY--;
}
}
else if(GetVirtualKeyState(VK_DOWN) == KEY_PUSH || GetVirtualKeyState(VK_DOWN) == KEY_HOLD)
{
frameKeyHold++;
if(GetVirtualKeyState(VK_DOWN) == KEY_PUSH ||
frameKeyHold == 20 ||
(frameKeyHold > 20 && (frameKeyHold % 10 == 0)))
{
cursorY++;
}
}
else if(GetVirtualKeyState(VK_LEFT) == KEY_PUSH || GetVirtualKeyState(VK_LEFT) == KEY_HOLD)
{
frameKeyHold++;
if(GetVirtualKeyState(VK_LEFT) == KEY_PUSH ||
frameKeyHold == 20 ||
(frameKeyHold > 20 && (frameKeyHold % 10 == 0)))
{
cursorX--;
}
}
else if(GetVirtualKeyState(VK_RIGHT) == KEY_PUSH || GetVirtualKeyState(VK_RIGHT) == KEY_HOLD)
{
frameKeyHold++;
if(GetVirtualKeyState(VK_RIGHT) == KEY_PUSH ||
frameKeyHold == 20 ||
(frameKeyHold > 20 && (frameKeyHold % 10 == 0)))
{
cursorX++;
}
}
else
{
frameKeyHold = 0;
}
if(cursorX < 0)
{
cursorX = maxCursorX-1;
}
else if(cursorX >= maxCursorX)
{
cursorX = 0;
}
if(cursorY < 0)
{
cursorY = maxCursorY-1;
}
else if(cursorY >= maxCursorY)
{
cursorY = 0;
}
yield;
}
}