このサンプルでは以下の処理を行っています。
- フレームアニメーション中、ローディング中、曲名表示、最低3秒間曲名表示待ち、ゲーム中、終了待ち、フェードアウトをステートで管理
- メインゲーム画面が開始されたらフレームアニメーションを開始する
SINGLE
DOUBLE
※このアニメーション内にはレーン背景画像が含まれており、アニメーション中はこれを表示することでレーンがアニメーションしているように見せておき、
アニメーションが完了したらレーンの無いフレームに移動して、システムレーンを表示するようにしている(システムレーンはスクリプト定数で設定した位置とサイズ固定のため)
- ローディング中のタイトル表示とロードゲージメーター制御(左の進行メーターを兼用)
- ゲーム画面
- フルコンボアニメ
- フェードアウトしてメインゲームを終了する
- ゲーム中のスクロールスピードの制御
ゲーム部分の処理
MNST_START = 0;
MNST_LOADING = 1;
MNST_TITLE = 2;
MNST_WAIT = 3;
MNST_GAME = 4;
MNST_END = 5;
MNST_FINISH = 6;
MN_BASEPOS_X = 1280 / 2;
MN_TITLEPOS_Y = 220;
MN_TITLEWIDTH = 640;
MN_TITLEHEIGHT = 80;
MN_GENREPOS_Y = 160;
MN_GENREWIDTH = 240;
MN_GENREHEIGHT = 20;
MN_ARTISTPOS_Y = 420;
MN_ARTISTWIDTH = 200;
MN_ARTISTHEIGHT = 32;
MN_STAGEFILE_WIDTH = 640;
MN_STAGEFILE_HEIGHT = 480;
MN_BACKBMP_WIDTH = 480;
MN_BACKBMP_HEIGHT = 480;
mn_pid_gauge0 = 0;
mn_pid_gauge1 = 1;
mn_pid_lv_err = 2;
mn_pid_lv_num0 = 3;
mn_pid_lv_num1 = 4;
mn_pid_lv_num2 = 5;
mn_pid_num_g = 6;
mn_pid_num_g2 = 7;
mn_pid_num_mill = 8;
mn_pid_num_normal = 9;
mn_pid_num_small = 10;
mn_pid_num_w = 11;
mn_pid_num_wide = 12;
mn_pid_stg_1st = 13;
mn_pid_stg_2nd = 14;
mn_pid_stg_3rd = 15;
mn_pid_stg_num = 16;
mn_pid_stg_th = 17;
mn_pid_str_level0 = 18;
mn_pid_str_level1 = 19;
mn_pid_str_level2 = 20;
mn_pid_str_level3 = 21;
mn_pid_GREAT1 = 30;
mn_pid_GREAT2 = 31;
mn_pid_GREAT3 = 32;
mn_pid_GREAT4 = 33;
mn_pid_GOOD = 34;
mn_pid_POOR = 35;
mn_pid_BAD = 36;
mn_pid_NUM_WHITE = 37;
mn_pid_NUM_BLUE = 38;
mn_pid_NUM_RED = 39;
mn_pid_NUM_YELLOW = 40;
g_dwMainState = MNST_START;
g_bLoadComplete = FALSE;
g_iLoadPercent = 0;
g_iTitleFadeCount = 0;
g_dwWaitTitleTime = 0;
g_bGameOver = FALSE;
g_iJadgeMode = { -1,-1 };
g_iJadgeCount = { 0,0 };
g_iJadgeType = { 0,0 };
g_iJadgeCombo = { 0,0 };
MN_SCRPOS_X1 = { 306,974,640 };
MN_SCRPOS_Y1 = { 343,343,-480 };
MN_SCRPOS_X2 = { 370,910,640 };
MN_SCRPOS_Y2 = { 343,343,180 };
MN_SCRPOS_FRAME = 8;
g_bScrPos = FALSE;
g_iScrPosFrame = 0;
function OnStartMainGame()
g_dwMainState = MNST_START;
g_bLoadComplete = FALSE;
g_iLoadPercent = 0;
g_iTitleFadeCount = 0;
g_dwWaitTitleTime = 0;
g_bGameOver = FALSE;
g_iJadgeMode = { -1,-1 };
g_iJadgeCount = { 0,0 };
g_iJadgeType = { 0,0 };
g_iJadgeCombo = { 0,0 };
g_bScrPos = FALSE;
g_iScrPosFrame = 0;
hdxLoadImage( 0,"mn_object.tga" );
hdxLoadImage( 1,"mn_jadge.tga" );
hdxSetPutRange( mn_pid_gauge0 ,0, 472,24,6,24,0,0 );
hdxSetPutRange( mn_pid_gauge1 ,0, 504,0,6,24,0,0 );
hdxSetPutRange( mn_pid_lv_err ,0, 464,0,40,18,0,0 );
hdxSetPutRange( mn_pid_lv_num0 ,0, 216,88,240,18,0,0 );
hdxSetPutRange( mn_pid_lv_num1 ,0, 216,112,240,18,0,0 );
hdxSetPutRange( mn_pid_lv_num2 ,0, 0,136,240,18,0,0 );
hdxSetPutRange( mn_pid_num_g ,0, 0,88,216,20,0,0 );
hdxSetPutRange( mn_pid_num_g2 ,0, 360,24,72,8,0,0 );
hdxSetPutRange( mn_pid_num_mill ,0, 432,24,14,7,0,0 );
hdxSetPutRange( mn_pid_num_normal ,0, 0,32,300,26,0,0 );
hdxSetPutRange( mn_pid_num_small ,0, 304,32,168,14,0,0 );
hdxSetPutRange( mn_pid_num_w ,0, 0,112,216,20,0,0 );
hdxSetPutRange( mn_pid_num_wide ,0, 0,0,360,26,0,0 );
hdxSetPutRange( mn_pid_stg_1st ,0, 312,72,70,16,0,0 );
hdxSetPutRange( mn_pid_stg_2nd ,0, 416,64,78,16,0,0 );
hdxSetPutRange( mn_pid_stg_3rd ,0, 416,48,78,16,0,0 );
hdxSetPutRange( mn_pid_stg_num ,0, 0,64,312,20,0,0 );
hdxSetPutRange( mn_pid_stg_th ,0, 456,80,52,20,0,0 );
hdxSetPutRange( mn_pid_str_level0 ,0, 360,0,100,18,0,0 );
hdxSetPutRange( mn_pid_str_level1 ,0, 312,48,100,18,0,0 );
hdxSetPutRange( mn_pid_str_level2 ,0, 240,136,100,18,0,0 );
hdxSetPutRange( mn_pid_str_level3 ,0, 344,136,100,18,0,0 );
hdxSetPutRange( mn_pid_GREAT1 ,1, 0,0,160,54,0,0 );
hdxSetPutRange( mn_pid_GREAT2 ,1, 160,0,160,54,0,0 );
hdxSetPutRange( mn_pid_GREAT3 ,1, 320,0,160,54,0,0 );
hdxSetPutRange( mn_pid_GREAT4 ,1, 0,54,160,54,0,0 );
hdxSetPutRange( mn_pid_GOOD ,1, 160,54,160,54,0,0 );
hdxSetPutRange( mn_pid_POOR ,1, 320,54,160,54,0,0 );
hdxSetPutRange( mn_pid_BAD ,1, 0,108,160,54,0,0 );
hdxSetPutRange( mn_pid_NUM_WHITE ,1, 0,162,360,54,0,0 );
hdxSetPutRange( mn_pid_NUM_BLUE ,1, 0,216,360,54,0,0 );
hdxSetPutRange( mn_pid_NUM_RED ,1, 0,270,360,54,0,0 );
hdxSetPutRange( mn_pid_NUM_YELLOW ,1, 0,324,360,54,0,0 );
local game_info = hdxGetGameInfo();
if( game_info["pmode"]==PLAYMODE_DOUBLE ) then
hdxLoadAnime( 0,"mn_frm_double.hda",0 );
hdxCtrlAnime( 0,CTRLMODE_AUTO_END,0,0,95 );
else
hdxLoadAnime( 0,"mn_frm_single.hda",0 );
hdxCtrlAnime( 0,CTRLMODE_AUTO_END,0,0,60 );
end
hdxLoadAnime( 1,"mn_fullcombo.hda",0 );
hdxCtrlAnime( 1,CTRLMODE_MANUAL,-1,0,-1 );
hdxLoadAnime( 2,"mn_finish.hda",0 );
hdxCtrlAnime( 2,CTRLMODE_MANUAL,-1,0,-1 );
hdxLoadAnime( 3,"mn_speed.hda",0 );
hdxCtrlAnime( 3,CTRLMODE_MANUAL,-1,0,-1 );
hdxLoadAnime( 4,"mn_time.hda",0 );
hdxCtrlAnime( 4,CTRLMODE_AUTO_LOOP,0,0,-1 );
if( game_info["demo"]==TRUE ) then
hdxLoadAnime( 10,"mn_panel_demo.hda",0 );
elseif( game_info["gmode"]==GAMEMODE_BEGINNER ) then
hdxLoadAnime( 10,"mn_panel_beginner.hda",0 );
elseif( game_info["gmode"]==GAMEMODE_STANDARD ) then
hdxLoadAnime( 10,"mn_panel_standard.hda",0 );
elseif( game_info["gmode"]==GAMEMODE_EXPERT ) then
hdxLoadAnime( 10,"mn_panel_expert.hda",0 );
elseif( game_info["gmode"]==GAMEMODE_CLASS ) then
hdxLoadAnime( 10,"mn_panel_class.hda",0 );
elseif( game_info["gmode"]==GAMEMODE_FREE ) then
hdxLoadAnime( 10,"mn_panel_free.hda",0 );
end
hdxCtrlAnime( 10,CTRLMODE_AUTO_LOOP,0,0,-1 );
hdxLoadAnime( 11,"mn_stage_num.hda",0 );
hdxCtrlAnime( 11,CTRLMODE_AUTO_LOOP,0,0,-1 );
hdxLoadAnime( 12,"mn_level_num.hda",0 );
hdxCtrlAnime( 12,CTRLMODE_AUTO_LOOP,0,0,-1 );
end
function OnRunGame( upd_frm )
local game_data = hdxGetGameData();
local game_info = hdxGetGameInfo();
local cover_info = hdxGetCoverInfo();
local conf = hdxGetConfig();
if( g_dwMainState==MNST_START ) then
if( hdxIsEndAnime(0)==TRUE ) then
hdxStartLoading();
g_dwMainState = MNST_LOADING;
end
elseif( g_dwMainState==MNST_LOADING ) then
elseif( g_dwMainState==MNST_TITLE ) then
if( upd_frm==TRUE ) then
g_iTitleFadeCount = g_iTitleFadeCount + 1;
if( g_iTitleFadeCount>30 ) then
g_iTitleFadeCount = 30;
end
end
elseif( g_dwMainState==MNST_WAIT ) then
if( upd_frm==TRUE ) then
g_iTitleFadeCount = g_iTitleFadeCount + 1;
if( g_iTitleFadeCount>30 ) then
g_iTitleFadeCount = 30;
end
end
if( hdxGetTime()>=g_dwWaitTitleTime ) then
hdxStartGame();
g_dwMainState = MNST_GAME;
end
elseif( g_dwMainState==MNST_GAME ) then
elseif( g_dwMainState==MNST_END ) then
if( hdxIsEndAnime(1)==TRUE ) then
if( g_bGameOver==TRUE ) then
hdxCtrlAnime( 2,CTRLMODE_AUTO_END,60,0,180 );
else
hdxCtrlAnime( 2,CTRLMODE_AUTO_END,0,0,30 );
end
g_dwMainState = MNST_FINISH;
end
elseif( g_dwMainState==MNST_FINISH ) then
if( hdxIsEndAnime(2)==TRUE ) then
trace( "ゲーム処理終了" );
hdxNextScene();
return;
end
end
if( upd_frm==TRUE ) then
for i=1,2 do
if( g_iJadgeMode[i]>=0 ) then
if( g_iJadgeMode[i]!=0 && hdxGetTime()>=g_iJadgeMode[i] ) then
g_iJadgeMode[i] = -1;
break;
end
g_iJadgeCount[i] = (g_iJadgeCount[i] + 1) % 8;
end
end
end
if( g_bScrPos==TRUE ) then
g_iScrPosFrame = g_iScrPosFrame + 1;
if( g_iScrPosFrame>MN_SCRPOS_FRAME ) then
g_iScrPosFrame = MN_SCRPOS_FRAME;
end
else
g_iScrPosFrame = g_iScrPosFrame - 1;
if( g_iScrPosFrame<0 ) then
g_iScrPosFrame = 0;
end
end
hdxSetFilterMode( FILTER_LINEAR );
if( game_info["pmode"]==PLAYMODE_DOUBLE ) then
hdxDrawBga( 30, 37, 236, 272, 1.0 );
hdxDrawBga( 30,320, 236, 272, 1.0 );
hdxDrawBga( 1014, 37, 236, 272, 1.0 );
hdxDrawBga( 1014,320, 236, 272, 1.0 );
else
hdxDrawBga( 333, 0, 614, 614, 1.0 );
end
hdxSetFilterMode( FILTER_POINT );
if( game_info["pmode"]==0 ) then
_mnDrawEqualizer( 0,139,551 );
_mnDrawScrSpeed( 0,game_info["opt_speed"] );
hdxDrawAnime( 0, 0, 0, 1.0, 1.0 );
elseif( game_info["pmode"]==1 ) then
_mnDrawEqualizer( 0,983,551 );
_mnDrawScrSpeed( 1,game_info["opt_speed"] );
hdxDrawAnime( 0, 0, 0, 1.0, 1.0 );
else
_mnDrawEqualizer( 1,304,575 );
_mnDrawEqualizer( 1,880,575 );
hdxDrawAnime( 0, 0, 0, 1.0, 1.0 );
_mnDrawScrSpeed( game_info["pmode"],game_info["opt_speed"] );
end
if( g_dwMainState>=MNST_LOADING ) then
local _mul = 1.0;
if( g_dwMainState<MNST_GAME ) then
_mul = 1.0 - g_iLoadPercent / 100;
elseif( g_dwMainState>=MNST_GAME ) then
_mul = game_data["game_progress"];
end
_mnDrawTimeLight( game_info["pmode"],_mul );
end
if( g_dwMainState>=MNST_TITLE ) then
hdxSysDrawLane();
local RESULT_POS_X = {
{ 188,1092 },
{ 456,824 }
};
for i=1,2 do
local base_x;
if( game_info["pmode"]==PLAYMODE_DOUBLE ) then
base_x = RESULT_POS_X[2][i];
else
base_x = RESULT_POS_X[1][i];
end
if( g_iJadgeMode[i]!=-1 ) then
local combo = g_iJadgeCombo[i];
local keta = 1;
while combo>=10 do
keta = keta + 1;
combo = math.floor( combo / 10 );
end
local jadge_x = 0;
local jadge_y = 354 - cover_info["lift_offset"];
local jadge_id = -1;
local combo_id = -1;
if( g_iJadgeType[i]==JADGE_PKGREAT ) then
jadge_x = base_x - math.floor((160 + keta * 30) / 2);
jadge_id = mn_pid_GREAT1 + math.floor(g_iJadgeCount[i] / 2);
combo_id = mn_pid_NUM_WHITE + math.floor(g_iJadgeCount[i] / 2);
elseif( g_iJadgeType[i]==JADGE_GREAT ) then
if( ((g_iJadgeCount[i]/2)%2)==1 ) then
jadge_x = base_x - math.floor((160 + keta * 30) / 2);
jadge_id = mn_pid_GREAT4;
combo_id = mn_pid_NUM_YELLOW;
end
elseif( g_iJadgeType[i]==JADGE_GOOD ) then
if( ((g_iJadgeCount[i]/2)%2)==1 ) then
jadge_x = base_x - math.floor((160 + keta * 30) / 2);
jadge_id = mn_pid_GOOD;
combo_id = mn_pid_NUM_YELLOW;
end
elseif( g_iJadgeType[i]==JADGE_BAD ) then
if( ((g_iJadgeCount[i]/2)%2)==1 ) then
jadge_x = base_x - 160 / 2;
jadge_id = mn_pid_BAD;
end
elseif( g_iJadgeType[i]==JADGE_EMPTY_POOR || g_iJadgeType[i]==JADGE_POOR ) then
if( ((g_iJadgeCount[i]/2)%2)==1 ) then
jadge_x = base_x - 160 / 2;
jadge_id = mn_pid_POOR;
end
end
if( jadge_id>=0 ) then
hdxPut( jadge_id,jadge_x,jadge_y );
end
if( combo_id>=0 ) then
hdxPutInt( combo_id, jadge_x+160, jadge_y, g_iJadgeCombo[i], 1.0, ALIGNTYPE_LEFTTOP );
end
end
end
end
if( g_dwMainState>=MNST_LOADING ) then
local mode;
if( game_info["opt_difficult"]==OPTDIFFICULT_HARD || game_info["gmode"]==GAMEMODE_EXPERT || game_info["gmode"]==GAMEMODE_CLASS ) then
mode = mn_pid_gauge1;
else
mode = mn_pid_gauge0;
end
GAUGE_POS_X = { 49,833,441 };
_DrawGauge( mode,GAUGE_POS_X[game_info["pmode"]+1],572,game_data["game_gauge_meter"] );
local GAUGE2_POS_X = { 417,901,670 };
local GAUGE2_POS_Y = { 558,558,528 };
hdxPutInt( mn_pid_num_normal, GAUGE2_POS_X[game_info["pmode"]+1], GAUGE2_POS_Y[game_info["pmode"]+1], game_data["game_gauge"], 1.0, ALIGNTYPE_RIGHTBOTTOM );
local BPM_POS_X = { 679,679,682 };
hdxPutInt( mn_pid_num_wide, BPM_POS_X[game_info["pmode"]+1], 696, game_data["game_bpm"], 1.0, ALIGNTYPE_RIGHTBOTTOM );
local SCORE_POS_X = { 290,1237,290 };
local SCORE_POS_Y = { 646,646,661 };
hdxPutInt( mn_pid_num_wide, SCORE_POS_X[game_info["pmode"]+1], SCORE_POS_Y[game_info["pmode"]+1], game_data["game_score"], 1.0, ALIGNTYPE_RIGHTBOTTOM );
local COMBO_ID = { mn_pid_num_small,mn_pid_num_small,mn_pid_num_wide };
local COMBO_POS_X = { 269,1216,1232 };
local COMBO_POS_Y = { 666,666,661 };
hdxPutInt( COMBO_ID[game_info["pmode"]+1], COMBO_POS_X[game_info["pmode"]+1], COMBO_POS_Y[game_info["pmode"]+1], game_data["game_maxcombo"], 1.0, ALIGNTYPE_RIGHTBOTTOM );
end
hdxDrawAnime( 10, 0, 0, 1.0, 1.0 );
hdxDrawAnime2( 11, 0, 0, 1.0, 1.0, "_mnStageNum" );
hdxDrawAnime2( 12, 0, 0, 1.0, 1.0, "_mnLevelNum" );
if( g_dwMainState==MNST_TITLE || g_dwMainState==MNST_WAIT ) then
hdxSetBlendMode( BLEND_ADD );
hdxSetFilterMode( FILTER_LINEAR );
local alpha = g_iTitleFadeCount / 30.0;
inp = hdxSysGetInput();
if( inp["is_press_start"]==TRUE ) then
alpha = alpha * 0.3;
end
if( game_data["type"]==0 ) then
local sz = hdxGetFontSize( 0 );
if( sz["width"]<=MN_TITLEWIDTH ) then
hdxDrawFontEx( 0,MN_BASEPOS_X-sz["width"]/2,MN_TITLEPOS_Y-MN_TITLEHEIGHT/2,sz["width"],MN_TITLEHEIGHT,alpha );
else
hdxDrawFontEx( 0,MN_BASEPOS_X-MN_TITLEWIDTH/2,MN_TITLEPOS_Y-MN_TITLEHEIGHT/2,MN_TITLEWIDTH,MN_TITLEHEIGHT,alpha );
end
sz = hdxGetFontSize( 1 );
if( sz["width"]<=MN_GENREWIDTH ) then
hdxDrawFontEx( 1,MN_BASEPOS_X-sz["width"]/2,MN_GENREPOS_Y-MN_GENREHEIGHT/2,sz["width"],MN_GENREHEIGHT,alpha );
else
hdxDrawFontEx( 1,MN_BASEPOS_X-MN_GENREWIDTH/2,MN_GENREPOS_Y-MN_GENREHEIGHT/2,MN_GENREWIDTH,MN_GENREHEIGHT,alpha );
end
sz = hdxGetFontSize( 2 );
if( sz["width"]<=MN_ARTISTWIDTH ) then
hdxDrawFontEx( 2,MN_BASEPOS_X-sz["width"]/2,MN_ARTISTPOS_Y-MN_ARTISTHEIGHT/2,sz["width"],MN_ARTISTHEIGHT,alpha );
else
hdxDrawFontEx( 2,MN_BASEPOS_X-MN_ARTISTWIDTH/2,MN_ARTISTPOS_Y-MN_ARTISTHEIGHT/2,MN_ARTISTWIDTH,MN_ARTISTHEIGHT,alpha );
end
elseif( game_data["type"]==1 ) then
hdxDrawTitle( MN_BASEPOS_X-MN_STAGEFILE_WIDTH/2,300-MN_STAGEFILE_HEIGHT/2,MN_STAGEFILE_WIDTH,MN_STAGEFILE_HEIGHT,alpha );
else
hdxDrawTitle( MN_BASEPOS_X-MN_BACKBMP_WIDTH/2,300-MN_STAGEFILE_HEIGHT/2,MN_BACKBMP_WIDTH,MN_BACKBMP_HEIGHT,alpha );
end
hdxSetFilterMode( FILTER_POINT );
end
if( g_dwMainState==MNST_FINISH ) then
hdxDrawAnime( 2, 640, 360, 1.0, 1.0 );
end
end
function _DrawGauge( mode,x,y,meter )
if( meter<=0 ) then
return;
end
local len = meter - 1 - hdxGetRand() % 3;
if( len<0 ) then
len = 0;
end
if( mode==0 ) then
local i = 0;
while i<len do
if( i>=39 ) then
break;
end
hdxPut( 0,x+i*8,y );
i = i + 1;
end
while i<len do
hdxPut( 1,x+i*8,y );
i = i + 1;
end
if( meter>=40 ) then
hdxPut( 1,x+(meter-1)*8,y );
else
hdxPut( 0,x+(meter-1)*8,y );
end
else
for i=0,len-1 do
hdxPut( 1,x+i*8,y );
end
hdxPut( 1,x+(meter-1)*8,y );
end
end
function _mnStageNum( layer,x,y,frm_x,frm_y,frm_sx,frm_sy,frm_alpha,frm_rot )
local game_info = hdxGetGameInfo();
local _x = x + frm_x;
local _y = y + frm_y;
if( game_info["stage"]==1 ) then
hdxPut( mn_pid_stg_1st, _x-39, _y-8 );
elseif( game_info["stage"]==2 ) then
hdxPut( mn_pid_stg_2nd, _x-39, _y-8 );
elseif( game_info["stage"]==3 ) then
hdxPut( mn_pid_stg_3rd, _x-39, _y-8 );
else
if( game_info["stage"]<10 ) then
hdxPutInt( mn_pid_stg_num, _x-39, _y-8, game_info["stage"], 1.0, ALIGNTYPE_LEFTTOP );
hdxPut( mn_pid_stg_th, _x-13, _y-8 );
else
hdxPutInt( mn_pid_stg_num, _x-52, _y-8, game_info["stage"], 1.0, ALIGNTYPE_LEFTTOP );
hdxPut( mn_pid_stg_th, _x-0, _y-8 );
end
end
return TRUE;
end
function _mnLevelNum( layer,x,y,frm_x,frm_y,frm_sx,frm_sy,frm_alpha,frm_rot )
local game_data = hdxGetGameData();
local _x = x + frm_x;
local _y = y + frm_y;
if( game_data["level"]>=1 && game_data["level"]<=12 ) then
local id1,id2;
if( game_data["level"]>=1 && game_data["level"]<=5 ) then
id1 = mn_pid_str_level0;
id2 = mn_pid_lv_num0;
elseif( game_data["level"]>=6 && game_data["level"]<=9 ) then
id1 = mn_pid_str_level1;
id2 = mn_pid_lv_num1;
elseif( game_data["level"]>=10 && game_data["level"]<=12 ) then
id1 = mn_pid_str_level2;
id2 = mn_pid_lv_num2;
end
if( game_data["level"]>=10 ) then
hdxPut( id1, _x-70, _y-8 );
hdxPutInt( id2, _x+30, _y-8, game_data["level"], 1.0, ALIGNTYPE_LEFTTOP );
else
hdxPut( id1, _x-60, _y-8 );
hdxPutInt( id2, _x+40, _y-8, game_data["level"], 1.0, ALIGNTYPE_LEFTTOP );
end
else
hdxPut( mn_pid_str_level3, _x-70, _y-8 );
hdxPut( mn_pid_lv_err, _x+30, _y-8 );
end
return TRUE;
end
function _mnDrawScrSpeed( pmode,spd )
if( g_iScrPosFrame>0 ) then
for i=0,10 do
if( spd<=FIXED_SCROLLSPEED[i+1] ) then
hdxCtrlAnime( 3,CTRLMODE_MANUAL,i,0,-1 );
break;
end
end
local pm = pmode + 1;
local _x = g_iScrPosFrame * (MN_SCRPOS_X2[pm] - MN_SCRPOS_X1[pm]) / MN_SCRPOS_FRAME + MN_SCRPOS_X1[pm];
local _y = g_iScrPosFrame * (MN_SCRPOS_Y2[pm] - MN_SCRPOS_Y1[pm]) / MN_SCRPOS_FRAME + MN_SCRPOS_Y1[pm];
hdxDrawAnime( 3, _x, _y, 1.0, 1.0 );
end
end
function _mnDrawEqualizer( mode,x,y )
local eq = hdxGetSoundEqualizer();
local h;
if( mode==0 ) then
for i=0,15 do
hdxFillRect( i*10+x, y, 8, 14, 0xFF22091A );
h = math.floor( eq["eq_"..(i+1)] * 14.0 / 255.0 );
hdxFillRect( i*10+x,y+(14 - h), 8, h, 0xFFFF7ED3 );
end
else
for i=0,15 do
hdxFillRect( i*6+x, y, 5, 30, 0xFF22091A );
h = math.floor( eq["eq_"..(i+1)] * 30.0 / 255.0 );
hdxFillRect( i*6+x, y+(30 - h), 5, h, 0xFFFF7ED3 );
end
end
end
TIMELIGHT_POS_Y = { 26,475 };
function _mnDrawTimeLight( pmode,mul )
local _y = (TIMELIGHT_POS_Y[2] - TIMELIGHT_POS_Y[1]) * mul + TIMELIGHT_POS_Y[1];
if( pmode==0 ) then
hdxDrawAnime( 4, 32, _y, 1.0, 1.0 );
elseif( pmode==1 ) then
hdxDrawAnime( 4, 1248, _y, 1.0, 1.0 );
else
hdxDrawAnime( 4, 294, _y, 1.0, 1.0 );
hdxDrawAnime( 4, 986, _y, 1.0, 1.0 );
end
end
function OnGameLoading( event,per )
g_iLoadPercent = per;
if( event==LOADEVENT_BMS_ANALYZE ) then
elseif( event==LOADEVENT_BMS_SUCCESS ) then
local game_data = hdxGetGameData();
trace( "■タイトルタイプ : "..game_data["type"] );
if( game_data["type"]==0 ) then
hdxCreateFont( 0,"メイリオ",64,game_data["title"],0xFFFFFFFF,0xFFFFA5FF,2,0xFF000000 );
hdxCreateFont( 1,"メイリオ",48,game_data["genre"],0xFFFFFFFF,0xFFFFFFFF,1,0xFF000000 );
hdxCreateFont( 2,"メイリオ",48,game_data["artist"],0xFFFFFFFF,0xFFFFFFFF,1,0xFF000000 );
end
local game_info = hdxGetGameInfo();
if( game_info["pmode"]==PLAYMODE_DOUBLE ) then
hdxCtrlAnime( 0,CTRLMODE_MANUAL,100,100,-1 );
else
hdxCtrlAnime( 0,CTRLMODE_MANUAL,65,65,-1 );
end
g_dwWaitTitleTime = hdxGetTime() + 3000;
g_dwMainState = MNST_TITLE;
elseif( event==LOADEVENT_BMS_ANALYZE ) then
elseif( event==LOADEVENT_SOUND_LOADING ) then
elseif( event==LOADEVENT_IMAGE_LOADING ) then
elseif( event==LOADEVENT_COMPLETE ) then
g_dwMainState = MNST_WAIT;
end
end
function OnGameJadge( side,draw,jadge,combo,timing )
g_iJadgeType[side+1] = jadge;
g_iJadgeCombo[side+1] = combo;
if( draw==0 ) then
g_iJadgeMode[side+1] = hdxGetTime() + 1000;
elseif( draw==1 ) then
g_iJadgeMode[side+1] = 0;
end
end
function OnDrawLane( state,side,x,y,w,h )
if( state==DRAWSTATE_OBJECT ) then
local game_info = hdxGetGameInfo();
local cover_info = hdxGetCoverInfo();
if( game_info["pmode"]==PLAYMODE_SINGLE_1P || game_info["pmode"]==PLAYMODE_SINGLE_2P ) then
local FULLCOMBO_X = { 42,948 };
hdxSetViewport( FULLCOMBO_X[side+1], 0 - cover_info["lift_offset"], 290, 474 );
hdxDrawAnime( 1, FULLCOMBO_X[side+1], 0 - cover_info["lift_offset"], 1.0, 1.0 );
else
local FULLCOMBO_X = { 304,686 };
hdxSetViewport( FULLCOMBO_X[side+1], 0 - cover_info["lift_offset"], 290, 474 );
hdxDrawAnime( 1, FULLCOMBO_X[side+1], 0 - cover_info["lift_offset"], 1.0, 1.0 );
end
elseif( state==DRAWSTATE_COVER ) then
local game_info = hdxGetGameInfo();
local cover_info = hdxGetCoverInfo();
if( g_bScrPos==TRUE ) then
if( game_info["opt_cover"]==OPTCOVER_NO ) then
hdxSetViewport( 0,0,0,0 );
local COVERNO_POS_X = { 370,910,640 };
local COVERNO_POS_Y = { 176,176,12 };
hdxPutInt( mn_pid_num_g, COVERNO_POS_X[game_info["pmode"]+1], COVERNO_POS_Y[game_info["pmode"]+1], cover_info["num_green"], 1.0, ALIGNTYPE_CENTER );
hdxPutInt( mn_pid_num_g2, COVERNO_POS_X[game_info["pmode"]+1]+8, COVERNO_POS_Y[game_info["pmode"]+1]+11+8, cover_info["num_green_ms"], 1.0, ALIGNTYPE_RIGHTBOTTOM );
hdxPut( mn_pid_num_mill, COVERNO_POS_X[game_info["pmode"]+1]+8+1, COVERNO_POS_Y[game_info["pmode"]+1]+11+1 );
else
local id = side + 1;
if( game_info["opt_cover"]==OPTCOVER_SUDDEN || game_info["opt_cover"]==OPTCOVER_HIDSUD || game_info["opt_cover"]==OPTCOVER_LIFTSUD ) then
hdxPutInt( mn_pid_num_w, cover_info["cover_top_x"..id]+86, cover_info["cover_top_y"..id]+482-18, cover_info["cover_top_num_white"], 1.0, ALIGNTYPE_CENTER );
hdxPutInt( mn_pid_num_g, cover_info["cover_top_x"..id]+204, cover_info["cover_top_y"..id]+482-18, cover_info["num_green"], 1.0, ALIGNTYPE_CENTER );
hdxPutInt( mn_pid_num_g2, cover_info["cover_top_x"..id]+204+8, cover_info["cover_top_y"..id]+482-18+9+8, cover_info["num_green_ms"], 1.0, ALIGNTYPE_RIGHTBOTTOM );
hdxPut( mn_pid_num_mill, cover_info["cover_top_x"..id]+204+8+1, cover_info["cover_top_y"..id]+482-18+9+1 );
end
if( game_info["opt_cover"]==OPTCOVER_HIDDEN || game_info["opt_cover"]==OPTCOVER_HIDSUD || game_info["opt_cover"]==OPTCOVER_LIFT || game_info["opt_cover"]==OPTCOVER_LIFTSUD ) then
hdxPutInt( mn_pid_num_w, cover_info["cover_under_x"..id]+86, cover_info["cover_under_y"..id]+19, cover_info["cover_under_num_white"], 1.0, ALIGNTYPE_CENTER );
hdxPutInt( mn_pid_num_g, cover_info["cover_under_x"..id]+204, cover_info["cover_under_y"..id]+19, cover_info["num_green"], 1.0, ALIGNTYPE_CENTER );
hdxPutInt( mn_pid_num_g2, cover_info["cover_under_x"..id]+204+8, cover_info["cover_under_y"..id]+19+9+8, cover_info["num_green_ms"], 1.0, ALIGNTYPE_RIGHTBOTTOM );
hdxPut( mn_pid_num_mill, cover_info["cover_under_x"..id]+204+8+1, cover_info["cover_under_y"..id]+19+9+1 );
end
end
end
end
end
function OnFullCombo()
trace( "■フルコンボ" );
hdxCtrlAnime( 1,CTRLMODE_AUTO_END,0,0,-1 );
end
function OnEndGame( retire )
trace( "■ゲーム終了 : "..retire );
g_bGameOver = retire;
g_dwMainState = MNST_END;
end
function OnStartGameOption()
g_bScrPos = TRUE;
end
function OnEndGameOption()
g_bScrPos = FALSE;
end
スクロールスピード処理
※以下のコードは曲選択画面(_05_songselect.lua)に定義したものです
FIXED_SCROLLSPEED = { 1.00, 1.50, 2.00, 2.25, 2.50, 2.75, 3.00, 3.25, 3.50, 3.75, 4.00 };
function OnChangeScrollSpeed( scene,cur_spd,digital,analog )
local ret;
if( digital==0 ) then
ret = cur_spd + analog;
if( ret<0.5 ) then
ret = 0.5;
end
if( ret>10 ) then
ret = 10;
end
elseif( digital>0 ) then
for i=1,11 do
if( FIXED_SCROLLSPEED[i]>cur_spd ) then
return FIXED_SCROLLSPEED[i];
end
end
if( scene==0 ) then
return FIXED_SCROLLSPEED[1];
end
ret = cur_spd;
else
for i=11,1,-1 do
if( FIXED_SCROLLSPEED[i]<cur_spd ) then
return FIXED_SCROLLSPEED[i];
end
end
ret = cur_spd;
end
return ret;
end