diff --git a/th02/music/polygons.asm b/th02/music/polygons.asm new file mode 100644 index 00000000..0f08e43d --- /dev/null +++ b/th02/music/polygons.asm @@ -0,0 +1,297 @@ +; Already decompiled in th02\op_06.c, but we need to haul this around until we +; can insert the C version into TH03, TH04 and TH05. Everything here is +; identical in all 4 games. + +; ... well, except for this. Even though TH05 does allocate space for 16 +; polygons in the BSS segment as well. +if GAME eq 5 +POLYGONS_RENDERED = 14 +else +POLYGONS_RENDERED = 16 +endif + +polygon_build proc near + +var_3 = byte ptr -3 +var_2 = word ptr -2 +arg_0 = byte ptr 4 +arg_2 = word ptr 6 +arg_4 = word ptr 8 +arg_6 = word ptr 0Ah +arg_8 = word ptr 0Ch +arg_A = word ptr 0Eh + + enter 4, 0 + push si + push di + mov di, [bp+arg_A] + sar [bp+arg_6], 4 + mov [bp+var_2], 0 + jmp short loc_A67F + +loc_A628: + mov ax, [bp+var_2] + shl ax, 8 + cwd + idiv [bp+arg_2] + add al, [bp+arg_0] + mov [bp+var_3], al + +if GAME ge 4 + push [bp+arg_8] + push [bp+arg_4] + mov ah, 0 + add ax, ax + mov bx, ax + push _CosTable8[bx] + call vector1_at +else + mov ah, 0 + add ax, ax + mov bx, ax + push _CosTable8[bx] + push [bp+arg_4] + push [bp+arg_8] + call vector1_at + add sp, 6 +endif + + mov bx, [bp+var_2] + shl bx, 2 + mov [bx+di], ax + +if GAME ge 4 + push [bp+arg_6] + push [bp+arg_4] + mov al, [bp+var_3] + mov ah, 0 + add ax, ax + mov bx, ax + push _SinTable8[bx] + call vector1_at +else + mov al, [bp+var_3] + mov ah, 0 + add ax, ax + mov bx, ax + push _SinTable8[bx] + push [bp+arg_4] + push [bp+arg_6] + call vector1_at + add sp, 6 +endif + + mov bx, [bp+var_2] + shl bx, 2 + mov [bx+di+2], ax + inc [bp+var_2] + +loc_A67F: + mov ax, [bp+var_2] + cmp ax, [bp+arg_2] + jl short loc_A628 + mov bx, [bp+var_2] + shl bx, 2 + mov ax, [di] + mov [bx+di], ax + mov bx, [bp+var_2] + shl bx, 2 + mov ax, [di+2] + mov [bx+di+2], ax + pop di + pop si + leave + retn 0Ch +polygon_build endp + +polygons_update_and_render proc near + push bp + mov bp, sp + push si + cmp polygons_initialized, 0 + jnz loc_A752 + xor si, si + jmp loc_A746 + +loc_A6B5: + call IRand + mov bx, 280h + cwd + idiv bx + mov bx, si + shl bx, 2 + mov polygon_pos.x[bx], dx + call IRand + mov bx, 1900h + cwd + idiv bx + mov bx, si + shl bx, 2 + mov polygon_pos.y[bx], dx + call IRand + and ax, 7 + mov dx, 4 + sub dx, ax + mov bx, si + shl bx, 2 + mov polygon_move_speed.x[bx], dx + mov bx, si + shl bx, 2 + cmp polygon_move_speed.x[bx], 0 + jnz short loc_A70A + mov bx, si + shl bx, 2 + mov polygon_move_speed.x[bx], 1 + +loc_A70A: + call IRand + and ax, 3 + shl ax, 4 + add ax, 20h ; ' ' + mov bx, si + shl bx, 2 + mov polygon_move_speed.y[bx], ax + call IRand + mov polygon_angle[si], al + call IRand + and al, 7 + mov dl, 4 + sub dl, al + mov polygon_rot_speed[si], dl + cmp polygon_rot_speed[si], 0 + jnz short loc_A745 + mov polygon_rot_speed[si], 4 + +loc_A745: + inc si + +loc_A746: + cmp si, POLYGONS_RENDERED + jl loc_A6B5 + mov polygons_initialized, 1 + +loc_A752: + xor si, si + jmp loc_A88F + +loc_A757: + push offset polygon_points + mov bx, si + shl bx, 2 + push polygon_pos.x[bx] + mov bx, si + shl bx, 2 + push polygon_pos.y[bx] + mov ax, si + and ax, 3 + shl ax, 4 + add ax, 40h + push ax + mov ax, si + mov bx, 4 + cwd + idiv bx + add ax, 3 + push ax + mov al, polygon_angle[si] + push ax + call polygon_build + mov bx, si + shl bx, 2 + mov ax, polygon_move_speed.x[bx] + mov bx, si + shl bx, 2 + add polygon_pos.x[bx], ax + mov bx, si + shl bx, 2 + mov ax, polygon_move_speed.y[bx] + mov bx, si + shl bx, 2 + add polygon_pos.y[bx], ax + mov al, polygon_rot_speed[si] + add polygon_angle[si], al + mov bx, si + shl bx, 2 + cmp polygon_pos.x[bx], 0 + jle short loc_A7D1 + mov bx, si + shl bx, 2 + cmp polygon_pos.x[bx], 27Fh + jl short loc_A7E3 + +loc_A7D1: + mov bx, si + shl bx, 2 + mov dx, 0FFFFh + mov ax, polygon_move_speed.x[bx] + imul dx + mov polygon_move_speed.x[bx], ax + +loc_A7E3: + mov bx, si + shl bx, 2 + cmp polygon_pos.y[bx], 1F40h + jl loc_A879 + call IRand + mov bx, 280h + cwd + idiv bx + mov bx, si + shl bx, 2 + mov polygon_pos.x[bx], dx + mov bx, si + shl bx, 2 + mov polygon_pos.y[bx], 0F9C0h + call IRand + and ax, 0Fh + mov dx, 8 + sub dx, ax + mov bx, si + shl bx, 2 + mov polygon_move_speed.x[bx], dx + mov bx, si + shl bx, 2 + cmp polygon_move_speed.x[bx], 0 + jnz short loc_A83E + mov bx, si + shl bx, 2 + mov polygon_move_speed.x[bx], 1 + +loc_A83E: + call IRand + and ax, 3 + shl ax, 4 + add ax, 20h ; ' ' + mov bx, si + shl bx, 2 + mov polygon_move_speed.y[bx], ax + call IRand + mov polygon_angle[si], al + call IRand + and al, 7 + mov dl, 4 + sub dl, al + mov polygon_rot_speed[si], dl + cmp polygon_rot_speed[si], 0 + jnz short loc_A879 + mov polygon_rot_speed[si], 4 + +loc_A879: + push ds + push offset polygon_points + mov ax, si + mov bx, 4 + cwd + idiv bx + add ax, 3 + push ax + call grcg_polygon_c + inc si + +loc_A88F: + cmp si, POLYGONS_RENDERED + jl loc_A757 + pop si + pop bp + retn +polygons_update_and_render endp diff --git a/th02/music/polygons[bss].asm b/th02/music/polygons[bss].asm new file mode 100644 index 00000000..12e483ab --- /dev/null +++ b/th02/music/polygons[bss].asm @@ -0,0 +1,5 @@ +polygon_points Point 0Ah dup() +polygon_pos Point 10h dup() +polygon_move_speed Point 10h dup() +polygon_angle db 10h dup(?) +polygon_rot_speed db 10h dup(?) diff --git a/th02/music/polygons[data].asm b/th02/music/polygons[data].asm new file mode 100644 index 00000000..b9be5e5f --- /dev/null +++ b/th02/music/polygons[data].asm @@ -0,0 +1 @@ +polygons_initialized db 0 diff --git a/th03_op.asm b/th03_op.asm index 729fd304..b78adb7d 100644 --- a/th03_op.asm +++ b/th03_op.asm @@ -1871,280 +1871,7 @@ sub_A5F6 proc near retn sub_A5F6 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_A614 proc near - -var_3 = byte ptr -3 -var_2 = word ptr -2 -arg_0 = byte ptr 4 -arg_2 = word ptr 6 -arg_4 = word ptr 8 -arg_6 = word ptr 0Ah -arg_8 = word ptr 0Ch -arg_A = word ptr 0Eh - - enter 4, 0 - push si - push di - mov di, [bp+arg_A] - sar [bp+arg_6], 4 - mov [bp+var_2], 0 - jmp short loc_A67F -; --------------------------------------------------------------------------- - -loc_A628: - mov ax, [bp+var_2] - shl ax, 8 - cwd - idiv [bp+arg_2] - add al, [bp+arg_0] - mov [bp+var_3], al - mov ah, 0 - add ax, ax - mov bx, ax - push word ptr [bx+396h] - push [bp+arg_4] - push [bp+arg_8] - call vector1_at - add sp, 6 - mov bx, [bp+var_2] - shl bx, 2 - mov [bx+di], ax - mov al, [bp+var_3] - mov ah, 0 - add ax, ax - mov bx, ax - push word ptr [bx+316h] - push [bp+arg_4] - push [bp+arg_6] - call vector1_at - add sp, 6 - mov bx, [bp+var_2] - shl bx, 2 - mov [bx+di+2], ax - inc [bp+var_2] - -loc_A67F: - mov ax, [bp+var_2] - cmp ax, [bp+arg_2] - jl short loc_A628 - mov bx, [bp+var_2] - shl bx, 2 - mov ax, [di] - mov [bx+di], ax - mov bx, [bp+var_2] - shl bx, 2 - mov ax, [di+2] - mov [bx+di+2], ax - pop di - pop si - leave - retn 0Ch -sub_A614 endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_A6A3 proc near - push bp - mov bp, sp - push si - cmp byte_DE82, 0 - jnz loc_A752 - xor si, si - jmp loc_A746 -; --------------------------------------------------------------------------- - -loc_A6B5: - call IRand - mov bx, 280h - cwd - idiv bx - mov bx, si - shl bx, 2 - mov [bx+1F98h], dx - call IRand - mov bx, 1900h - cwd - idiv bx - mov bx, si - shl bx, 2 - mov [bx+1F9Ah], dx - call IRand - and ax, 7 - mov dx, 4 - sub dx, ax - mov bx, si - shl bx, 2 - mov [bx+1FD8h], dx - mov bx, si - shl bx, 2 - cmp word ptr [bx+1FD8h], 0 - jnz short loc_A70A - mov bx, si - shl bx, 2 - mov word ptr [bx+1FD8h], 1 - -loc_A70A: - call IRand - and ax, 3 - shl ax, 4 - add ax, 20h ; ' ' - mov bx, si - shl bx, 2 - mov [bx+1FDAh], ax - call IRand - mov [si+2018h], al - call IRand - and al, 7 - mov dl, 4 - sub dl, al - mov [si+2028h], dl - cmp byte ptr [si+2028h], 0 - jnz short loc_A745 - mov byte ptr [si+2028h], 4 - -loc_A745: - inc si - -loc_A746: - cmp si, 10h - jl loc_A6B5 - mov byte_DE82, 1 - -loc_A752: - xor si, si - jmp loc_A88F -; --------------------------------------------------------------------------- - -loc_A757: - push 1F70h - mov bx, si - shl bx, 2 - push word ptr [bx+1F98h] - mov bx, si - shl bx, 2 - push word ptr [bx+1F9Ah] - mov ax, si - and ax, 3 - shl ax, 4 - add ax, 40h - push ax - mov ax, si - mov bx, 4 - cwd - idiv bx - add ax, 3 - push ax - mov al, [si+2018h] - push ax - call sub_A614 - mov bx, si - shl bx, 2 - mov ax, [bx+1FD8h] - mov bx, si - shl bx, 2 - add [bx+1F98h], ax - mov bx, si - shl bx, 2 - mov ax, [bx+1FDAh] - mov bx, si - shl bx, 2 - add [bx+1F9Ah], ax - mov al, [si+2028h] - add [si+2018h], al - mov bx, si - shl bx, 2 - cmp word ptr [bx+1F98h], 0 - jle short loc_A7D1 - mov bx, si - shl bx, 2 - cmp word ptr [bx+1F98h], 27Fh - jl short loc_A7E3 - -loc_A7D1: - mov bx, si - shl bx, 2 - mov dx, 0FFFFh - mov ax, [bx+1FD8h] - imul dx - mov [bx+1FD8h], ax - -loc_A7E3: - mov bx, si - shl bx, 2 - cmp word ptr [bx+1F9Ah], 1F40h - jl loc_A879 - call IRand - mov bx, 280h - cwd - idiv bx - mov bx, si - shl bx, 2 - mov [bx+1F98h], dx - mov bx, si - shl bx, 2 - mov word ptr [bx+1F9Ah], 0F9C0h - call IRand - and ax, 0Fh - mov dx, 8 - sub dx, ax - mov bx, si - shl bx, 2 - mov [bx+1FD8h], dx - mov bx, si - shl bx, 2 - cmp word ptr [bx+1FD8h], 0 - jnz short loc_A83E - mov bx, si - shl bx, 2 - mov word ptr [bx+1FD8h], 1 - -loc_A83E: - call IRand - and ax, 3 - shl ax, 4 - add ax, 20h ; ' ' - mov bx, si - shl bx, 2 - mov [bx+1FDAh], ax - call IRand - mov [si+2018h], al - call IRand - and al, 7 - mov dl, 4 - sub dl, al - mov [si+2028h], dl - cmp byte ptr [si+2028h], 0 - jnz short loc_A879 - mov byte ptr [si+2028h], 4 - -loc_A879: - push ds - push offset unk_F760 - mov ax, si - mov bx, 4 - cwd - idiv bx - add ax, 3 - push ax - call grcg_polygon_c - inc si - -loc_A88F: - cmp si, 10h - jl loc_A757 - pop si - pop bp - retn -sub_A6A3 endp - +include th02/music/polygons.asm ; =============== S U B R O U T I N E ======================================= @@ -2155,7 +1882,7 @@ sub_A899 proc near mov bp, sp call sub_A5F6 call grcg_setcolor pascal, ((GC_RMW or GC_B) shl 16) + 15 - call sub_A6A3 + call polygons_update_and_render call grcg_off mov dx, 0A4h ; '、' mov al, byte ptr word_F828+1 @@ -2559,7 +2286,7 @@ loc_AC15: call pi_slot_palette_apply pascal, 0 call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 - mov al, byte_DE83 + mov al, music_track_playing mov byte ptr word_F828, al push word_F828 call sub_A590 @@ -2576,13 +2303,13 @@ loc_AC15: mov dx, 0A6h ; 'ヲ' mov al, 1 out dx, al - mov al, byte_DE83 + mov al, music_track_playing mov ah, 0 call sub_AB99 pascal, ax mov dx, 0A6h ; 'ヲ' mov al, 0 out dx, al - mov al, byte_DE83 + mov al, music_track_playing mov ah, 0 call sub_AB99 pascal, ax mov PaletteTone, 64h ; 'd' @@ -2667,7 +2394,7 @@ loc_AD52: add sp, 6 kajacall KAJA_SONG_PLAY mov al, byte ptr word_F828 - mov byte_DE83, al + mov music_track_playing, al mov ah, 0 call sub_AB99 pascal, ax call sub_A899 @@ -6367,8 +6094,8 @@ byte_DDE0 db 0 dd aDemo5_m ; "demo5.m" dd aEd_m ; "ed.m" dd aScore_m ; "score.m" -byte_DE82 db 0 -byte_DE83 db 0 +include th02/music/polygons[data].asm +music_track_playing db 0 aNo_1B@cVOul db 'NO.1  夢は時空を越えて ',0 aNo_2B@B@Select db 'NO.2     Selection ',0 aNo_3Umx db 'NO.3 東方妖恋談 ',0 @@ -6641,59 +6368,7 @@ word_F296 dw ? dd ? ; include th02/formats/pi_slots[bss].asm include th03/formats/hfliplut[bss].asm -unk_F760 db ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - db ? ; - db ? ; - db ? ; +include th02/music/polygons[bss].asm word_F828 dw ? word_F82A dw ? unk_F82C db ? ; diff --git a/th04_op.asm b/th04_op.asm index 15978231..734d4800 100644 --- a/th04_op.asm +++ b/th04_op.asm @@ -3143,278 +3143,7 @@ sub_BFA7 proc near retn sub_BFA7 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_BFC5 proc near - -var_3 = byte ptr -3 -var_2 = word ptr -2 -arg_0 = byte ptr 4 -arg_2 = word ptr 6 -arg_4 = word ptr 8 -arg_6 = word ptr 0Ah -arg_8 = word ptr 0Ch -arg_A = word ptr 0Eh - - enter 4, 0 - push si - push di - mov di, [bp+arg_A] - sar [bp+arg_6], 4 - mov [bp+var_2], 0 - jmp short loc_C02A -; --------------------------------------------------------------------------- - -loc_BFD9: - mov ax, [bp+var_2] - shl ax, 8 - cwd - idiv [bp+arg_2] - add al, [bp+arg_0] - mov [bp+var_3], al - push [bp+arg_8] - push [bp+arg_4] - mov ah, 0 - add ax, ax - mov bx, ax - push word ptr [bx+648h] - call vector1_at - mov bx, [bp+var_2] - shl bx, 2 - mov [bx+di], ax - push [bp+arg_6] - push [bp+arg_4] - mov al, [bp+var_3] - mov ah, 0 - add ax, ax - mov bx, ax - push word ptr [bx+5C8h] - call vector1_at - mov bx, [bp+var_2] - shl bx, 2 - mov [bx+di+2], ax - inc [bp+var_2] - -loc_C02A: - mov ax, [bp+var_2] - cmp ax, [bp+arg_2] - jl short loc_BFD9 - mov bx, [bp+var_2] - shl bx, 2 - mov ax, [di] - mov [bx+di], ax - mov bx, [bp+var_2] - shl bx, 2 - mov ax, [di+2] - mov [bx+di+2], ax - pop di - pop si - leave - retn 0Ch -sub_BFC5 endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_C04E proc near - push bp - mov bp, sp - push si - cmp byte_102AE, 0 - jnz loc_C0FD - xor si, si - jmp loc_C0F1 -; --------------------------------------------------------------------------- - -loc_C060: - call IRand - mov bx, 280h - cwd - idiv bx - mov bx, si - shl bx, 2 - mov [bx+39DCh], dx - call IRand - mov bx, 1900h - cwd - idiv bx - mov bx, si - shl bx, 2 - mov [bx+39DEh], dx - call IRand - and ax, 7 - mov dx, 4 - sub dx, ax - mov bx, si - shl bx, 2 - mov [bx+3A1Ch], dx - mov bx, si - shl bx, 2 - cmp word ptr [bx+3A1Ch], 0 - jnz short loc_C0B5 - mov bx, si - shl bx, 2 - mov word ptr [bx+3A1Ch], 1 - -loc_C0B5: - call IRand - and ax, 3 - shl ax, 4 - add ax, 20h ; ' ' - mov bx, si - shl bx, 2 - mov [bx+3A1Eh], ax - call IRand - mov [si+3A5Ch], al - call IRand - and al, 7 - mov dl, 4 - sub dl, al - mov [si+3A6Ch], dl - cmp byte ptr [si+3A6Ch], 0 - jnz short loc_C0F0 - mov byte ptr [si+3A6Ch], 4 - -loc_C0F0: - inc si - -loc_C0F1: - cmp si, 10h - jl loc_C060 - mov byte_102AE, 1 - -loc_C0FD: - xor si, si - jmp loc_C23A -; --------------------------------------------------------------------------- - -loc_C102: - push 39B4h - mov bx, si - shl bx, 2 - push word ptr [bx+39DCh] - mov bx, si - shl bx, 2 - push word ptr [bx+39DEh] - mov ax, si - and ax, 3 - shl ax, 4 - add ax, 40h - push ax - mov ax, si - mov bx, 4 - cwd - idiv bx - add ax, 3 - push ax - mov al, [si+3A5Ch] - push ax - call sub_BFC5 - mov bx, si - shl bx, 2 - mov ax, [bx+3A1Ch] - mov bx, si - shl bx, 2 - add [bx+39DCh], ax - mov bx, si - shl bx, 2 - mov ax, [bx+3A1Eh] - mov bx, si - shl bx, 2 - add [bx+39DEh], ax - mov al, [si+3A6Ch] - add [si+3A5Ch], al - mov bx, si - shl bx, 2 - cmp word ptr [bx+39DCh], 0 - jle short loc_C17C - mov bx, si - shl bx, 2 - cmp word ptr [bx+39DCh], 27Fh - jl short loc_C18E - -loc_C17C: - mov bx, si - shl bx, 2 - mov dx, 0FFFFh - mov ax, [bx+3A1Ch] - imul dx - mov [bx+3A1Ch], ax - -loc_C18E: - mov bx, si - shl bx, 2 - cmp word ptr [bx+39DEh], 1F40h - jl loc_C224 - call IRand - mov bx, 280h - cwd - idiv bx - mov bx, si - shl bx, 2 - mov [bx+39DCh], dx - mov bx, si - shl bx, 2 - mov word ptr [bx+39DEh], 0F9C0h - call IRand - and ax, 0Fh - mov dx, 8 - sub dx, ax - mov bx, si - shl bx, 2 - mov [bx+3A1Ch], dx - mov bx, si - shl bx, 2 - cmp word ptr [bx+3A1Ch], 0 - jnz short loc_C1E9 - mov bx, si - shl bx, 2 - mov word ptr [bx+3A1Ch], 1 - -loc_C1E9: - call IRand - and ax, 3 - shl ax, 4 - add ax, 20h ; ' ' - mov bx, si - shl bx, 2 - mov [bx+3A1Eh], ax - call IRand - mov [si+3A5Ch], al - call IRand - and al, 7 - mov dl, 4 - sub dl, al - mov [si+3A6Ch], dl - cmp byte ptr [si+3A6Ch], 0 - jnz short loc_C224 - mov byte ptr [si+3A6Ch], 4 - -loc_C224: - push ds - push offset unk_12CF4 - mov ax, si - mov bx, 4 - cwd - idiv bx - add ax, 3 - push ax - call grcg_polygon_c - inc si - -loc_C23A: - cmp si, 10h - jl loc_C102 - pop si - pop bp - retn -sub_C04E endp - +include th02/music/polygons.asm ; =============== S U B R O U T I N E ======================================= @@ -3425,7 +3154,7 @@ sub_C244 proc near mov bp, sp call sub_BFA7 call grcg_setcolor pascal, ((GC_RMW or GC_B) shl 16) + 15 - call sub_C04E + call polygons_update_and_render mov dx, 7Ch mov al, GC_OFF out dx, al @@ -3609,7 +3338,7 @@ sub_C3B7 proc near call pi_slot_palette_apply pascal, 0 call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 - mov al, byte_102AF + mov al, music_track_playing mov byte ptr word_12DBC, al push word_12DBC call sub_BF41 @@ -3623,7 +3352,7 @@ sub_C3B7 proc near mov al, 0 out dx, al call sub_BF68 - mov al, byte_102AF + mov al, music_track_playing mov ah, 0 call sub_C36F pascal, ax mov PaletteTone, 64h ; 'd' @@ -3699,7 +3428,7 @@ loc_C4E4: jz short loc_C533 kajacall KAJA_SONG_FADE, 32 mov al, byte ptr word_12DBC - mov byte_102AF, al + mov music_track_playing, al mov ah, 0 call sub_C36F pascal, ax mov al, byte ptr word_12DBC @@ -7718,8 +7447,8 @@ aZun03_bft db 'zun03.bft',0 dd aEnd2 ; "end2" dd aStaff ; "staff" dd aName_0 ; "name" -byte_102AE db 0 -byte_102AF db 0 +include th02/music/polygons[data].asm +music_track_playing db 0 aNo_1MSzlBLotus db 'No.1 幻想郷 〜 Lotus Land Story',0 aNo_2WitchingDr db 'No.2 Witching Dream ',0 aNo_3SeleneSLig db 'No.3 Selene',27h,'s light ',0 @@ -9034,62 +8763,7 @@ word_11E8A dw ? dd ? ; dd ? ; dd ? ; -unk_12CF4 db ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - db ? ; - db ? ; - db ? ; - db ? - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - db ? ; - db ? ; - db ? ; +include th02/music/polygons[bss].asm word_12DBC dw ? byte_12DBE db ? db ? ; diff --git a/th05_op.asm b/th05_op.asm index 5c7cc2dc..88344f3b 100644 --- a/th05_op.asm +++ b/th05_op.asm @@ -3561,278 +3561,7 @@ sub_BFF6 proc near retn sub_BFF6 endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_C014 proc near - -var_3 = byte ptr -3 -var_2 = word ptr -2 -arg_0 = byte ptr 4 -arg_2 = word ptr 6 -arg_4 = word ptr 8 -arg_6 = word ptr 0Ah -arg_8 = word ptr 0Ch -arg_A = word ptr 0Eh - - enter 4, 0 - push si - push di - mov di, [bp+arg_A] - sar [bp+arg_6], 4 - mov [bp+var_2], 0 - jmp short loc_C079 -; --------------------------------------------------------------------------- - -loc_C028: - mov ax, [bp+var_2] - shl ax, 8 - cwd - idiv [bp+arg_2] - add al, [bp+arg_0] - mov [bp+var_3], al - push [bp+arg_8] - push [bp+arg_4] - mov ah, 0 - add ax, ax - mov bx, ax - push word ptr [bx+610h] - call vector1_at - mov bx, [bp+var_2] - shl bx, 2 - mov [bx+di], ax - push [bp+arg_6] - push [bp+arg_4] - mov al, [bp+var_3] - mov ah, 0 - add ax, ax - mov bx, ax - push word ptr [bx+590h] - call vector1_at - mov bx, [bp+var_2] - shl bx, 2 - mov [bx+di+2], ax - inc [bp+var_2] - -loc_C079: - mov ax, [bp+var_2] - cmp ax, [bp+arg_2] - jl short loc_C028 - mov bx, [bp+var_2] - shl bx, 2 - mov ax, [di] - mov [bx+di], ax - mov bx, [bp+var_2] - shl bx, 2 - mov ax, [di+2] - mov [bx+di+2], ax - pop di - pop si - leave - retn 0Ch -sub_C014 endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_C09D proc near - push bp - mov bp, sp - push si - cmp byte_1048A, 0 - jnz loc_C14C - xor si, si - jmp loc_C140 -; --------------------------------------------------------------------------- - -loc_C0AF: - call IRand - mov bx, 280h - cwd - idiv bx - mov bx, si - shl bx, 2 - mov [bx+4E14h], dx - call IRand - mov bx, 1900h - cwd - idiv bx - mov bx, si - shl bx, 2 - mov [bx+4E16h], dx - call IRand - and ax, 7 - mov dx, 4 - sub dx, ax - mov bx, si - shl bx, 2 - mov [bx+4E54h], dx - mov bx, si - shl bx, 2 - cmp word ptr [bx+4E54h], 0 - jnz short loc_C104 - mov bx, si - shl bx, 2 - mov word ptr [bx+4E54h], 1 - -loc_C104: - call IRand - and ax, 3 - shl ax, 4 - add ax, 20h ; ' ' - mov bx, si - shl bx, 2 - mov [bx+4E56h], ax - call IRand - mov [si+4E94h], al - call IRand - and al, 7 - mov dl, 4 - sub dl, al - mov [si+4EA4h], dl - cmp byte ptr [si+4EA4h], 0 - jnz short loc_C13F - mov byte ptr [si+4EA4h], 4 - -loc_C13F: - inc si - -loc_C140: - cmp si, 0Eh - jl loc_C0AF - mov byte_1048A, 1 - -loc_C14C: - xor si, si - jmp loc_C289 -; --------------------------------------------------------------------------- - -loc_C151: - push 4DECh - mov bx, si - shl bx, 2 - push word ptr [bx+4E14h] - mov bx, si - shl bx, 2 - push word ptr [bx+4E16h] - mov ax, si - and ax, 3 - shl ax, 4 - add ax, 40h - push ax - mov ax, si - mov bx, 4 - cwd - idiv bx - add ax, 3 - push ax - mov al, [si+4E94h] - push ax - call sub_C014 - mov bx, si - shl bx, 2 - mov ax, [bx+4E54h] - mov bx, si - shl bx, 2 - add [bx+4E14h], ax - mov bx, si - shl bx, 2 - mov ax, [bx+4E56h] - mov bx, si - shl bx, 2 - add [bx+4E16h], ax - mov al, [si+4EA4h] - add [si+4E94h], al - mov bx, si - shl bx, 2 - cmp word ptr [bx+4E14h], 0 - jle short loc_C1CB - mov bx, si - shl bx, 2 - cmp word ptr [bx+4E14h], 27Fh - jl short loc_C1DD - -loc_C1CB: - mov bx, si - shl bx, 2 - mov dx, 0FFFFh - mov ax, [bx+4E54h] - imul dx - mov [bx+4E54h], ax - -loc_C1DD: - mov bx, si - shl bx, 2 - cmp word ptr [bx+4E16h], 1F40h - jl loc_C273 - call IRand - mov bx, 280h - cwd - idiv bx - mov bx, si - shl bx, 2 - mov [bx+4E14h], dx - mov bx, si - shl bx, 2 - mov word ptr [bx+4E16h], 0F9C0h - call IRand - and ax, 0Fh - mov dx, 8 - sub dx, ax - mov bx, si - shl bx, 2 - mov [bx+4E54h], dx - mov bx, si - shl bx, 2 - cmp word ptr [bx+4E54h], 0 - jnz short loc_C238 - mov bx, si - shl bx, 2 - mov word ptr [bx+4E54h], 1 - -loc_C238: - call IRand - and ax, 3 - shl ax, 4 - add ax, 20h ; ' ' - mov bx, si - shl bx, 2 - mov [bx+4E56h], ax - call IRand - mov [si+4E94h], al - call IRand - and al, 7 - mov dl, 4 - sub dl, al - mov [si+4EA4h], dl - cmp byte ptr [si+4EA4h], 0 - jnz short loc_C273 - mov byte ptr [si+4EA4h], 4 - -loc_C273: - push ds - push offset unk_13DCC - mov ax, si - mov bx, 4 - cwd - idiv bx - add ax, 3 - push ax - call grcg_polygon_c - inc si - -loc_C289: - cmp si, 0Eh - jl loc_C151 - pop si - pop bp - retn -sub_C09D endp - +include th02/music/polygons.asm ; =============== S U B R O U T I N E ======================================= @@ -3844,7 +3573,7 @@ sub_C293 proc near call sub_BFF6 call sub_D96E call grcg_setcolor pascal, ((GC_RMW or GC_B) shl 16) + 15 - call sub_C09D + call polygons_update_and_render mov dx, 7Ch mov al, GC_OFF out dx, al @@ -8373,7 +8102,7 @@ MUSICROOM_GAME dd aMUSICROOM_TH01 dd 0 music_game dw 4 MUSICROOM_TRACKCOUNTS dw 14,18,24,28,23 -byte_1048A db 0 +include th02/music/polygons[data].asm aMUSICROOM_UP db ' ------ ▲ ------ ',0 aMUSICROOM_DOWN db ' ------ ▼ ------ ',0 asc_104D5 db ' ---------------- ',0 @@ -9844,59 +9573,7 @@ byte_130F3 db ? dd ? ; dd ? ; dd ? ; -unk_13DCC db ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - dd ? ; - db ? ; - db ? ; - db ? ; +include th02/music/polygons[bss].asm word_13E94 dw ? byte_13E96 db ? db ?