Created
May 25, 2018 07:05
-
-
Save wararyo/12127afa05f879d1da06321bb8845f42 to your computer and use it in GitHub Desktop.
3D Rhythm Game for Sunaba
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
##################################### | |
# CHUNITHMっぽそうでCHUNITHMっぽくない、# | |
# すこしCHUNITHMっぽい音ゲー ########### | |
##################################### | |
# コードの概要 (行頭の数字はコード中のだいたいの位置) | |
60 Settings ゲームプレイに直接関わる変数群 | |
Camera カメラ設定 | |
Stage ステージ設定 | |
Judgement 判定の設定 | |
80 Constants ゲーム内部で使用する定数 | |
50 Addresses Sunabaであらかじめ用意されているアドレス群 | |
70 User Addresses 自分で定義したアドレス 配列の開始アドレスなど | |
100 Frequencies 音階と周波数の対応テーブル | |
120 Color 色 | |
130 Sin Table サイン関数で使用するテーブル 度 100倍された値 | |
230 Digit Tex 数字を描画するときに使う数字のテクスチャ 3x5が10個 | |
320 Functions 静的関数群 | |
Utility 便利関数 | |
Math 数学関連 | |
Sound 音関連 | |
Graphics 2Dグラフィック関連 | |
3DGraphics 3Dグラフィック | |
610 Classes 構造体定義と、その構造体を使用した関数群 | |
Matrix 4x4行列 | |
Vector3D 三次元ベクトル | |
Box 三次元の箱 | |
SlideNote ステージに置かれるスライドノート | |
AirNote ステージに置かれるエアノート | |
Note 譜面データ中の生のノート SlideNoteまたはAirNoteに変換された後描画 | |
SoundNote 音の方の音符 | |
850 Main メイン部分 | |
1100 Database 楽譜データ | |
# 3Dのつくりかた | |
1. 三角関数を作ります | |
2. 三次元ベクトルを定義します | |
3. 行列を定義し、行列とベクトルの掛け算をする関数を作ります | |
4. 三次元ベクトルを足し算・回転させる関数を作ります | |
5. カメラを作り、ワールド座標をビュー座標にします(この時点で平行投影法での3Dができます) | |
6. ビューポート・射影変換行列を定義し、それを三次元ベクトルに掛けると完成 | |
*/ | |
################## | |
# Settings ###### | |
################## | |
# Camera | |
const FOV -> 48 | |
const NEAR_Z -> 18 | |
const FAR_Z -> 72 | |
# Stage | |
const STAGE_WIDTH -> 160 | |
const STAGE_HEIGHT -> 1440 | |
const STAGE_SPANX -> 40 #つまり4レーン | |
const STAGE_SPANY -> 1152 | |
const STAGE_SPEED -> 13 #SPANとSPEEDから、曲の速さが決まる | |
# Judgement | |
const SLIDE_JUDGE_THRESHOLD -> 40 # 3D空間上のXがこれ以上ノートと離れたらFailedCountが進みます | |
const FAILED_COUNT_THRESHOLD -> 6 # スライドノートはこのフレーム以上ズレたらミスとなります | |
################## | |
# Constants ###### | |
################## | |
const WIDTH -> 100 | |
const HEIGHT -> 100 | |
# Addresses | |
const DISABLE_AUTOREFRESH -> 55001 | |
const REFRESH -> 55000 | |
const MOUSE_X -> 50000 | |
const MOUSE_Y -> 50001 | |
const MOUSE_LEFT -> 50002 | |
const MOUSE_RIGHT -> 50003 | |
const UP -> 50004 | |
const DOWN -> 50005 | |
const LEFT -> 50006 | |
const RIGHT -> 50007 | |
const SPACE -> 50008 | |
const ENTER -> 50009 | |
const CANVAS_START -> 60000 | |
const FREQ_START -> 55006 | |
const ATTEN_START -> 55009 | |
const VOL_START -> 55012 | |
const OUTPUT_CHAR -> 55002 | |
#User Addresses | |
const SOUND_CURRENT_CHANNEL -> 19634 # 一番最後に使ったサウンドチャンネルを表すアドレス | |
memory[SOUND_CURRENT_CHANNEL] -> 0 | |
const CAMERA_POS -> 10000 | |
const CAMERA_ROTATE -> 10003 | |
const DRAWBOX_TEMP -> 12000 # Vector3[8] 24 | |
const ROTATE_VECTOR_3_MATRIX -> 12024 # Matrix 16 | |
const MULTIPLY_BY_MATRIX_VECTOR_3_TEMP -> 12040 # Matrix 16 | |
const PERSP_MATRIX -> 12056 # Matrix 16 | |
const DRAW_LINE_3D_TEMP -> 12072 # Vector3[2] 6 | |
const DRAW_GRID_3D_TEMP -> 12078 # Vector3[2] 6 | |
const DRAW_SLIDENOTE_TEMP -> 12084 # Vector3[4] 12 | |
const DRAW_AIRNOTE_TEMP -> 12096 # Vector3[2] 6 | |
const TESTBOX -> 15000 # Box 10 | |
const CURSORBOX -> 15010 # Box 10 | |
const SLIDE_NOTES -> 15020 # SlideNote[SLIDE_NOTES_LENGTH] 7*16 = 448 | |
const SLIDE_NOTES_LENGTH -> 16 #配列数 アドレスじゃないです | |
const AIR_NOTES -> 15468 # AirNote[AIR_NOTES_LENGTH] 11*8 = 88 | |
const AIR_NOTES_LENGTH -> 8 #配列数 アドレスじゃないです | |
const SONG_DATA -> 100 # SoundNote[512] 4*512 = 2048 | |
const SONG_DATA_COUNT -> 99 # ノーツ数を格納するアドレス | |
const SCORE_DATA_COUNT -> 2148 #ノーツ数を格納するアドレス | |
const SCORE_DATA -> 2149 # Note[512] 5*512 = 2560 | |
# Frequencies | |
const SOUND_FREQ -> 19635 # 音階の周波数を表す配列の開始アドレス | |
SOUND_FREQ[0] -> 523 | |
SOUND_FREQ[1] -> 554 | |
SOUND_FREQ[2] -> 587 | |
SOUND_FREQ[3] -> 622 | |
SOUND_FREQ[4] -> 659 | |
SOUND_FREQ[5] -> 698 | |
SOUND_FREQ[6] -> 740 | |
SOUND_FREQ[7] -> 784 | |
SOUND_FREQ[8] -> 831 | |
SOUND_FREQ[9] -> 880 | |
SOUND_FREQ[10] -> 932 | |
SOUND_FREQ[11] -> 987 | |
# Colors | |
const WHITE -> 999999 | |
const GRAY -> 606060 | |
const LIGHT_GRAY -> 808080 | |
const BLUE -> 000099 | |
const GREEN -> 009900 | |
const RED -> 990000 | |
const ORANGE -> 998000 | |
const PURPLE -> 902060 | |
# Sin table | |
const SIN_TABLE_START -> 16431 # サインテーブル開始アドレス | |
SIN_TABLE_START[0] -> 0 | |
SIN_TABLE_START[1] -> 2 | |
SIN_TABLE_START[2] -> 3 | |
SIN_TABLE_START[3] -> 5 | |
SIN_TABLE_START[4] -> 7 | |
SIN_TABLE_START[5] -> 9 | |
SIN_TABLE_START[6] -> 10 | |
SIN_TABLE_START[7] -> 12 | |
SIN_TABLE_START[8] -> 14 | |
SIN_TABLE_START[9] -> 16 | |
SIN_TABLE_START[10] -> 17 | |
SIN_TABLE_START[11] -> 19 | |
SIN_TABLE_START[12] -> 21 | |
SIN_TABLE_START[13] -> 22 | |
SIN_TABLE_START[14] -> 24 | |
SIN_TABLE_START[15] -> 26 | |
SIN_TABLE_START[16] -> 28 | |
SIN_TABLE_START[17] -> 29 | |
SIN_TABLE_START[18] -> 31 | |
SIN_TABLE_START[19] -> 33 | |
SIN_TABLE_START[20] -> 34 | |
SIN_TABLE_START[21] -> 36 | |
SIN_TABLE_START[22] -> 37 | |
SIN_TABLE_START[23] -> 39 | |
SIN_TABLE_START[24] -> 41 | |
SIN_TABLE_START[25] -> 42 | |
SIN_TABLE_START[26] -> 44 | |
SIN_TABLE_START[27] -> 45 | |
SIN_TABLE_START[28] -> 47 | |
SIN_TABLE_START[29] -> 48 | |
SIN_TABLE_START[30] -> 50 | |
SIN_TABLE_START[31] -> 52 | |
SIN_TABLE_START[32] -> 53 | |
SIN_TABLE_START[33] -> 54 | |
SIN_TABLE_START[34] -> 56 | |
SIN_TABLE_START[35] -> 57 | |
SIN_TABLE_START[36] -> 59 | |
SIN_TABLE_START[37] -> 60 | |
SIN_TABLE_START[38] -> 62 | |
SIN_TABLE_START[39] -> 63 | |
SIN_TABLE_START[40] -> 64 | |
SIN_TABLE_START[41] -> 66 | |
SIN_TABLE_START[42] -> 67 | |
SIN_TABLE_START[43] -> 68 | |
SIN_TABLE_START[44] -> 69 | |
SIN_TABLE_START[45] -> 71 | |
SIN_TABLE_START[46] -> 72 | |
SIN_TABLE_START[47] -> 73 | |
SIN_TABLE_START[48] -> 74 | |
SIN_TABLE_START[49] -> 75 | |
SIN_TABLE_START[50] -> 77 | |
SIN_TABLE_START[51] -> 78 | |
SIN_TABLE_START[52] -> 79 | |
SIN_TABLE_START[53] -> 80 | |
SIN_TABLE_START[54] -> 81 | |
SIN_TABLE_START[55] -> 82 | |
SIN_TABLE_START[56] -> 83 | |
SIN_TABLE_START[57] -> 84 | |
SIN_TABLE_START[58] -> 85 | |
SIN_TABLE_START[59] -> 86 | |
SIN_TABLE_START[60] -> 87 | |
SIN_TABLE_START[61] -> 87 | |
SIN_TABLE_START[62] -> 88 | |
SIN_TABLE_START[63] -> 89 | |
SIN_TABLE_START[64] -> 90 | |
SIN_TABLE_START[65] -> 91 | |
SIN_TABLE_START[66] -> 91 | |
SIN_TABLE_START[67] -> 92 | |
SIN_TABLE_START[68] -> 93 | |
SIN_TABLE_START[69] -> 93 | |
SIN_TABLE_START[70] -> 94 | |
SIN_TABLE_START[71] -> 95 | |
SIN_TABLE_START[72] -> 95 | |
SIN_TABLE_START[73] -> 96 | |
SIN_TABLE_START[74] -> 96 | |
SIN_TABLE_START[75] -> 97 | |
SIN_TABLE_START[76] -> 97 | |
SIN_TABLE_START[77] -> 97 | |
SIN_TABLE_START[78] -> 98 | |
SIN_TABLE_START[79] -> 98 | |
SIN_TABLE_START[80] -> 98 | |
SIN_TABLE_START[81] -> 99 | |
SIN_TABLE_START[82] -> 99 | |
SIN_TABLE_START[83] -> 99 | |
SIN_TABLE_START[84] -> 99 | |
SIN_TABLE_START[85] -> 100 | |
SIN_TABLE_START[86] -> 100 | |
SIN_TABLE_START[87] -> 100 | |
SIN_TABLE_START[88] -> 100 | |
SIN_TABLE_START[89] -> 100 | |
SIN_TABLE_START[90] -> 100 | |
# Digit Tex | |
const DIGIT_TEXES -> 16522 | |
const DIGIT_TEX_SIZE -> 15 | |
setDigitTex(0, | |
1,1,1, | |
1,0,1, | |
1,0,1, | |
1,0,1, | |
1,1,1) | |
setDigitTex(1, | |
0,1,0, | |
0,1,0, | |
0,1,0, | |
0,1,0, | |
0,1,0) | |
setDigitTex(2, | |
1,1,1, | |
0,0,1, | |
1,1,1, | |
1,0,0, | |
1,1,1) | |
setDigitTex(3, | |
1,1,1, | |
0,0,1, | |
1,1,1, | |
0,0,1, | |
1,1,1) | |
setDigitTex(4, | |
1,0,1, | |
1,0,1, | |
1,1,1, | |
0,0,1, | |
0,0,1) | |
setDigitTex(5, | |
1,1,1, | |
1,0,0, | |
1,1,1, | |
0,0,1, | |
1,1,1) | |
setDigitTex(6, | |
1,1,1, | |
1,0,0, | |
1,1,1, | |
1,0,1, | |
1,1,1) | |
setDigitTex(7, | |
1,1,1, | |
0,0,1, | |
0,0,1, | |
0,0,1, | |
0,0,1) | |
setDigitTex(8, | |
1,1,1, | |
1,0,1, | |
1,1,1, | |
1,0,1, | |
1,1,1) | |
setDigitTex(9, | |
1,1,1, | |
1,0,1, | |
1,1,1, | |
0,0,1, | |
1,1,1) | |
################## | |
# Functions ###### | |
################## | |
# System | |
# Utility | |
def Print(value) | |
memory[100000 + value] -> 1 | |
def Color(red,green,blue) | |
out -> (red * 10000) + (green * 100) + blue | |
def ColorLerp(from,to,pct) | |
red -> Lerp(from/10000,to/10000,pct) | |
green -> Lerp(Mod(from,10000)/100,Mod(to,10000)/100,pct) | |
blue -> Lerp(Mod(from, 100),Mod(to, 100),pct) | |
out -> Color(red,green,blue) | |
def setDigitTex(num,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) | |
addr -> DIGIT_TEXES+(DIGIT_TEX_SIZE*num) | |
addr[0] -> a | |
addr[1] -> b | |
addr[2] -> c | |
addr[3] -> d | |
addr[4] -> e | |
addr[5] -> f | |
addr[6] -> g | |
addr[7] -> h | |
addr[8] -> i | |
addr[9] -> j | |
addr[10] -> k | |
addr[11] -> l | |
addr[12] -> m | |
addr[13] -> n | |
addr[14] -> o | |
# Math | |
def Abs(value) | |
out -> value | |
if value < 0 | |
out -> -value | |
def Neg(b) # 論理否定 | |
out -> 0 | |
if b = 0 | |
out -> 1 | |
def Mod(value, divider) | |
while value >= divider | |
value -> value - divider | |
out -> value | |
def Pow(value, index) | |
i -> 0 | |
out -> 1 #indexが0の時の値だよ | |
multiplier -> value | |
if index > 0 | |
while i < (index - 1) | |
i -> i + 1 | |
value -> value * multiplier | |
out -> value | |
if index < 0 | |
out -> 0 | |
def Sin(deg) # 100倍した値です | |
while deg >= 360 | |
deg -> deg - 360 | |
while deg < 0 | |
deg -> deg + 360 | |
out -> 0 | |
if (0 <= deg) * (deg <= 90) | |
out -> SIN_TABLE_START[deg] | |
if (91 <= deg) * (deg <= 180) | |
out -> SIN_TABLE_START[(180-deg)] | |
if (181 <= deg) * (deg <= 270) | |
out -> -SIN_TABLE_START[(deg-180)] | |
if (271 <= deg) * (deg <= 360) | |
out -> -SIN_TABLE_START[(360-deg)] | |
def Cos(deg) # 100倍した値です | |
out -> Sin(90 - deg) | |
def Cot(deg) # 100倍した値です | |
out -> Cos(deg)*100/Sin(deg) | |
def Lerp(from,to,pct) | |
out -> from + ((to - from)*pct/100) | |
# Sound | |
def PlaySound(freq,atten,vol) | |
if memory[SOUND_CURRENT_CHANNEL] < 3 | |
memory[SOUND_CURRENT_CHANNEL] -> memory[SOUND_CURRENT_CHANNEL] + 1 | |
if memory[SOUND_CURRENT_CHANNEL] = 3 | |
memory[SOUND_CURRENT_CHANNEL] -> 0 | |
PlaySoundChannel(freq,atten,vol, memory[SOUND_CURRENT_CHANNEL]) | |
def PlaySoundChannel(freq, atten, vol, ch) | |
# 音割れ防止 | |
memory[FREQ_START + ch] -> 1000 | |
memory[ATTEN_START + ch] -> 100 | |
memory[VOL_START + ch] -> 0 | |
# 音を鳴らすぞ | |
memory[FREQ_START + ch] -> freq | |
memory[ATTEN_START + ch] -> atten | |
memory[VOL_START + ch] -> vol # VOLを設定した瞬間に発音するのでVOLは最後に設定しないとダメ | |
def PlayNote(noteNo, atten, vol) | |
#ノートナンバーを音階とオクターブに分解 | |
octave -> 0 # 4オクターブ目(NoteNo.60-71)が0となる | |
while noteNo < 60 | |
noteNo -> noteNo + 12 | |
octave -> octave - 1 | |
while noteNo > 71 | |
noteNo -> noteNo - 12 | |
octave -> octave + 1 | |
scale -> noteNo - 60 | |
if(octave = 0) | |
PlaySound (SOUND_FREQ[scale],atten,vol) | |
if(octave < 0) | |
PlaySound (SOUND_FREQ[scale]/Pow(2,-octave),atten,vol) | |
if(octave > 0) | |
PlaySound (SOUND_FREQ[scale]*Pow(2,octave),atten,vol) | |
def PlayNoteChannel(noteNo, atten, vol, ch) | |
#ノートナンバーを音階とオクターブに分解 | |
octave -> 0 # 4オクターブ目(NoteNo.60-71)が0となる | |
while noteNo < 60 | |
noteNo -> noteNo + 12 | |
octave -> octave - 1 | |
while noteNo > 71 | |
noteNo -> noteNo - 12 | |
octave -> octave + 1 | |
scale -> noteNo - 60 | |
if(octave = 0) | |
PlaySoundChannel (SOUND_FREQ[scale],atten,vol,ch) | |
if(octave < 0) | |
PlaySoundChannel (SOUND_FREQ[scale]/Pow(2,-octave),atten,vol,ch) | |
if(octave > 0) | |
PlaySoundChannel (SOUND_FREQ[scale]*Pow(2,octave),atten,vol,ch) | |
# Graphics | |
def Fill(color) | |
i -> 60000 | |
while i < 69999 | |
i -> i + 1 | |
memory[i] -> color | |
def Pixel(x, y) | |
out -> CANVAS_START + (100*y) + x | |
def Plot(x, y, color) | |
if (0 <= x) * (x < 100) * (0 <= y) * (y < 100) | |
memory[Pixel(x,y)] -> color | |
def DrawLine(x0, y0, x1, y1, color) #ブレゼンハムのアルゴリズム | |
if(x0 > -1000)*(x0 < 1100)*(y0 > -1000)*(y0 < 1100)*(x1 > -1000)*(x1 < 1100)*(y1 > -1000)*(y1 < 1100) | |
steep -> Abs(y1 - y0) > Abs(x1 - x0) | |
if steep | |
#swap(x0, y0) | |
t -> x0 | |
x0 -> y0 | |
y0 -> t | |
#swap(x1, y1) | |
t -> x1 | |
x1 -> y1 | |
y1 -> t | |
if x0 > x1 | |
#swap(x0, x1) | |
t -> x0 | |
x0 -> x1 | |
x1 -> t | |
#swap(y0, y1) | |
t -> y0 | |
y0 -> y1 | |
y1 -> t | |
deltax -> x1 - x0 | |
deltay -> Abs(y1 - y0) | |
error -> deltax / 2 | |
ystep -> 0 | |
y -> y0 | |
if y0 < y1 | |
ystep -> 1 | |
if y0 >= y1 | |
ystep -> -1 | |
x -> x0 | |
while x <= x1 #for x from x0 to x1 | |
x -> x + 1 | |
if steep | |
Plot(y,x,color) | |
if Neg(steep) | |
Plot(x,y,color) | |
error -> error - deltay | |
if error < 0 | |
y -> y + ystep | |
error -> error + deltax | |
def DrawRect(x0,y0,width,height,color) | |
y -> y0 | |
y1 -> y0 + height | |
x1 -> x0 + width | |
while y <= y1 | |
x -> x0 | |
while x <= x1 | |
Plot(x,y,color) | |
x -> x + 1 | |
y -> y + 1 | |
def DrawRectCenter(x0,y0,width,height,color) | |
DrawRect(x0-(width/2),y0-(height/2),width,height,color) | |
def DrawCircle(x,y,radius,color) | |
i -> 0 | |
while i < 360 | |
i -> i + 1 | |
Plot(x+(Cos(i)*radius/100),y+(Sin(i)*radius/100),color) | |
def DrawDigit(x,y,num,color) | |
x -> x - 3 | |
y -> y - 5 | |
tex -> DIGIT_TEXES+(DIGIT_TEX_SIZE*num) | |
ty -> 0 | |
while ty < 5 | |
tx -> 0 | |
while tx < 3 | |
if tex[(ty*3)+tx] | |
Plot(x+tx,y+ty,color) | |
tx -> tx + 1 | |
ty -> ty + 1 | |
def DrawDigits(x,y,num,color) | |
first -> 1 | |
while(num > 0)+first | |
DrawDigit(x,y,Mod(num,10),color) | |
num -> num / 10 | |
x -> x - 4 | |
first -> 0 | |
# 3DGraphics | |
# ↑Y軸 /^奥に行くのがZ軸正方向 | |
# *→X軸 | |
newVector3(CAMERA_POS,0,10,-100) | |
newVector3(CAMERA_ROTATE,0,0,0) | |
newMatrix(PERSP_MATRIX, | |
Cot(FOV/2), 0, 0,0, | |
0, -Cot(FOV/2), 0,0, | |
0, 0, 100/(FAR_Z - NEAR_Z),0, | |
0,0,-(100 * NEAR_Z)/(FAR_Z - NEAR_Z),100) | |
def DrawLine3D(start, end, color) # Vector3のインスタンスを渡してね | |
s -> DRAW_LINE_3D_TEMP | |
e -> DRAW_LINE_3D_TEMP + VECTOR3_SIZE | |
fromToVector3(s,CAMERA_POS,start) | |
fromToVector3(e,CAMERA_POS,end) | |
rotateVector3(s,CAMERA_ROTATE[0],CAMERA_ROTATE[1],CAMERA_ROTATE[2]) | |
rotateVector3(e,CAMERA_ROTATE[0],CAMERA_ROTATE[1],CAMERA_ROTATE[2]) | |
Zstart -> s[2] | |
Zend -> e[2] | |
#Print(end) | |
multiplyByMatrixVector3(s,PERSP_MATRIX) | |
multiplyByMatrixVector3(e,PERSP_MATRIX) | |
#Print(s[0]) | |
if(Zstart > 0) | |
s[0] -> s[0]/(Zstart) | |
s[1] -> s[1]/(Zstart) | |
if(Zend > 0) | |
e[0] -> e[0]/(Zend) | |
e[1] -> e[1]/(Zend) | |
#Print(start[2]) | |
if(Zstart > 0)+(Zend > 0) | |
DrawLine(s[0]+50,s[1]+50,e[0]+50,e[1]+50,color) | |
def DrawGrid3D(centerX,centerZ,spanX,spanZ,sizeX,sizeZ) | |
s -> DRAW_GRID_3D_TEMP #Vector3 | |
e -> DRAW_GRID_3D_TEMP + VECTOR3_SIZE #Vector3 | |
startX -> centerX - (sizeX/2) | |
startZ -> centerZ - (sizeZ/2) | |
endX -> startX + sizeX | |
endZ -> startZ + sizeZ | |
x -> startX / spanX * spanX | |
z -> startZ / spanZ * spanZ | |
while x <= endX | |
newVector3(s,x,0,startZ) | |
newVector3(e,x,0,endZ) | |
DrawLine3D(s,e,GRAY) | |
x -> x + spanX | |
while z <= endZ | |
newVector3(s,startX,0,z) | |
newVector3(e,endX,0,z) | |
DrawLine3D(s,e,GRAY) | |
z -> z + spanZ | |
################## | |
# Classes ######## | |
################## | |
/* | |
Matrixオブジェクト | |
4x4行列です | |
三次元ベクトルの変形に使用します | |
*/ | |
const MATRIX_SIZE -> 16 | |
def newMatrix(addr,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) | |
addr[0] -> a | |
addr[1] -> b | |
addr[2] -> c | |
addr[3] -> d | |
addr[4] -> e | |
addr[5] -> f | |
addr[6] -> g | |
addr[7] -> h | |
addr[8] -> i | |
addr[9] -> j | |
addr[10] -> k | |
addr[11] -> l | |
addr[12] -> m | |
addr[13] -> n | |
addr[14] -> o | |
addr[15] -> p | |
/* | |
Vector3クラス | |
三次元ベクトルです | |
*/ | |
const VECTOR3_SIZE -> 3 | |
def newVector3(addr,x,y,z) | |
addr[0] -> x | |
addr[1] -> y | |
addr[2] -> z | |
def copyVector3(from, to) | |
to[0] -> from[0] | |
to[1] -> from[1] | |
to[2] -> from[2] | |
def offsetVector3(addr,offset) | |
addr[0] -> addr[0] + offset[0] | |
addr[1] -> addr[1] + offset[1] | |
addr[2] -> addr[2] + offset[2] | |
def offsetVector3f(addr,x,y,z) | |
addr[0] -> addr[0] + x | |
addr[1] -> addr[1] + y | |
addr[2] -> addr[2] + z | |
def multiplyVector3(addr, divider) | |
addr[0] -> addr[0] * divider | |
addr[1] -> addr[1] * divider | |
addr[2] -> addr[2] * divider | |
def divideVector3(addr, divider) | |
addr[0] -> addr[0] / divider | |
addr[1] -> addr[1] / divider | |
addr[2] -> addr[2] / divider | |
def fromToVector3(addr,from,to) | |
addr[0] -> to[0] - from[0] | |
addr[1] -> to[1] - from[1] | |
addr[2] -> to[2] - from[2] | |
def multiplyByMatrixVector3(vec,mat) | |
temp -> MULTIPLY_BY_MATRIX_VECTOR_3_TEMP | |
temp[0] -> (vec[0]*mat[0])+(vec[1]*mat[1])+(vec[2]*mat[2])+(100*mat[3]) | |
temp[1] -> (vec[0]*mat[4])+(vec[1]*mat[5])+(vec[2]*mat[6])+(100*mat[7]) | |
temp[2] -> (vec[0]*mat[8])+(vec[1]*mat[9])+(vec[2]*mat[10])+(100*mat[11]) | |
vec[0] -> temp[0] | |
vec[1] -> temp[1] | |
vec[2] -> temp[2] | |
#Print (vec[0]) | |
def rotateVector3(addr,x,y,z) | |
/*newMatrix(ROTATE_VECTOR_3_MATRIX, | |
(Cos(x)*Cos(y)*Cos(z)/10000)-(Sin(x)*Sin(z)/100), -(Cos(x)*Cos(y)*Sin(z)/10000)-(Sin(x)*Cos(z)/100), Cos(x)*Sin(y)/100,0, | |
(Sin(x)*Cos(y)*Cos(z)/10000)+(Cos(x)*Sin(z)/100), -(Sin(x)*Cos(y)*Sin(z)/10000)+(Cos(x)*Cos(z)/100), Sin(x)*Sin(y)/100,0, | |
-Sin(y)*Cos(z)/100 , Sin(y)*Sin(z)/100 , Cos(y), 0, | |
0,0,0,100)*/ | |
newMatrix(ROTATE_VECTOR_3_MATRIX, | |
Cos(y)*Cos(z)/100, (Sin(x)*Sin(y)*Cos(z)/10000)+(Cos(x)*Sin(z)/100), -(Cos(x)*Sin(y)*Cos(z)/10000)+(Sin(x)*Sin(z)/100),0, | |
-Cos(y)*Sin(z)/100, -(Sin(x)*Sin(y)*Sin(z)/10000)+(Cos(x)*Cos(z)/100), (Cos(x)*Sin(y)*Sin(z)/10000)+(Sin(x)*Cos(z)/100),0, | |
Sin(y) , -Sin(x)*Cos(y)/100 , Cos(x)*Cos(y)/100, 0, | |
0,0,0,100) | |
multiplyByMatrixVector3(addr,ROTATE_VECTOR_3_MATRIX) | |
divideVector3(addr, 100) | |
def lerpVector3(addr,from,to,pct) | |
addr[0] -> Lerp(from[0],to[0],pct) | |
addr[1] -> Lerp(from[1],to[1],pct) | |
addr[2] -> Lerp(from[2],to[2],pct) | |
/* | |
Boxアクター | |
立方体です | |
*/ | |
const BOX_SIZE -> 10 # メモリ上の占める領域 | |
def newBox(addr,x,y,z,rotateX,rotateY,rotateZ,scaleX,scaleY,scaleZ,color) | |
addr[0] -> x | |
addr[1] -> y | |
addr[2] -> z | |
addr[3] -> rotateX | |
addr[4] -> rotateY | |
addr[5] -> rotateZ | |
addr[6] -> scaleX | |
addr[7] -> scaleY | |
addr[8] -> scaleZ | |
addr[9] -> color | |
def drawBox(addr) | |
newVector3(DRAWBOX_TEMP + (VECTOR3_SIZE*0),0 + (addr[6]/2),0 + (addr[7]/2),0 + (addr[8]/2)) | |
newVector3(DRAWBOX_TEMP + (VECTOR3_SIZE*1),0 + (addr[6]/2),0 + (addr[7]/2),0 - (addr[8]/2)) | |
newVector3(DRAWBOX_TEMP + (VECTOR3_SIZE*2),0 + (addr[6]/2),0 - (addr[7]/2),0 + (addr[8]/2)) | |
newVector3(DRAWBOX_TEMP + (VECTOR3_SIZE*3),0 + (addr[6]/2),0 - (addr[7]/2),0 - (addr[8]/2)) | |
newVector3(DRAWBOX_TEMP + (VECTOR3_SIZE*4),0 - (addr[6]/2),0 + (addr[7]/2),0 + (addr[8]/2)) | |
newVector3(DRAWBOX_TEMP + (VECTOR3_SIZE*5),0 - (addr[6]/2),0 + (addr[7]/2),0 - (addr[8]/2)) | |
newVector3(DRAWBOX_TEMP + (VECTOR3_SIZE*6),0 - (addr[6]/2),0 - (addr[7]/2),0 + (addr[8]/2)) | |
newVector3(DRAWBOX_TEMP + (VECTOR3_SIZE*7),0 - (addr[6]/2),0 - (addr[7]/2),0 - (addr[8]/2)) | |
i -> 0 | |
while i < 8 | |
rotateVector3(DRAWBOX_TEMP + (VECTOR3_SIZE*i),addr[3],addr[4],addr[5]) | |
offsetVector3(DRAWBOX_TEMP + (VECTOR3_SIZE*i),addr+0) | |
i -> i + 1 | |
DrawLine3D(DRAWBOX_TEMP+(VECTOR3_SIZE*0),DRAWBOX_TEMP+(VECTOR3_SIZE*1), addr[9]) | |
DrawLine3D(DRAWBOX_TEMP+(VECTOR3_SIZE*2),DRAWBOX_TEMP+(VECTOR3_SIZE*3), addr[9]) | |
DrawLine3D(DRAWBOX_TEMP+(VECTOR3_SIZE*4),DRAWBOX_TEMP+(VECTOR3_SIZE*5), addr[9]) | |
DrawLine3D(DRAWBOX_TEMP+(VECTOR3_SIZE*6),DRAWBOX_TEMP+(VECTOR3_SIZE*7), addr[9]) | |
DrawLine3D(DRAWBOX_TEMP+(VECTOR3_SIZE*1),DRAWBOX_TEMP+(VECTOR3_SIZE*3), addr[9]) | |
DrawLine3D(DRAWBOX_TEMP+(VECTOR3_SIZE*3),DRAWBOX_TEMP+(VECTOR3_SIZE*7), addr[9]) | |
DrawLine3D(DRAWBOX_TEMP+(VECTOR3_SIZE*7),DRAWBOX_TEMP+(VECTOR3_SIZE*5), addr[9]) | |
DrawLine3D(DRAWBOX_TEMP+(VECTOR3_SIZE*5),DRAWBOX_TEMP+(VECTOR3_SIZE*1), addr[9]) | |
DrawLine3D(DRAWBOX_TEMP+(VECTOR3_SIZE*0),DRAWBOX_TEMP+(VECTOR3_SIZE*2), addr[9]) | |
DrawLine3D(DRAWBOX_TEMP+(VECTOR3_SIZE*2),DRAWBOX_TEMP+(VECTOR3_SIZE*6), addr[9]) | |
DrawLine3D(DRAWBOX_TEMP+(VECTOR3_SIZE*6),DRAWBOX_TEMP+(VECTOR3_SIZE*4), addr[9]) | |
DrawLine3D(DRAWBOX_TEMP+(VECTOR3_SIZE*4),DRAWBOX_TEMP+(VECTOR3_SIZE*0), addr[9]) | |
/* | |
SlideNoteアクター | |
実際に画面に描画されるスライドノートです | |
startX 三次元空間でのノートの始点(左右方向) NoteクラスのLaneから計算される | |
startZ 三次元空間でのノートの始点(奥行) Noteクラスのtimeから計算される | |
width スライドノートの幅 どうせ1レーンの幅STAGE_SPANXになる | |
currentZ ノートがプレイ中の時、手前でノートを途切れさせるのに使う 現在のZ | |
failedCount FAILED_COUNT_THRESHOLD以上になるとミスとなり表示が変わる | |
*/ | |
const SLIDENOTE_SIZE -> 7 | |
def newSlideNote(addr,startX,startZ,endX,endZ,width,currentZ,failedCount) | |
addr[0] -> startX | |
addr[1] -> startZ | |
addr[2] -> endX | |
addr[3] -> endZ | |
addr[4] -> width | |
addr[5] -> currentZ | |
addr[6] -> failedCount | |
def drawSlideNote(addr) | |
s -> DRAW_SLIDENOTE_TEMP | |
e -> DRAW_SLIDENOTE_TEMP + VECTOR3_SIZE | |
ts -> DRAW_SLIDENOTE_TEMP + (VECTOR3_SIZE*2) | |
te -> DRAW_SLIDENOTE_TEMP + (VECTOR3_SIZE*3) | |
startZ -> addr[1] | |
currentZ -> addr[5] | |
endZ -> addr[3] | |
newVector3(s,addr[0],0,addr[1]) | |
newVector3(e,addr[2],0,addr[3]) | |
if startZ < currentZ | |
lerpVector3(s,s,e,(currentZ-startZ*100)/(endZ-startZ)) | |
# 色 | |
color -> ORANGE | |
if addr[6] > FAILED_COUNT_THRESHOLD | |
color -> GRAY | |
# 縦線を描画 | |
DrawLine3D(s,e,color) | |
copyVector3(s,ts) | |
copyVector3(e,te) | |
offsetVector3f(ts,-STAGE_SPANX/2,0,0) | |
offsetVector3f(te,-STAGE_SPANX/2,0,0) | |
DrawLine3D(ts,te,color) | |
offsetVector3f(ts,STAGE_SPANX,0,0) | |
offsetVector3f(te,STAGE_SPANX,0,0) | |
DrawLine3D(ts,te,color) | |
# 横線 | |
newVector3(ts,s[0]-(STAGE_SPANX/2),s[1],s[2]) | |
newVector3(te,s[0]+(STAGE_SPANX/2),s[1],s[2]) | |
DrawLine3D(ts,te,color) | |
newVector3(ts,e[0]-(STAGE_SPANX/2),e[1],e[2]) | |
newVector3(te,e[0]+(STAGE_SPANX/2),e[1],e[2]) | |
DrawLine3D(ts,te,color) | |
/* | |
AirNoteアクター | |
state: 0でフツウ、1で成功した、2でミスった | |
*/ | |
const AIRNOTE_SIZE -> 1+10 | |
def newAirNote(addr,X,Y,Z,state) | |
newBox(addr,X,Y,Z,0,45,45,30,30,30,PURPLE) | |
addr[10] -> state | |
def updateAirNote(addr) | |
addr[3] -> addr[3] + 10 | |
if(addr[10] = 2) | |
addr[9] -> GRAY | |
def drawAirNote(addr) | |
if (addr[10] != 1) | |
s -> DRAW_AIRNOTE_TEMP | |
e -> DRAW_AIRNOTE_TEMP + VECTOR3_SIZE | |
newVector3(s,addr[0],0,addr[2]) | |
if(addr[10] = 0) | |
DrawLine3D(addr,s,LIGHT_GRAY) | |
drawBox(addr) | |
/* | |
Noteクラス プレイする方の譜面のノート これが直接描画されるわけではなく、SlideNoteやAirNoteに随時変換される | |
type: 0でスライドノート、1でエアノート、-1でソングエンド | |
interval: 前のノートから開ける時間 時間は一小節を192とする | |
startLane: 開始時のレーン番号 左端が0 | |
durationOrY: スライドノート時はノートの長さ、エアノートの場合はY | |
endLane: スライドノート時のみ使用 終了時のレーン番号 | |
*/ | |
const NOTE_SIZE -> 5 | |
const BAR_DIVISION -> 192 # 一小節を何分割するか | |
def newNote(addr,type,interval,startLane,durationOrY,endLane) | |
addr[0] -> type | |
addr[1] -> interval | |
addr[2] -> startLane | |
addr[3] -> durationOrY | |
addr[4] -> endLane | |
/* | |
SoundNoteクラス 鳴らす方の音符 | |
*/ | |
const SOUNDNOTE_SIZE -> 4 | |
def newSoundNote(addr,ch,Z,noteNo,atten,vol) | |
addr[0] -> ch | |
addr[1] -> Z | |
addr[2] -> noteNo | |
addr[3] -> atten | |
addr[4] -> vol | |
################## | |
# Main ########### | |
################## | |
#PlaySound(1000,18,10000) | |
#PlayNote(55,18,6000) | |
memory[OUTPUT_CHAR] -> 0x3059 | |
memory[OUTPUT_CHAR] -> 0x3063 | |
memory[OUTPUT_CHAR] -> 0x3054 | |
memory[OUTPUT_CHAR] -> 0x30fc | |
memory[OUTPUT_CHAR] -> 0x3044 | |
memory[OUTPUT_CHAR] -> 0xff01 | |
#drawBox(15000) | |
currentX -> 0 | |
currentY -> 0 | |
currentZ -> -STAGE_SPANY*2 | |
TIME -> 0 | |
memory[DISABLE_AUTOREFRESH] -> 1 | |
newVector3(CAMERA_POS,0,100,-360) | |
newVector3(CAMERA_ROTATE,6,0,0) | |
newBox(TESTBOX,0,20,0,0,0,0,40,40,40,ORANGE) | |
newBox(CURSORBOX,0,0,0,0,0,0,STAGE_SPANX,10,20,ORANGE) | |
loadScore() | |
loadMusic() | |
bgColor -> 999999 | |
currentSoundNoteIndex -> 0 | |
currentNoteIndex -> 0 | |
currentSlideNoteIndex -> 0 | |
currentAirNoteIndex -> 0 | |
playingSlideNoteIndex -> 0 #次に控えた、または今演奏しているスライドノート | |
playingAirNoteIndex -> 0 #次に控えたエアノート | |
slideNoteOnStageCount -> 0 #ステージ上に存在しているスライドノートの個数 | |
airNoteOnStageCount -> 0 #ステージ上に存在しているエアノートの個数 | |
lastestNoteTime -> 0 | |
loadNewNoteFlag -> 0 | |
songEndZ -> 268435454 | |
scoreReadToEnd -> 0 | |
succeedNoteCount -> 0 | |
failedNoteCount -> 0 | |
comboCount -> 0 | |
maxCombo -> 0 | |
songCursor -> 0 | |
#最初にNoteを6個配置する | |
i -> 0 | |
while i < 6 | |
n -> SCORE_DATA+(NOTE_SIZE*currentNoteIndex) | |
if(n[0] = 0) # スライドノートだったら | |
newSlideNote(SLIDE_NOTES+(SLIDENOTE_SIZE*currentSlideNoteIndex), | |
0 - (STAGE_WIDTH/2) + (n[2]*STAGE_SPANX) + (STAGE_SPANX/2), | |
lastestNoteTime + n[1] * STAGE_SPANY / BAR_DIVISION, | |
0 - (STAGE_WIDTH/2) + (n[4]*STAGE_SPANX) + (STAGE_SPANX/2), | |
lastestNoteTime + (n[1]+n[3]) * STAGE_SPANY / BAR_DIVISION, | |
STAGE_SPANX,0,0) | |
slideNoteOnStageCount -> slideNoteOnStageCount + 1 | |
lastestNoteTime -> lastestNoteTime + n[1] + n[3] | |
currentSlideNoteIndex -> currentSlideNoteIndex + 1 | |
if(currentSlideNoteIndex = SLIDE_NOTES_LENGTH) | |
currentSlideNoteIndex -> 0 | |
if(n[0] = 1) # エアノートだったら | |
newAirNote(AIR_NOTES+(AIRNOTE_SIZE*currentAirNoteIndex), | |
0 - (STAGE_WIDTH/2) + (n[2]*STAGE_SPANX) + (STAGE_SPANX/2), | |
n[3], | |
lastestNoteTime + n[1] * STAGE_SPANY / BAR_DIVISION, | |
0) | |
airNoteOnStageCount -> airNoteOnStageCount + 1 | |
currentAirNoteIndex -> currentAirNoteIndex + 1 | |
if(currentAirNoteIndex = SLIDE_NOTES_LENGTH) | |
currentAirNoteIndex -> 0 | |
currentNoteIndex -> currentNoteIndex + 1 | |
i -> i + 1 | |
isPlaying -> 1 | |
while isPlaying | |
bgColor -> ColorLerp(0,bgColor,95) | |
CAMERA_ROTATE[2] -> Lerp(0,CAMERA_ROTATE[2],95) | |
currentZ -> currentZ + STAGE_SPEED | |
CAMERA_POS[2] -> currentZ - 360 | |
if(currentZ > songEndZ) | |
isPlaying -> 0 | |
currentX -> memory[MOUSE_X]-50*160/100 | |
currentY -> HEIGHT - memory[MOUSE_Y]*144/100 - 6 | |
newVector3(CURSORBOX+0,currentX,0,CAMERA_POS[2]+350) | |
# スライドノート処理 | |
playingSlideNote -> SLIDE_NOTES+(SLIDENOTE_SIZE*playingSlideNoteIndex) | |
if(playingSlideNote[1] < currentZ)*(currentZ < playingSlideNote[3]) | |
if Abs(Lerp(playingSlideNote[0],playingSlideNote[2],(currentZ-playingSlideNote[1]*100)/(playingSlideNote[3]-playingSlideNote[1])) - currentX) > SLIDE_JUDGE_THRESHOLD | |
playingSlideNote[6] -> playingSlideNote[6] + 1 #ミス判定を進める | |
if(slideNoteOnStageCount > 0)*(playingSlideNote[3] < currentZ) # スライドノートをプレイし終わったら | |
succeed -> playingSlideNote[6] < FAILED_COUNT_THRESHOLD | |
if succeed # 成功した | |
comboCount -> comboCount + 1 | |
if comboCount > maxCombo | |
maxCombo -> comboCount | |
succeedNoteCount -> succeedNoteCount + 1 | |
#成功エフェクト | |
bgColor -> 161616 | |
if Neg(succeed) | |
comboCount -> 0 | |
failedNoteCount -> failedNoteCount + 1 | |
slideNoteOnStageCount -> slideNoteOnStageCount - 1 | |
loadNewNoteFlag -> loadNewNoteFlag + 1 | |
playingSlideNoteIndex -> playingSlideNoteIndex + 1 | |
if(playingSlideNoteIndex = SLIDE_NOTES_LENGTH) | |
playingSlideNoteIndex -> 0 | |
playingAirNote -> AIR_NOTES+(AIRNOTE_SIZE*playingAirNoteIndex) | |
if(airNoteOnStageCount > 0)*(playingAirNote[2] < currentZ) #エアノートに当たったら | |
succeed -> ((currentX-40) < playingAirNote[0])*(playingAirNote[0] < (currentX+40))*((currentY-40) < playingAirNote[1])*(playingAirNote[1] < (currentY+40)) | |
if succeed #成功した | |
playingAirNote[10] -> 1 | |
comboCount -> comboCount + 1 | |
if comboCount > maxCombo | |
maxCombo -> comboCount | |
succeedNoteCount -> succeedNoteCount + 1 | |
#成功エフェクト | |
bgColor -> currentZ | |
CAMERA_ROTATE[2] -> Sin(TIME*7) / 3 | |
if Neg(succeed) | |
playingAirNote[10] -> 2 #ミスった | |
comboCount -> 0 | |
failedNoteCount -> failedNoteCount + 1 | |
airNoteOnStageCount -> airNoteOnStageCount - 1 | |
loadNewNoteFlag -> loadNewNoteFlag + 1 | |
playingAirNoteIndex -> playingAirNoteIndex + 1 | |
if(playingAirNoteIndex = AIR_NOTES_LENGTH) | |
playingAirNoteIndex -> 0 | |
while(loadNewNoteFlag > 0)*Neg(scoreReadToEnd) | |
# 譜面の読み込みを進める | |
n -> SCORE_DATA+(NOTE_SIZE*currentNoteIndex) | |
if(n[0] = 0) # スライドノートだったら | |
newSlideNote(SLIDE_NOTES+(SLIDENOTE_SIZE*currentSlideNoteIndex), | |
0 - (STAGE_WIDTH/2) + (n[2]*STAGE_SPANX) + (STAGE_SPANX/2), | |
lastestNoteTime + n[1] * STAGE_SPANY / BAR_DIVISION, | |
0 - (STAGE_WIDTH/2) + (n[4]*STAGE_SPANX) + (STAGE_SPANX/2), | |
lastestNoteTime + (n[1]+n[3]) * STAGE_SPANY / BAR_DIVISION, | |
STAGE_SPANX,0,0) | |
slideNoteOnStageCount -> slideNoteOnStageCount + 1 | |
lastestNoteTime -> lastestNoteTime + n[1] + n[3] | |
currentSlideNoteIndex -> currentSlideNoteIndex + 1 | |
if(currentSlideNoteIndex = SLIDE_NOTES_LENGTH) | |
currentSlideNoteIndex -> 0 | |
if(n[0] = 1) # エアノートだったら | |
newAirNote(AIR_NOTES+(AIRNOTE_SIZE*currentAirNoteIndex), | |
0 - (STAGE_WIDTH/2) + (n[2]*STAGE_SPANX) + (STAGE_SPANX/2), | |
n[3], | |
lastestNoteTime + n[1] * STAGE_SPANY / BAR_DIVISION, | |
0) | |
airNoteOnStageCount -> airNoteOnStageCount + 1 | |
lastestNoteTime -> lastestNoteTime + n[1] | |
currentAirNoteIndex -> currentAirNoteIndex + 1 | |
if(currentAirNoteIndex = AIR_NOTES_LENGTH) | |
currentAirNoteIndex -> 0 | |
if(n[0] = -1) # ソングエンドだったら | |
songEndZ -> lastestNoteTime + n[1] * STAGE_SPANY / BAR_DIVISION + 720 | |
scoreReadToEnd -> 1 | |
currentNoteIndex -> currentNoteIndex + 1 | |
loadNewNoteFlag -> loadNewNoteFlag - 1 | |
playingSlideNote[5] -> currentZ | |
# --- | |
Fill(bgColor) | |
#Plot(50+(Cos(TIME*5)/2),50+(Sin(TIME*3)/2),WHITE) | |
#memory[TESTBOX+3] -> memory[TESTBOX+3] + 1 | |
#memory[TESTBOX+4] -> memory[TESTBOX+4] + 1 | |
#memory[TESTBOX+5] -> memory[TESTBOX+5] + 1 | |
#TESTBOX[2] -> TESTBOX[2] + 8 | |
#if(currentZ > 0) | |
# DrawDigits(20,10,currentZ,WHITE) | |
if isPlaying | |
DrawDigits(WIDTH-4,10,comboCount,WHITE) | |
if Neg(isPlaying) | |
DrawDigits(WIDTH-4,10,maxCombo,WHITE) | |
DrawDigits(WIDTH-4,16,succeedNoteCount,RED) | |
DrawDigits(WIDTH-4,22,failedNoteCount,BLUE) | |
DrawDigits(WIDTH-4,28,succeedNoteCount*100/(succeedNoteCount+failedNoteCount),WHITE) | |
DrawGrid3D(CAMERA_POS[0],CAMERA_POS[2]+1080,STAGE_SPANX,STAGE_SPANY,STAGE_WIDTH,STAGE_HEIGHT) | |
i -> 0 | |
while i < SLIDE_NOTES_LENGTH | |
sn -> SLIDE_NOTES+(SLIDENOTE_SIZE*i) | |
if(sn[3] > currentZ) #endZ 手前にあるのは描画しない | |
drawSlideNote(sn) | |
i -> i + 1 | |
i -> 0 | |
while i < AIR_NOTES_LENGTH | |
an -> AIR_NOTES+(AIRNOTE_SIZE*i) | |
if(an[2] > currentZ - STAGE_SPANY) # Z 手前にあるのは描画しない | |
updateAirNote(an) | |
drawAirNote(an) | |
i -> i + 1 | |
drawBox(CURSORBOX) | |
#drawBox(TESTBOX) | |
# おとをならす | |
nextSoundNote -> SONG_DATA + (SOUNDNOTE_SIZE*songCursor) | |
while (nextSoundNote[1] <= (currentZ+2))*(nextSoundNote[0] >= 0) | |
PlayNoteChannel(nextSoundNote[2],nextSoundNote[3],6000,nextSoundNote[0]) | |
songCursor -> songCursor + 1 | |
nextSoundNote -> SONG_DATA + (SOUNDNOTE_SIZE*songCursor) | |
if TIME = 0 | |
PlayNote(75,10,6000) | |
if TIME = 8 | |
PlayNote(80,10,6000) | |
if TIME = 16 | |
PlayNote(87,10,6000) | |
memory[REFRESH] -> 1 | |
TIME -> TIME + 1 | |
#DrawCircle(50,50,10,WHITE) | |
#memory[50000] -> 0 | |
while 0 | |
Fill(0) | |
#DrawLine(50+Cos(TIME),50+Sin(TIME),memory[MOUSE_X],memory[MOUSE_Y], 999999) | |
DrawCircle(50,50,20+(Sin(TIME*8)/10),WHITE) | |
memory[REFRESH] -> 1 | |
TIME -> TIME + 1 | |
################## | |
# Database ####### | |
################## | |
def addNote(type,interval,startLane,durationOrY,endLane) | |
newNote(SCORE_DATA+(NOTE_SIZE*memory[SCORE_DATA_COUNT]),type,interval,startLane,durationOrY,endLane) | |
memory[SCORE_DATA_COUNT] -> memory[SCORE_DATA_COUNT] + 1 | |
def loadScore() | |
# BAR_DIVISIONが192だから16分音符は12、四分音符は48だぜ | |
memory[SCORE_DATA_COUNT] -> 0 | |
addNote(0,0,2,672,1) | |
addNote(0,96,0,72,3) | |
addNote(0,0,3,72,1) | |
addNote(1,0,1,60,0) | |
addNote(0,240,3,72,0) | |
addNote(0,0,0,72,2) | |
addNote(1,0,2,100,0) | |
addNote(0,0,2,240,0) | |
addNote(0,0,0,192,2) | |
addNote(0,0,1,96,2) | |
addNote(0,0,1,96,3) | |
addNote(1,0,3,120,0) | |
#サビ | |
addNote(0,384,0,96,2) | |
addNote(0,96,1,48,3) | |
addNote(0,48,2,48,0) | |
addNote(0,48,0,72,2) | |
addNote(0,0,2,24,1) | |
addNote(0,0,1,48,3) | |
addNote(0,0,3,48,2) | |
addNote(1,0,2,80,0) | |
addNote(0,96,1,24,1) | |
addNote(0,24,2,24,2) | |
addNote(0,24,1,72,1) | |
addNote(0,0,2,24,2) | |
addNote(0,0,3,72,2) | |
addNote(0,0,2,24,0) | |
addNote(1,0,0,60,0) | |
addNote(0,144,2,24,2) | |
addNote(0,0,1,24,1) | |
addNote(0,0,0,96,2) | |
addNote(0,0,2,96,3) | |
addNote(1,0,3,60,0) #エモ地帯 | |
addNote(1,48,2,120,0) | |
addNote(1,48,0,120,0) | |
addNote(1,48,1,60,0) | |
addNote(0,48,1,96,3) | |
addNote(0,96,3,96,1) | |
addNote(0,96,3,144,3) | |
addNote(0,0,3,24,2) | |
addNote(0,0,2,24,0) | |
addNote(1,72,1,80,3) | |
addNote(0,120,2,48,3) | |
addNote(0,0,3,48,2) | |
addNote(0,0,2,48,0) | |
addNote(0,48,1,48,0) | |
addNote(0,0,0,48,1) | |
addNote(0,0,1,48,3) | |
addNote(0,48,3,168,0) | |
addNote(1,0,0,120,0) | |
addNote(1,48,2,120,0) | |
addNote(1,24,3,120,0) | |
addNote(1,144,1,90,0) | |
addNote(-1,192,3,100,0) | |
def addSoundNote(ch,Z,noteNo,atten) | |
newSoundNote(SONG_DATA+(SOUNDNOTE_SIZE*memory[SONG_DATA_COUNT]),ch,Z,noteNo,atten,6000) | |
memory[SONG_DATA_COUNT] -> memory[SONG_DATA_COUNT] + 1 | |
def loadMusic() | |
memory[SONG_DATA_COUNT] -> 0 | |
addSoundNote(0,0,57,8) | |
addSoundNote(2,0,38,8) | |
addSoundNote(1,0,42,14) | |
addSoundNote(0,576,62,8) | |
addSoundNote(0,1152,69,8) | |
addSoundNote(0,1440,67,8) | |
addSoundNote(0,1728,66,8) | |
addSoundNote(0,2016,67,8) | |
addSoundNote(1,2304,44,14) | |
addSoundNote(0,2304,66,8) | |
addSoundNote(2,2304,37,9) | |
addSoundNote(0,2736,57,8) | |
addSoundNote(0,2880,62,8) | |
addSoundNote(0,3456,66,8) | |
addSoundNote(1,3456,49,8) | |
addSoundNote(2,3456,42,9) | |
addSoundNote(0,3744,64,8) | |
addSoundNote(0,4032,66,8) | |
addSoundNote(0,4320,62,16) | |
addSoundNote(0,4392,64,14) | |
addSoundNote(0,4464,66,12) | |
addSoundNote(0,4536,69,11) | |
addSoundNote(1,4608,55,14) | |
addSoundNote(2,4608,43,14) | |
addSoundNote(0,4608,74,11) | |
addSoundNote(0,4752,72,10) | |
addSoundNote(0,4896,70,11) | |
addSoundNote(2,5040,45,14) | |
addSoundNote(0,5040,69,11) | |
addSoundNote(1,5040,57,14) | |
addSoundNote(0,5328,67,11) | |
addSoundNote(2,5472,38,14) | |
addSoundNote(1,5472,54,14) | |
addSoundNote(0,5472,69,9) | |
addSoundNote(0,6624,62,14) | |
addSoundNote(0,6696,64,11) | |
addSoundNote(0,6768,67,11) | |
addSoundNote(0,6840,70,10) | |
addSoundNote(0,6912,72,10) | |
addSoundNote(2,6912,41,14) | |
addSoundNote(1,6912,53,14) | |
addSoundNote(0,7056,70,10) | |
addSoundNote(0,7200,68,11) | |
addSoundNote(2,7344,43,14) | |
addSoundNote(0,7344,67,12) | |
addSoundNote(1,7344,55,14) | |
addSoundNote(0,7632,65,13) | |
addSoundNote(1,7776,52,14) | |
addSoundNote(0,7776,64,9) | |
addSoundNote(2,7776,36,14) | |
addSoundNote(0,8496,67,8) | |
addSoundNote(0,8640,68,8) | |
addSoundNote(0,8784,67,8) | |
addSoundNote(0,8928,63,8) | |
addSoundNote(0,9072,67,8) | |
addSoundNote(2,9216,43,14) | |
addSoundNote(1,9216,55,14) | |
addSoundNote(1,9360,46,8) | |
addSoundNote(2,9360,43,14) | |
addSoundNote(1,9504,49,8) | |
addSoundNote(2,9504,43,14) | |
addSoundNote(1,9648,55,8) | |
addSoundNote(2,9648,43,14) | |
addSoundNote(1,9792,55,14) | |
addSoundNote(2,9792,43,14) | |
addSoundNote(2,9936,43,14) | |
addSoundNote(1,9936,46,8) | |
addSoundNote(1,10080,49,8) | |
addSoundNote(2,10080,43,14) | |
addSoundNote(2,10224,43,14) | |
addSoundNote(1,10224,55,8) | |
addSoundNote(0,10368,68,8) | |
addSoundNote(1,10368,49,14) | |
addSoundNote(2,10368,37,14) | |
addSoundNote(1,10512,41,8) | |
addSoundNote(2,10512,37,14) | |
addSoundNote(1,10656,44,8) | |
addSoundNote(2,10656,37,14) | |
addSoundNote(1,10800,49,8) | |
addSoundNote(2,10800,37,14) | |
addSoundNote(1,10944,51,14) | |
addSoundNote(2,10944,39,14) | |
addSoundNote(0,10944,70,8) | |
addSoundNote(2,11088,39,14) | |
addSoundNote(1,11088,43,8) | |
addSoundNote(2,11232,39,14) | |
addSoundNote(1,11232,46,8) | |
addSoundNote(2,11376,39,14) | |
addSoundNote(1,11376,51,8) | |
addSoundNote(0,11664,63,18) | |
addSoundNote(0,11808,65,18) | |
addSoundNote(0,11952,67,18) | |
addSoundNote(0,12096,68,18) | |
addSoundNote(0,12240,70,18) | |
addSoundNote(0,12384,72,18) | |
addSoundNote(0,12528,73,18) | |
addSoundNote(1,12672,63,18) | |
addSoundNote(2,12672,39,18) | |
addSoundNote(0,12672,75,18) | |
addSoundNote(1,12816,65,18) | |
addSoundNote(2,12816,41,18) | |
addSoundNote(0,12816,77,18) | |
addSoundNote(1,12960,67,18) | |
addSoundNote(2,12960,43,18) | |
addSoundNote(0,12960,79,18) | |
addSoundNote(1,13104,65,18) | |
addSoundNote(0,13104,77,18) | |
addSoundNote(2,13104,41,18) | |
addSoundNote(1,13248,63,17) | |
addSoundNote(0,13248,75,17) | |
addSoundNote(2,13248,39,17) | |
addSoundNote(0,13392,73,16) | |
addSoundNote(1,13392,61,16) | |
addSoundNote(2,13392,37,16) | |
addSoundNote(1,13536,60,16) | |
addSoundNote(0,13536,72,16) | |
addSoundNote(2,13536,36,16) | |
addSoundNote(2,13680,34,15) | |
addSoundNote(0,13680,70,15) | |
addSoundNote(1,13680,58,15) | |
addSoundNote(0,13824,75,10) | |
addSoundNote(1,13824,44,19) | |
addSoundNote(2,13824,32,8) | |
addSoundNote(1,13968,48,19) | |
addSoundNote(2,13968,44,8) | |
addSoundNote(1,14112,51,19) | |
addSoundNote(2,14112,32,8) | |
addSoundNote(1,14256,44,19) | |
addSoundNote(2,14256,44,8) | |
addSoundNote(1,14400,48,19) | |
addSoundNote(0,14400,80,10) | |
addSoundNote(2,14400,32,8) | |
addSoundNote(2,14544,44,8) | |
addSoundNote(1,14544,51,19) | |
addSoundNote(2,14688,32,8) | |
addSoundNote(1,14688,56,19) | |
addSoundNote(2,14832,44,8) | |
addSoundNote(1,14832,48,19) | |
addSoundNote(0,14976,87,11) | |
addSoundNote(1,14976,56,19) | |
addSoundNote(2,14976,32,8) | |
addSoundNote(2,15120,44,8) | |
addSoundNote(1,15120,48,19) | |
addSoundNote(0,15264,85,12) | |
addSoundNote(1,15264,51,19) | |
addSoundNote(2,15264,32,8) | |
addSoundNote(2,15408,44,8) | |
addSoundNote(1,15408,56,19) | |
addSoundNote(1,15552,51,19) | |
addSoundNote(0,15552,84,11) | |
addSoundNote(2,15552,32,8) | |
addSoundNote(2,15696,44,8) | |
addSoundNote(1,15696,56,19) | |
addSoundNote(0,15840,85,12) | |
addSoundNote(2,15840,32,8) | |
addSoundNote(1,15840,48,19) | |
addSoundNote(2,15984,44,8) | |
addSoundNote(1,15984,51,20) | |
addSoundNote(0,16128,84,10) | |
addSoundNote(2,16128,31,9) | |
addSoundNote(1,16128,53,20) | |
addSoundNote(2,16272,43,9) | |
addSoundNote(1,16272,43,21) | |
addSoundNote(1,16416,46,22) | |
addSoundNote(2,16416,31,9) | |
addSoundNote(2,16560,43,9) | |
addSoundNote(0,16560,77,11) | |
addSoundNote(1,16560,49,22) | |
addSoundNote(2,16704,31,9) | |
addSoundNote(0,16704,80,9) | |
addSoundNote(1,16704,43,22) | |
addSoundNote(2,16848,43,9) | |
addSoundNote(1,16848,55,22) | |
addSoundNote(2,16992,31,9) | |
addSoundNote(1,16992,43,21) | |
addSoundNote(1,17136,53,20) | |
addSoundNote(2,17136,43,9) | |
addSoundNote(1,17280,52,20) | |
addSoundNote(2,17280,36,9) | |
addSoundNote(1,17424,48,20) | |
addSoundNote(2,17424,48,9) | |
addSoundNote(1,17568,43,20) | |
addSoundNote(2,17568,36,9) | |
addSoundNote(1,17712,48,19) | |
addSoundNote(2,17712,48,9) | |
addSoundNote(0,17856,80,14) | |
addSoundNote(1,17856,43,19) | |
addSoundNote(2,17856,36,9) | |
addSoundNote(2,18000,48,9) | |
addSoundNote(0,18000,82,13) | |
addSoundNote(1,18000,52,19) | |
addSoundNote(1,18144,46,20) | |
addSoundNote(0,18144,84,12) | |
addSoundNote(2,18144,36,9) | |
addSoundNote(2,18288,48,9) | |
addSoundNote(1,18288,48,20) | |
addSoundNote(0,18288,85,11) | |
addSoundNote(1,18432,44,19) | |
addSoundNote(2,18432,29,9) | |
addSoundNote(0,18432,84,9) | |
addSoundNote(1,18576,48,21) | |
addSoundNote(2,18576,41,9) | |
addSoundNote(2,18720,29,9) | |
addSoundNote(1,18720,56,21) | |
addSoundNote(2,18864,41,9) | |
addSoundNote(1,18864,48,21) | |
addSoundNote(0,18864,75,14) | |
addSoundNote(0,19008,80,9) | |
addSoundNote(2,19008,29,9) | |
addSoundNote(1,19008,44,21) | |
addSoundNote(2,19152,41,9) | |
addSoundNote(1,19152,56,21) | |
addSoundNote(2,19296,29,9) | |
addSoundNote(1,19296,44,21) | |
addSoundNote(2,19440,41,9) | |
addSoundNote(1,19440,53,21) | |
addSoundNote(1,19584,56,21) | |
addSoundNote(2,19584,29,9) | |
addSoundNote(1,19728,48,19) | |
addSoundNote(2,19728,41,9) | |
addSoundNote(2,19872,29,9) | |
addSoundNote(1,19872,44,18) | |
addSoundNote(2,20016,41,9) | |
addSoundNote(1,20016,48,18) | |
addSoundNote(1,20160,56,17) | |
addSoundNote(2,20160,29,9) | |
addSoundNote(1,20304,48,17) | |
addSoundNote(2,20304,41,9) | |
addSoundNote(1,20448,52,17) | |
addSoundNote(2,20448,28,9) | |
addSoundNote(0,20448,80,12) | |
addSoundNote(0,20592,79,11) | |
addSoundNote(2,20592,40,9) | |
addSoundNote(1,20592,51,17) | |
addSoundNote(1,20736,42,17) | |
addSoundNote(0,20736,78,10) | |
addSoundNote(2,20736,27,9) | |
addSoundNote(1,20880,51,18) | |
addSoundNote(2,20880,39,9) | |
addSoundNote(1,21024,42,18) | |
addSoundNote(2,21024,27,9) | |
addSoundNote(1,21168,46,18) | |
addSoundNote(2,21168,39,9) | |
addSoundNote(2,21312,27,9) | |
addSoundNote(0,21312,89,8) | |
addSoundNote(1,21312,51,18) | |
addSoundNote(2,21456,39,9) | |
addSoundNote(1,21456,46,19) | |
addSoundNote(1,21600,42,19) | |
addSoundNote(2,21600,27,9) | |
addSoundNote(1,21744,46,19) | |
addSoundNote(2,21744,39,9) | |
addSoundNote(1,21888,51,18) | |
addSoundNote(0,21888,87,11) | |
addSoundNote(2,21888,32,9) | |
addSoundNote(2,22032,44,9) | |
addSoundNote(1,22032,44,19) | |
addSoundNote(1,22176,41,20) | |
addSoundNote(0,22176,85,10) | |
addSoundNote(2,22176,32,9) | |
addSoundNote(2,22320,44,9) | |
addSoundNote(1,22320,44,20) | |
addSoundNote(0,22464,84,10) | |
addSoundNote(1,22464,51,18) | |
addSoundNote(2,22464,32,9) | |
addSoundNote(2,22608,44,9) | |
addSoundNote(1,22608,44,17) | |
addSoundNote(2,22752,32,9) | |
addSoundNote(1,22752,51,17) | |
addSoundNote(0,22752,85,10) | |
addSoundNote(2,22896,44,9) | |
addSoundNote(1,22896,52,17) | |
addSoundNote(2,23040,37,9) | |
addSoundNote(0,23040,87,10) | |
addSoundNote(1,23040,53,16) | |
addSoundNote(2,23184,49,9) | |
addSoundNote(1,23184,48,18) | |
addSoundNote(0,23328,80,16) | |
addSoundNote(2,23328,37,9) | |
addSoundNote(1,23328,44,19) | |
addSoundNote(2,23472,49,9) | |
addSoundNote(0,23472,80,12) | |
addSoundNote(1,23472,48,20) | |
addSoundNote(2,23616,37,9) | |
addSoundNote(1,23616,53,20) | |
addSoundNote(1,23760,48,21) | |
addSoundNote(0,23760,77,9) | |
addSoundNote(2,23760,49,9) | |
addSoundNote(2,23904,37,9) | |
addSoundNote(1,23904,53,21) | |
addSoundNote(2,24048,49,9) | |
addSoundNote(1,24048,44,21) | |
addSoundNote(0,24048,82,10) | |
addSoundNote(2,24192,39,9) | |
addSoundNote(1,24192,55,21) | |
addSoundNote(2,24336,51,9) | |
addSoundNote(1,24336,51,21) | |
addSoundNote(1,24480,43,21) | |
addSoundNote(2,24480,39,9) | |
addSoundNote(2,24624,51,9) | |
addSoundNote(1,24624,46,20) | |
addSoundNote(2,24768,39,9) | |
addSoundNote(1,24768,55,19) | |
addSoundNote(2,24912,51,9) | |
addSoundNote(1,24912,51,19) | |
addSoundNote(1,25056,43,19) | |
addSoundNote(2,25056,39,9) | |
addSoundNote(0,25056,84,13) | |
addSoundNote(1,25200,46,18) | |
addSoundNote(2,25200,51,9) | |
addSoundNote(0,25200,85,12) | |
addSoundNote(0,25344,87,8) | |
addSoundNote(2,25344,32,9) | |
addSoundNote(1,25344,48,18) | |
addSoundNote(1,25488,44,18) | |
addSoundNote(2,25488,44,9) | |
addSoundNote(1,25632,48,17) | |
addSoundNote(2,25632,32,9) | |
addSoundNote(0,25632,80,14) | |
addSoundNote(2,25776,44,9) | |
addSoundNote(0,25776,80,8) | |
addSoundNote(1,25776,51,18) | |
addSoundNote(1,25920,44,19) | |
addSoundNote(2,25920,32,9) | |
addSoundNote(0,26064,77,13) | |
addSoundNote(2,26064,44,9) | |
addSoundNote(1,26064,48,19) | |
addSoundNote(2,26208,32,9) | |
addSoundNote(1,26208,51,19) | |
addSoundNote(0,26352,82,12) | |
addSoundNote(2,26352,44,9) | |
addSoundNote(1,26352,44,19) | |
addSoundNote(2,26496,34,9) | |
addSoundNote(1,26496,51,19) | |
addSoundNote(2,26640,46,9) | |
addSoundNote(1,26640,43,19) | |
addSoundNote(0,26640,84,12) | |
addSoundNote(0,26784,82,11) | |
addSoundNote(2,26784,34,9) | |
addSoundNote(1,26784,46,19) | |
addSoundNote(1,26928,45,19) | |
addSoundNote(0,26928,81,10) | |
addSoundNote(2,26928,33,8) | |
addSoundNote(1,27072,42,18) | |
addSoundNote(2,27216,45,9) | |
addSoundNote(1,27216,50,18) | |
addSoundNote(1,27360,42,18) | |
addSoundNote(0,27360,77,19) | |
addSoundNote(2,27360,33,9) | |
addSoundNote(0,27504,79,15) | |
addSoundNote(1,27504,45,18) | |
addSoundNote(2,27504,45,9) | |
addSoundNote(2,27648,37,9) | |
addSoundNote(1,27648,41,18) | |
addSoundNote(0,27648,80,14) | |
addSoundNote(1,27792,49,18) | |
addSoundNote(0,27792,79,13) | |
addSoundNote(2,27792,49,9) | |
addSoundNote(1,27936,56,17) | |
addSoundNote(2,27936,37,9) | |
addSoundNote(0,27936,77,12) | |
addSoundNote(1,28080,49,17) | |
addSoundNote(2,28080,49,9) | |
addSoundNote(0,28080,80,10) | |
addSoundNote(1,28224,41,17) | |
addSoundNote(2,28224,37,9) | |
addSoundNote(1,28368,56,17) | |
addSoundNote(2,28368,49,9) | |
addSoundNote(2,28512,37,9) | |
addSoundNote(1,28512,44,17) | |
addSoundNote(0,28512,80,19) | |
addSoundNote(2,28656,49,8) | |
addSoundNote(1,28656,49,17) | |
addSoundNote(0,28656,80,17) | |
addSoundNote(1,28800,43,17) | |
addSoundNote(2,28800,39,9) | |
addSoundNote(0,28800,82,14) | |
addSoundNote(1,28944,51,17) | |
addSoundNote(2,28944,51,9) | |
addSoundNote(0,28944,80,12) | |
addSoundNote(1,29088,58,17) | |
addSoundNote(0,29088,79,11) | |
addSoundNote(2,29088,39,9) | |
addSoundNote(0,29232,82,10) | |
addSoundNote(1,29232,51,17) | |
addSoundNote(2,29232,51,9) | |
addSoundNote(1,29376,43,17) | |
addSoundNote(2,29376,39,9) | |
addSoundNote(2,29520,51,9) | |
addSoundNote(1,29520,58,18) | |
addSoundNote(2,29664,39,9) | |
addSoundNote(1,29664,51,17) | |
addSoundNote(0,29664,82,14) | |
addSoundNote(2,29808,51,8) | |
addSoundNote(1,29808,46,17) | |
addSoundNote(0,29808,82,12) | |
addSoundNote(0,29952,84,11) | |
addSoundNote(1,29952,44,17) | |
addSoundNote(2,29952,41,9) | |
addSoundNote(2,30096,53,9) | |
addSoundNote(1,30096,48,17) | |
addSoundNote(0,30240,80,17) | |
addSoundNote(2,30240,41,9) | |
addSoundNote(1,30240,53,16) | |
addSoundNote(0,30384,82,10) | |
addSoundNote(1,30384,48,16) | |
addSoundNote(2,30384,53,9) | |
addSoundNote(2,30528,41,9) | |
addSoundNote(1,30528,44,15) | |
addSoundNote(1,30672,53,14) | |
addSoundNote(2,30672,53,9) | |
addSoundNote(0,30672,83,14) | |
addSoundNote(1,30816,44,14) | |
addSoundNote(2,30816,41,9) | |
addSoundNote(2,30960,43,8) | |
addSoundNote(0,30960,84,12) | |
addSoundNote(1,30960,49,12) | |
addSoundNote(0,31248,85,18) | |
addSoundNote(1,31248,49,12) | |
addSoundNote(2,31248,43,8) | |
addSoundNote(1,31392,49,15) | |
addSoundNote(0,31392,84,19) | |
addSoundNote(2,31392,43,14) | |
addSoundNote(0,31680,82,18) | |
addSoundNote(0,31824,80,16) | |
addSoundNote(0,31968,79,14) | |
addSoundNote(0,32112,82,12) | |
addSoundNote(2,32256,32,8) | |
addSoundNote(1,32256,51,8) | |
addSoundNote(0,32256,82,10) | |
addSoundNote(0,32544,80,8) | |
addSoundNote(-1,7488,92,8) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment