[Position independence] Vector calls and variables

Raw, uninteresting position independence work. Or maybe not, given that
this was one of the few things that also apply to TH01, and reveal just
how chaotically this game was coded. And so we've got three ways that
ZUN stored regular 2D points: Regularly (X first, Y second), Y first
and X second, and multiple points stored in a structure of arrays…

Completes P0059, funded by [Anonymous] and -Tom-.
This commit is contained in:
nmlgc 2019-11-17 20:23:49 +01:00
parent 550bba9b3c
commit 8b627803a3
16 changed files with 1451 additions and 1804 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -4176,7 +4176,7 @@ arg_2 = word ptr 6
add ax, ax add ax, ax
mov cx, ax mov cx, ax
mov word ptr [si], 1 mov word ptr [si], 1
mov ax, word_205F6 mov ax, point_205F6.x
add ax, [bp+arg_2] add ax, [bp+arg_2]
shl ax, 4 shl ax, 4
mov bx, cx mov bx, cx
@ -4276,8 +4276,8 @@ var_2 = word ptr -2
xor si, si xor si, si
xor di, di xor di, di
mov [bp+var_2], 0 mov [bp+var_2], 0
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 20h ; ' ' add ax, 32
shl ax, 4 shl ax, 4
mov word_205E4, ax mov word_205E4, ax
mov word_205E2, 0 mov word_205E2, 0
@ -4591,8 +4591,8 @@ var_2 = word ptr -2
xor di, di xor di, di
mov [bp+var_2], 0 mov [bp+var_2], 0
mov [bp+var_3], 0 mov [bp+var_3], 0
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 20h ; ' ' add ax, 32
shl ax, 4 shl ax, 4
mov word_205E4, ax mov word_205E4, ax
mov word_205E2, 0 mov word_205E2, 0
@ -4775,11 +4775,11 @@ loc_CE5B:
cmp word_205DA, 0 cmp word_205DA, 0
jle short loc_CE96 jle short loc_CE96
mov ax, word_205DA mov ax, word_205DA
sub ax, word_205F8 sub ax, point_205F6.y
add ax, 0FFE0h add ax, -32
push ax push ax
mov ax, word_205D8 mov ax, word_205D8
sub ax, word_205F6 sub ax, point_205F6.x
push ax push ax
call iatan2 call iatan2
mov [bp+var_2], ax mov [bp+var_2], ax
@ -4805,12 +4805,12 @@ loc_CE9F:
cmp word_205DA, 0 cmp word_205DA, 0
jle short loc_CED8 jle short loc_CED8
mov ax, word_205DA mov ax, word_205DA
sub ax, word_205F8 sub ax, point_205F6.y
add ax, 0FFE0h add ax, -32
push ax push ax
mov ax, word_205D8 mov ax, word_205D8
sub ax, word_205F6 sub ax, point_205F6.x
add ax, 0FFF0h add ax, -16
push ax push ax
call iatan2 call iatan2
mov [bp+var_2], ax mov [bp+var_2], ax
@ -5077,8 +5077,8 @@ var_2 = word ptr -2
xor di, di xor di, di
mov [bp+var_3], 0 mov [bp+var_3], 0
inc byte_20350 inc byte_20350
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 20h ; ' ' add ax, 32
shl ax, 4 shl ax, 4
mov word_205E4, ax mov word_205E4, ax
cmp shot_level, 2 cmp shot_level, 2
@ -6090,14 +6090,14 @@ arg_2 = word ptr 6
mov [bp+var_16], ax mov [bp+var_16], ax
mov al, byte_1E596 mov al, byte_1E596
mov [bp+var_14], al mov [bp+var_14], al
cmp word_205F6, 80h cmp point_205F6.x, 128
jg short loc_D794 jg short loc_D794
mov al, 0FFh mov al, 0FFh
jmp short loc_D7A2 jmp short loc_D7A2
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_D794: loc_D794:
cmp word_205F6, 100h cmp point_205F6.x, 256
jg short loc_D7A0 jg short loc_D7A0
mov al, 0 mov al, 0
jmp short loc_D7A2 jmp short loc_D7A2
@ -6308,10 +6308,10 @@ arg_0 = word ptr 4
push di push di
mov ax, word_2189C mov ax, word_2189C
mov [bp+var_2], ax mov [bp+var_2], ax
cmp ax, word_205F8 cmp ax, point_205F6.y
jl loc_DADE jl loc_DADE
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 18h add ax, 24
cmp ax, [bp+var_2] cmp ax, [bp+var_2]
jl loc_DADE jl loc_DADE
mov ax, word_2189A mov ax, word_2189A
@ -6597,12 +6597,12 @@ loc_DB9D:
inc word ptr [si+0Ah] inc word ptr [si+0Ah]
cmp _player_is_hit, 0 cmp _player_is_hit, 0
jnz short loc_DBCA jnz short loc_DBCA
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 0FFF8h add ax, -8
cmp ax, word_2189A cmp ax, word_2189A
jg short loc_DBCA jg short loc_DBCA
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 18h add ax, 24
cmp ax, word_2189A cmp ax, word_2189A
jl short loc_DBCA jl short loc_DBCA
push si push si
@ -8775,43 +8775,43 @@ arg_2 = word ptr 6
mov bp, sp mov bp, sp
mov bx, word_205F0 mov bx, word_205F0
mov ax, [bx] mov ax, [bx]
mov word_205F8, ax mov point_205F6.y, ax
mov ax, [bp+arg_0] mov ax, [bp+arg_0]
add word_205F8, ax add point_205F6.y, ax
cmp word_205F8, 10h cmp point_205F6.y, 16
jge short loc_EEE5 jge short loc_EEE5
mov word_205F8, 10h mov point_205F6.y, 16
jmp short loc_EEF3 jmp short loc_EEF3
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_EEE5: loc_EEE5:
cmp word_205F8, 158h cmp point_205F6.y, 344
jle short loc_EEF3 jle short loc_EEF3
mov word_205F8, 158h mov point_205F6.y, 344
loc_EEF3: loc_EEF3:
mov bx, word_205F0 mov bx, word_205F0
mov ax, word_205F8 mov ax, point_205F6.y
mov [bx], ax mov [bx], ax
mov bx, word_205EE mov bx, word_205EE
mov ax, [bx] mov ax, [bx]
mov word_205F6, ax mov point_205F6.x, ax
mov ax, [bp+arg_2] mov ax, [bp+arg_2]
add word_205F6, ax add point_205F6.x, ax
cmp word_205F6, 186h cmp point_205F6.x, 390
jl short loc_EF1C jl short loc_EF1C
mov word_205F6, 186h mov point_205F6.x, 390
jmp short loc_EF29 jmp short loc_EF29
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_EF1C: loc_EF1C:
cmp word_205F6, 1Ch cmp point_205F6.x, 28
jg short loc_EF29 jg short loc_EF29
mov word_205F6, 1Ch mov point_205F6.x, 28
loc_EF29: loc_EF29:
mov bx, word_205EE mov bx, word_205EE
mov ax, word_205F6 mov ax, point_205F6.x
mov [bx], ax mov [bx], ax
pop bp pop bp
retn 4 retn 4
@ -8859,17 +8859,14 @@ loc_EF7F:
and ax, 3 and ax, 3
cmp ax, 3 cmp ax, 3
jge short loc_EFAC jge short loc_EFAC
mov si, word_205F8 mov si, point_205F6.y
add si, _scroll_line add si, _scroll_line
cmp si, RES_Y cmp si, RES_Y
jl short loc_EF9E jl short loc_EF9E
sub si, RES_Y sub si, RES_Y
loc_EF9E: loc_EF9E:
push word_205F6 call super_roll_put pascal, point_205F6.x, si, word_1E512
push si
push word_1E512
call super_roll_put
loc_EFAC: loc_EFAC:
cmp power, 8 cmp power, 8
@ -8940,10 +8937,10 @@ var_2 = word ptr -2
loc_F03D: loc_F03D:
mov bx, word_205EE mov bx, word_205EE
mov ax, [bx] mov ax, [bx]
mov word_205F6, ax mov point_205F6.x, ax
mov bx, word_205F0 mov bx, word_205F0
mov ax, [bx] mov ax, [bx]
mov word_205F8, ax mov point_205F6.y, ax
inc byte_20609 inc byte_20609
cmp byte_20609, 18h cmp byte_20609, 18h
jnb short loc_F08A jnb short loc_F08A
@ -9274,13 +9271,13 @@ loc_F2FB:
push si push si
push di push di
call sub_EEC3 call sub_EEC3
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 0FFF0h add ax, -16
sub ax, si sub ax, si
mov bx, word_205F2 mov bx, word_205F2
mov [bx], ax mov [bx], ax
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 10h add ax, 16
sub ax, di sub ax, di
mov bx, word_205F4 mov bx, word_205F4
mov [bx], ax mov [bx], ax
@ -10439,11 +10436,11 @@ arg_6 = dword ptr 0Ah
mov bx, ax mov bx, ax
mov ax, [bx+si+4] mov ax, [bx+si+4]
mov [bp+var_4], ax mov [bp+var_4], ax
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 14h add ax, 20
mov [bp+var_6], ax mov [bp+var_6], ax
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 0Ch add ax, 12
mov [bp+var_8], ax mov [bp+var_8], ax
mov al, _page_back mov al, _page_back
mov ah, 0 mov ah, 0
@ -11231,14 +11228,14 @@ arg_0 = word ptr 4
mov ax, [bx] mov ax, [bx]
sar ax, 4 sar ax, 4
mov di, ax mov di, ax
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 8 add ax, 8
mov [bp+var_2], ax mov [bp+var_2], ax
mov bx, word_2174E mov bx, word_2174E
mov ax, [bx] mov ax, [bx]
sar ax, 4 sar ax, 4
mov [bp+var_4], ax mov [bp+var_4], ax
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 8 add ax, 8
mov [bp+var_6], ax mov [bp+var_6], ax
mov al, [si+0Fh] mov al, [si+0Fh]
@ -11569,40 +11566,40 @@ loc_10C72:
cbw cbw
cmp ax, 1 cmp ax, 1
jnz short loc_10CA9 jnz short loc_10CA9
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 7 add ax, 7
cmp ax, word_21740 cmp ax, word_21740
jg short loc_10CDC jg short loc_10CDC
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 11h add ax, 17
cmp ax, word_21740 cmp ax, word_21740
jle short loc_10CDC jle short loc_10CDC
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 0Ch add ax, 12
cmp ax, di cmp ax, di
jg short loc_10CDC jg short loc_10CDC
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 16h add ax, 22
cmp ax, di cmp ax, di
jl short loc_10CDC jl short loc_10CDC
jmp short loc_10CD5 jmp short loc_10CD5
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_10CA9: loc_10CA9:
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 0FFFDh add ax, -3
cmp ax, word_21740 cmp ax, word_21740
jg short loc_10CDC jg short loc_10CDC
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 13h add ax, 19
cmp ax, word_21740 cmp ax, word_21740
jle short loc_10CDC jle short loc_10CDC
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 4 add ax, 4
cmp ax, di cmp ax, di
jg short loc_10CDC jg short loc_10CDC
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 18h add ax, 24
cmp ax, di cmp ax, di
jl short loc_10CDC jl short loc_10CDC
@ -13120,7 +13117,7 @@ loc_11970:
jl short loc_1194A jl short loc_1194A
loc_11975: loc_11975:
cmp word_205F8, 60h cmp point_205F6.y, 96
jge short loc_11993 jge short loc_11993
push word_22D98 push word_22D98
push word_22D9A push word_22D9A
@ -13499,8 +13496,8 @@ var_2 = word ptr -2
or dx, dx or dx, dx
jnz short loc_11C7A jnz short loc_11C7A
mov byte_23A70, 1Eh mov byte_23A70, 1Eh
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 10h add ax, 16
and ax, 0FFF0h and ax, 0FFF0h
mov [bp+var_2], ax mov [bp+var_2], ax
push ax push ax
@ -13539,10 +13536,10 @@ var_1 = byte ptr -1
idiv bx idiv bx
or dx, dx or dx, dx
jnz locret_11D2E jnz locret_11D2E
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 0FFE0h add ax, -32
push ax push ax
mov ax, word_205F6 mov ax, point_205F6.x
sub ax, word_22D8C sub ax, word_22D8C
push ax push ax
call iatan2 call iatan2
@ -13582,10 +13579,10 @@ loc_11CF5:
idiv bx idiv bx
or dx, dx or dx, dx
jnz short locret_11D2E jnz short locret_11D2E
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 0FFE0h add ax, -32
push ax push ax
mov ax, word_205F6 mov ax, point_205F6.x
sub ax, word_22D8C sub ax, word_22D8C
push ax push ax
call iatan2 call iatan2
@ -13979,12 +13976,12 @@ sub_1200F proc near
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_1202D: loc_1202D:
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 0FFE0h add ax, -32
push ax push ax
mov bx, si mov bx, si
add bx, bx add bx, bx
mov ax, word_205F6 mov ax, point_205F6.x
sub ax, [bx+5314h] sub ax, [bx+5314h]
push ax push ax
call iatan2 call iatan2
@ -15413,14 +15410,14 @@ loc_12B5E:
cmp byte ptr [di+1], 4 cmp byte ptr [di+1], 4
jnz short loc_12B98 jnz short loc_12B98
mov ax, word_23A6C mov ax, word_23A6C
add ax, 0FFE8h add ax, -24
cmp ax, word_205F6 cmp ax, point_205F6.x
jge short loc_12B98 jge short loc_12B98
mov ax, word_23A6C mov ax, word_23A6C
add ax, 8 add ax, 8
cmp ax, word_205F6 cmp ax, point_205F6.x
jle short loc_12B98 jle short loc_12B98
mov ax, word_205F8 mov ax, point_205F6.y
cmp ax, word_23A6E cmp ax, word_23A6E
jl short loc_12B98 jl short loc_12B98
cmp _player_is_hit, 0 cmp _player_is_hit, 0
@ -15593,17 +15590,14 @@ sub_12CE5 proc near
push bp push bp
mov bp, sp mov bp, sp
push si push si
mov si, word_205F8 mov si, point_205F6.y
add si, _scroll_line add si, _scroll_line
cmp si, RES_Y cmp si, RES_Y
jl short loc_12CFB jl short loc_12CFB
sub si, RES_Y sub si, RES_Y
loc_12CFB: loc_12CFB:
push word_205F6 call super_roll_put pascal, point_205F6.x, si, 0
push si
push 0
call super_roll_put
mov al, _page_back mov al, _page_back
mov ah, 0 mov ah, 0
shl ax, 2 shl ax, 2
@ -18636,16 +18630,16 @@ var_2 = word ptr -2
mov si, [bx] mov si, [bx]
mov bx, word_2065C mov bx, word_2065C
mov ax, [bx] mov ax, [bx]
cmp ax, word_205F6 cmp ax, point_205F6.x
jg short loc_1461A jg short loc_1461A
add ax, 20h ; ' ' add ax, 32
cmp ax, word_205F6 cmp ax, point_205F6.x
jle short loc_1461A jle short loc_1461A
lea ax, [si-10h] lea ax, [si-10h]
cmp ax, word_205F8 cmp ax, point_205F6.y
jge short loc_1461A jge short loc_1461A
lea ax, [si+20h] lea ax, [si+20h]
cmp ax, word_205F8 cmp ax, point_205F6.y
jle short loc_1461A jle short loc_1461A
mov _player_is_hit, 1 mov _player_is_hit, 1
@ -18831,18 +18825,18 @@ loc_14757:
call super_roll_put_tiny call super_roll_put_tiny
dec byte ptr [si+0Ah] dec byte ptr [si+0Ah]
mov ax, [si+2] mov ax, [si+2]
add ax, 0FFF0h add ax, -16
cmp ax, word_205F6 cmp ax, point_205F6.x
jg loc_14829 jg loc_14829
mov ax, [si+2] mov ax, [si+2]
cmp ax, word_205F6 cmp ax, point_205F6.x
jl loc_14829 jl loc_14829
mov ax, [si+4] mov ax, [si+4]
add ax, 0FFF0h add ax, -16
cmp ax, word_205F8 cmp ax, point_205F6.y
jge loc_14829 jge loc_14829
mov ax, [si+4] mov ax, [si+4]
cmp ax, word_205F8 cmp ax, point_205F6.y
jle loc_14829 jle loc_14829
mov _player_is_hit, 1 mov _player_is_hit, 1
jmp loc_14829 jmp loc_14829
@ -19040,8 +19034,8 @@ sub_148FD proc near
jnz short loc_14954 jnz short loc_14954
mov bx, word_2065C mov bx, word_2065C
mov ax, [bx] mov ax, [bx]
add ax, 10h add ax, 16
cmp ax, word_205F6 cmp ax, point_205F6.x
jge short loc_1492B jge short loc_1492B
mov ax, 1 mov ax, 1
jmp short loc_1492D jmp short loc_1492D
@ -19424,8 +19418,8 @@ sub_14C76 proc near
jnz short loc_14CBE jnz short loc_14CBE
mov bx, word_2065C mov bx, word_2065C
mov ax, [bx] mov ax, [bx]
add ax, 10h add ax, 16
cmp ax, word_205F6 cmp ax, point_205F6.x
jge short loc_14C9D jge short loc_14C9D
mov ax, 1 mov ax, 1
jmp short loc_14C9F jmp short loc_14C9F
@ -21360,7 +21354,7 @@ var_1 = byte ptr -1
cmp word_20650, 14h cmp word_20650, 14h
jnz short loc_15D83 jnz short loc_15D83
mov byte_25596, 0 mov byte_25596, 0
cmp word_205F6, 0D0h cmp point_205F6.x, 208
jge short loc_15D7E jge short loc_15D7E
mov al, 1 mov al, 1
jmp short loc_15D80 jmp short loc_15D80
@ -21568,7 +21562,7 @@ sub_15EF7 proc near
loc_15F06: loc_15F06:
cmp word_20650, 32h ; '2' cmp word_20650, 32h ; '2'
jnz short loc_15F1E jnz short loc_15F1E
cmp word_205F6, 0D0h cmp point_205F6.x, 208
jge short loc_15F19 jge short loc_15F19
mov al, 1 mov al, 1
jmp short loc_15F1B jmp short loc_15F1B
@ -21683,11 +21677,11 @@ loc_15FB7:
loc_15FCF: loc_15FCF:
cmp word_20650, 64h ; 'd' cmp word_20650, 64h ; 'd'
jnz short loc_15FFD jnz short loc_15FFD
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 10h add ax, 16
mov word_2559A, ax mov word_2559A, ax
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 10h add ax, 16
mov word_2559C, ax mov word_2559C, ax
mov byte_2558C, 3 mov byte_2558C, 3
mov byte_2558D, 0FCh mov byte_2558D, 0FCh
@ -22144,20 +22138,20 @@ loc_16458:
jnz short loc_164AD jnz short loc_164AD
push word_253B6 push word_253B6
push word_253B8 push word_253B8
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 10h add ax, 16
push ax push ax
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 10h add ax, 16
push ax push ax
push 0 push 0
push ds push ds
push offset word_255A4 push offset point_255A4.x
push ds push ds
push offset word_255A6 push offset point_255A4.y
push 30h ; '0' push 48
call vector_between call vector_between
mov ax, word_255A4 mov ax, point_255A4.x
neg ax neg ax
mov word_255AC, ax mov word_255AC, ax
mov word_2064E, 80h mov word_2064E, 80h
@ -22188,14 +22182,14 @@ loc_164AD:
mov word_20650, 0 mov word_20650, 0
loc_164E3: loc_164E3:
mov ax, word_255A4 mov ax, point_255A4.x
add word_255A8, ax add word_255A8, ax
mov ax, word_255AC mov ax, word_255AC
add word_255AE, ax add word_255AE, ax
mov ax, word_255A6 mov ax, point_255A4.y
add word_255AA, ax add word_255AA, ax
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 10h add ax, 16
cmp ax, word_255A8 cmp ax, word_255A8
jle short loc_1650B jle short loc_1650B
add word_255A8, 10h add word_255A8, 10h
@ -22203,15 +22197,15 @@ loc_164E3:
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_1650B: loc_1650B:
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 10h add ax, 16
cmp ax, word_255A8 cmp ax, word_255A8
jge short loc_1651C jge short loc_1651C
sub word_255A8, 10h sub word_255A8, 10h
loc_1651C: loc_1651C:
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 10h add ax, 16
cmp ax, word_255AE cmp ax, word_255AE
jle short loc_1652F jle short loc_1652F
sub word_255AE, 10h sub word_255AE, 10h
@ -22219,8 +22213,8 @@ loc_1651C:
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_1652F: loc_1652F:
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 10h add ax, 16
cmp ax, word_255AE cmp ax, word_255AE
jge short loc_16540 jge short loc_16540
add word_255AE, 10h add word_255AE, 10h
@ -22259,11 +22253,11 @@ loc_1656B:
and ax, 3Fh and ax, 3Fh
cmp ax, 20h ; ' ' cmp ax, 20h ; ' '
jnz short loc_16589 jnz short loc_16589
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 10h add ax, 16
push ax push ax
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 10h add ax, 16
push ax push ax
push 30h ; '0' push 30h ; '0'
call sub_155C5 call sub_155C5
@ -22302,7 +22296,7 @@ sub_165A5 proc near
loc_165B4: loc_165B4:
cmp word_20650, 32h ; '2' cmp word_20650, 32h ; '2'
jnz short loc_165CC jnz short loc_165CC
cmp word_205F6, 0D0h cmp point_205F6.x, 208
jge short loc_165C7 jge short loc_165C7
mov al, 2 mov al, 2
jmp short loc_165C9 jmp short loc_165C9
@ -22365,11 +22359,11 @@ sub_16606 proc near
loc_1661C: loc_1661C:
test byte ptr word_20650, 3Fh test byte ptr word_20650, 3Fh
jnz short loc_16636 jnz short loc_16636
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 10h add ax, 16
push ax push ax
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 10h add ax, 16
push ax push ax
push 30h ; '0' push 30h ; '0'
call sub_155C5 call sub_155C5
@ -22440,11 +22434,11 @@ sub_1668E proc near
loc_166A4: loc_166A4:
test byte ptr word_20650, 1Fh test byte ptr word_20650, 1Fh
jnz short loc_166BE jnz short loc_166BE
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 10h add ax, 16
push ax push ax
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 10h add ax, 16
push ax push ax
push 30h ; '0' push 30h ; '0'
call sub_155C5 call sub_155C5
@ -22919,15 +22913,15 @@ var_2 = word ptr -2
push bp push bp
mov bp, sp mov bp, sp
sub sp, 6 sub sp, 6
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 10h add ax, 16
mov [bp+var_2], ax mov [bp+var_2], ax
mov bx, word_26C4A mov bx, word_26C4A
push word ptr [bx] push word ptr [bx]
mov bx, word_26C4C mov bx, word_26C4C
push word ptr [bx] push word ptr [bx]
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 18h add ax, 24
push ax push ax
push [bp+var_2] push [bp+var_2]
push 0 push 0
@ -24184,10 +24178,10 @@ var_2 = word ptr -2
cmp [bx+2B76h], dx cmp [bx+2B76h], dx
jge short loc_175D1 jge short loc_175D1
lea ax, [si-10h] lea ax, [si-10h]
cmp ax, word_205F8 cmp ax, point_205F6.y
jge short loc_175D1 jge short loc_175D1
lea ax, [si+10h] lea ax, [si+10h]
cmp ax, word_205F8 cmp ax, point_205F6.y
jle short loc_175D1 jle short loc_175D1
mov bx, word_26C46 mov bx, word_26C46
mov word ptr [bx+0Ah], 0 mov word ptr [bx+0Ah], 0
@ -25557,8 +25551,8 @@ var_1 = byte ptr -1
mov word_2064E, 80h mov word_2064E, 80h
mov bx, word_2065C mov bx, word_2065C
mov ax, [bx] mov ax, [bx]
add ax, 40h add ax, 64
cmp ax, word_205F6 cmp ax, point_205F6.x
jge short loc_181E5 jge short loc_181E5
mov ax, 2 mov ax, 2
jmp short loc_181E8 jmp short loc_181E8
@ -25668,12 +25662,12 @@ loc_182DD:
call grcg_off call grcg_off
mov bx, word_2065C mov bx, word_2065C
mov ax, [bx] mov ax, [bx]
add ax, 10h add ax, 16
cmp ax, word_205F6 cmp ax, point_205F6.x
jge short loc_1834B jge short loc_1834B
mov ax, [bx] mov ax, [bx]
add ax, 60h add ax, 96
cmp ax, word_205F6 cmp ax, point_205F6.x
jle short loc_1834B jle short loc_1834B
mov _player_is_hit, 1 mov _player_is_hit, 1
@ -26248,23 +26242,13 @@ var_2 = word ptr -2
mov ax, [bx] mov ax, [bx]
add ax, 40h add ax, 40h
mov [bp+var_4], ax mov [bp+var_4], ax
push [bp+var_2] call vector_between pascal, [bp+var_2], ax, point_205F6.x, point_205F6.y, 0, ds, offset point_26CD6.x, ds, offset point_26CD6.y, 48
push ax
push word_205F6
push word_205F8
push 0
push ds
push offset unk_26CD6
push ds
push offset unk_26CD8
push 30h ; '0'
call vector_between
loc_188F8: loc_188F8:
push ds push ds
push offset unk_26CD6 push offset point_26CD6.x
push ds push ds
push offset unk_26CD8 push offset point_26CD6.y
call sub_183D0 call sub_183D0
locret_18903: locret_18903:
@ -26287,8 +26271,8 @@ sub_18905 proc near
mov word_2064E, 80h mov word_2064E, 80h
mov bx, word_2065C mov bx, word_2065C
mov ax, [bx] mov ax, [bx]
add ax, 40h add ax, 64
cmp ax, word_205F6 cmp ax, point_205F6.x
jge short loc_18932 jge short loc_18932
mov ax, 2 mov ax, 2
jmp short loc_18935 jmp short loc_18935
@ -26403,8 +26387,8 @@ sub_18A1B proc near
mov word_2064E, 80h mov word_2064E, 80h
mov bx, word_2065C mov bx, word_2065C
mov ax, [bx] mov ax, [bx]
add ax, 40h add ax, 64
cmp ax, word_205F6 cmp ax, point_205F6.x
jge short loc_18A48 jge short loc_18A48
mov ax, 2 mov ax, 2
jmp short loc_18A4B jmp short loc_18A4B
@ -26552,23 +26536,13 @@ var_2 = word ptr -2
mov ax, [bx] mov ax, [bx]
add ax, 40h add ax, 40h
mov [bp+var_4], ax mov [bp+var_4], ax
push [bp+var_2] call vector_between pascal, [bp+var_2], ax, point_205F6.x, point_205F6.y, 0, ds, offset point_26CDE.x, ds, offset point_26CDE.y, 52
push ax
push word_205F6
push word_205F8
push 0
push ds
push offset unk_26CDE
push ds
push offset unk_26CE0
push 34h ; '4'
call vector_between
loc_18B99: loc_18B99:
push ds push ds
push offset unk_26CDE push offset point_26CDE.x
push ds push ds
push offset unk_26CE0 push offset point_26CDE.y
call sub_183D0 call sub_183D0
locret_18BA4: locret_18BA4:
@ -26657,8 +26631,8 @@ sub_18C4A proc near
mov word_2064E, 80h mov word_2064E, 80h
mov bx, word_2065C mov bx, word_2065C
mov ax, [bx] mov ax, [bx]
add ax, 40h add ax, 64
cmp ax, word_205F6 cmp ax, point_205F6.x
jge short loc_18C77 jge short loc_18C77
mov ax, 2 mov ax, 2
jmp short loc_18C7A jmp short loc_18C7A
@ -26690,15 +26664,15 @@ loc_18C9B:
jnz short loc_18CEE jnz short loc_18CEE
call _snd_se_play c, 10 call _snd_se_play c, 10
mov word_2064E, 86h mov word_2064E, 86h
mov ax, word_205F8 mov ax, point_205F6.y
sub ax, word_26C62 sub ax, word_26C62
push ax push ax
mov ax, word_205F6 mov ax, point_205F6.x
sub ax, word_26C5A sub ax, word_26C5A
push ax push ax
call iatan2 call iatan2
mov byte_26CE2, al mov byte_26CE2, al
cmp word_205F6, 0D0h cmp point_205F6.x, 208
jg short loc_18CDF jg short loc_18CDF
mov al, 0FFh mov al, 0FFh
jmp short loc_18CE1 jmp short loc_18CE1
@ -26823,8 +26797,8 @@ sub_18DE0 proc near
mov word_2064E, 80h mov word_2064E, 80h
mov bx, word_2065C mov bx, word_2065C
mov ax, [bx] mov ax, [bx]
add ax, 40h add ax, 64
cmp ax, word_205F6 cmp ax, point_205F6.x
jge short loc_18E0D jge short loc_18E0D
mov ax, 2 mov ax, 2
jmp short loc_18E10 jmp short loc_18E10
@ -27216,12 +27190,12 @@ sub_191CC proc near
jl loc_19351 jl loc_19351
cmp word_20650, 32h ; '2' cmp word_20650, 32h ; '2'
jnz short loc_1920E jnz short loc_1920E
mov ax, word_205F8 mov ax, point_205F6.y
add ax, 0Ch add ax, 12
sub ax, word_26C64 sub ax, word_26C64
push ax push ax
mov ax, word_205F6 mov ax, point_205F6.x
add ax, 0Ch add ax, 12
sub ax, word_26C5C sub ax, word_26C5C
push ax push ax
call iatan2 call iatan2
@ -27951,7 +27925,7 @@ loc_1988A:
cmp word_20650, 1Eh cmp word_20650, 1Eh
jge short loc_198A8 jge short loc_198A8
mov ax, word_26C5C mov ax, word_26C5C
cmp ax, word_205F6 cmp ax, point_205F6.x
jge short loc_1989F jge short loc_1989F
mov ax, 1 mov ax, 1
jmp short loc_198A2 jmp short loc_198A2
@ -28164,10 +28138,7 @@ mima_init proc far
add ax, 2 add ax, 2
push ax push ax
call super_put_rect call super_put_rect
push word_205F6 call super_roll_put pascal, point_205F6.x, point_205F6.y, 0
push word_205F8
push 0
call super_roll_put
mov al, _page_back mov al, _page_back
mov ah, 0 mov ah, 0
shl ax, 2 shl ax, 2
@ -29376,10 +29347,7 @@ loc_1A613:
call grcg_off call grcg_off
push 600000h push 600000h
call sub_1A423 call sub_1A423
push word_205F6 call super_roll_put pascal, point_205F6.x, point_205F6.y, 0
push word_205F8
push 0
call super_roll_put
mov al, _page_back mov al, _page_back
mov ah, 0 mov ah, 0
shl ax, 2 shl ax, 2
@ -29443,7 +29411,7 @@ sub_1A6C5 proc near
mov al, _page_front mov al, _page_front
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov dx, word_205F8 mov dx, point_205F6.y
mov bx, ax mov bx, ax
mov [bx+2B7Ah], dx mov [bx+2B7Ah], dx
mov _scroll_line, 0 mov _scroll_line, 0
@ -29457,22 +29425,19 @@ sub_1A6C5 proc near
call frame_delay call frame_delay
call graph_scrollup pascal, 0 call graph_scrollup pascal, 0
graph_accesspage _page_front graph_accesspage _page_front
push word_205F6 call super_roll_put pascal, point_205F6.x, point_205F6.y, 0
push word_205F8
push 0
call super_roll_put
mov al, _page_back mov al, _page_back
mov ah, 0 mov ah, 0
shl ax, 2 shl ax, 2
mov dx, word_205F6 mov dx, point_205F6.x
add dx, 0FFF0h add dx, -16
mov bx, ax mov bx, ax
mov [bx+2B8Ah], dx mov [bx+2B8Ah], dx
mov al, _page_back mov al, _page_back
mov ah, 0 mov ah, 0
shl ax, 2 shl ax, 2
mov dx, word_205F8 mov dx, point_205F6.y
add dx, 10h add dx, 16
mov bx, ax mov bx, ax
mov [bx+2B8Ch], dx mov [bx+2B8Ch], dx
mov al, _page_back mov al, _page_back
@ -29585,10 +29550,7 @@ marisa_init proc far
inc ax inc ax
push ax push ax
call super_put_rect call super_put_rect
push word_205F6 call super_roll_put pascal, point_205F6.x, point_205F6.y, 0
push word_205F8
push 0
call super_roll_put
mov al, _page_back mov al, _page_back
mov ah, 0 mov ah, 0
shl ax, 2 shl ax, 2
@ -29638,10 +29600,7 @@ marisa_init proc far
inc ax inc ax
push ax push ax
call super_put_rect call super_put_rect
push word_205F6 call super_roll_put pascal, point_205F6.x, point_205F6.y, 0
push word_205F8
push 0
call super_roll_put
mov al, _page_back mov al, _page_back
mov ah, 0 mov ah, 0
shl ax, 2 shl ax, 2
@ -30975,8 +30934,8 @@ sub_1B555 proc near
cmp word_20650, 0Ah cmp word_20650, 0Ah
jnz short loc_1B592 jnz short loc_1B592
mov ax, word_26D76 mov ax, word_26D76
add ax, 20h ; ' ' add ax, 32
cmp ax, word_205F6 cmp ax, point_205F6.x
jge short loc_1B579 jge short loc_1B579
mov al, 1 mov al, 1
jmp short loc_1B57B jmp short loc_1B57B
@ -31997,8 +31956,8 @@ sub_1BE72 proc near
cmp word_20650, 2 cmp word_20650, 2
jnz short loc_1BEC5 jnz short loc_1BEC5
mov ax, word_26D76 mov ax, word_26D76
add ax, 20h ; ' ' add ax, 32
cmp ax, word_205F6 cmp ax, point_205F6.x
jge short loc_1BE94 jge short loc_1BE94
mov ax, 1 mov ax, 1
jmp short loc_1BE97 jmp short loc_1BE97
@ -35605,8 +35564,7 @@ word_205EE dw ?
word_205F0 dw ? word_205F0 dw ?
word_205F2 dw ? word_205F2 dw ?
word_205F4 dw ? word_205F4 dw ?
word_205F6 dw ? point_205F6 Point <?>
word_205F8 dw ?
dd ? ; dd ? ;
dd ? ; dd ? ;
playchar_shot_func dw ? playchar_shot_func dw ?
@ -39946,8 +39904,7 @@ byte_2559E db ?
word_255A0 dw ? word_255A0 dw ?
byte_255A2 db ? byte_255A2 db ?
byte_255A3 db ? byte_255A3 db ?
word_255A4 dw ? point_255A4 Point <?>
word_255A6 dw ?
word_255A8 dw ? word_255A8 dw ?
word_255AA dw ? word_255AA dw ?
word_255AC dw ? word_255AC dw ?
@ -41470,16 +41427,10 @@ byte_26CD2 db ?
byte_26CD3 db ? byte_26CD3 db ?
byte_26CD4 db ? byte_26CD4 db ?
db ? db ?
unk_26CD6 db ? ; point_26CD6 Point <?>
db ? ;
unk_26CD8 db ? ;
db ? ;
word_26CDA dw ? word_26CDA dw ?
word_26CDC dw ? word_26CDC dw ?
unk_26CDE db ? ; point_26CDE Point <?>
db ? ;
unk_26CE0 db ? ;
db ? ;
byte_26CE2 db ? byte_26CE2 db ?
byte_26CE3 db ? byte_26CE3 db ?
byte_26CE4 db ? byte_26CE4 db ?

24
th03/math/math.h Normal file
View File

@ -0,0 +1,24 @@
// Vectors
// -------
#if GAME == 3
// (different calling convention parameter order than the TH04/TH05 one)
int __cdecl far vector1_at(int angle, int length, int origin)
#endif
int pascal far vector2(
int far *ret_x, int far *ret_y, unsigned char angle, int length
);
// Constructs a vector from (x1, y1) to (x2, y2), and additionally applies
// [plus_angle] to the resulting angle between the two points.
int pascal far vector2_between_plus(
int x1,
int y1,
int x2,
int y2,
unsigned char plus_angle,
int *ret_x,
int *ret_y,
int length
);
// -------

View File

@ -1,5 +1,3 @@
; int __cdecl far vector1_at(int angle, int length, int origin)
; (different calling convention than the TH04/TH05 one)
vector1_at proc far vector1_at proc far
@@origin = word ptr 6 @@origin = word ptr 6

View File

@ -1,4 +1,3 @@
; int pascal far vector2(int r, unsigned char angle, int far *dx, int far *dy)
vector2 proc far vector2 proc far
@@r = word ptr 6 @@r = word ptr 6

View File

@ -1,7 +1,3 @@
; Constructs a vector from (x1|y1) to (x2|y2), and additionally applies
; [plus_angle] to the resulting angle between the two points.
; int pascal far vector2(int r, int far *dx, int far *dy, char plus_angle, int y2, int x2, int y1, int x1)
vector2_between_plus proc far vector2_between_plus proc far
@@r = word ptr 6 @@r = word ptr 6

View File

@ -3572,20 +3572,14 @@ loc_BD00:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, large (80 shl 16) or 0, _CosTable8[bx]
push 500000h
call vector1_at
add sp, 6
mov di, ax mov di, ax
mov bx, word_20CE4 mov bx, word_20CE4
mov al, [bx+6] mov al, [bx+6]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, large (80 shl 16) or 0, _SinTable8[bx]
push 500000h
call vector1_at
add sp, 6
mov [bp+var_2], ax mov [bp+var_2], ax
mov bx, word_20CE4 mov bx, word_20CE4
add [bx], di add [bx], di
@ -4147,11 +4141,7 @@ arg_2 = byte ptr 6
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, word_20E3E, word_20E42, _CosTable8[bx]
push word_20E42
push word_20E3E
call vector1_at
add sp, 6
mov dl, byte ptr word_23AF0 mov dl, byte ptr word_23AF0
mov dh, 0 mov dh, 0
add dx, dx add dx, dx
@ -4162,11 +4152,7 @@ arg_2 = byte ptr 6
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_20E40, word_20E42, _SinTable8[bx]
push word_20E42
push word_20E40
call vector1_at
add sp, 6
mov [bp+var_4], ax mov [bp+var_4], ax
push [bp+var_2] push [bp+var_2]
push ax push ax
@ -6105,7 +6091,7 @@ loc_D06E:
push ds push ds
lea ax, [si+6] lea ax, [si+6]
push ax push ax
push 40h push 64
mov al, [si+8] mov al, [si+8]
mov ah, 0 mov ah, 0
push ax push ax
@ -9893,22 +9879,14 @@ loc_F26E:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, di, [bp+arg_0], _CosTable8[bx]
push [bp+arg_0]
push di
call vector1_at
add sp, 6
add ax, 0FFE8h add ax, 0FFE8h
mov [bp+var_2], ax mov [bp+var_2], ax
mov al, [bp+var_5] mov al, [bp+var_5]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, [bp+arg_2], [bp+arg_0], _SinTable8[bx]
push [bp+arg_0]
push [bp+arg_2]
call vector1_at
add sp, 6
add ax, 0FFE8h add ax, 0FFE8h
mov [bp+var_4], ax mov [bp+var_4], ax
push [bp+var_2] push [bp+var_2]
@ -10007,10 +9985,7 @@ sub_F356 proc near
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, large (16 shl 16) or 0, _SinTable8[bx]
push 100000h
call vector1_at
add sp, 6
mov word_1F348, ax mov word_1F348, ax
cmp word_1F33E, 300h cmp word_1F33E, 300h
jg short loc_F399 jg short loc_F399
@ -11279,21 +11254,13 @@ loc_FE54:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, word_1F33E, (48 shl 4), _CosTable8[bx]
push 300h
push word_1F33E
call vector1_at
add sp, 6
mov word_23E3E, ax mov word_23E3E, ax
mov al, byte_20E2B mov al, byte_20E2B
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_1F340, (48 shl 4), _SinTable8[bx]
push 300h
push word_1F340
call vector1_at
add sp, 6
mov word_23E40, ax mov word_23E40, ax
mov al, byte_20E2B mov al, byte_20E2B
add al, 40h add al, 40h
@ -11658,21 +11625,13 @@ arg_2 = word ptr 6
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, [bp+var_2], si, _CosTable8[bx]
push si
push [bp+var_2]
call vector1_at
add sp, 6
mov di, ax mov di, ax
mov al, [bp+arg_0] mov al, [bp+arg_0]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, [bp+var_4], si, _SinTable8[bx]
push si
push [bp+var_4]
call vector1_at
add sp, 6
mov [bp+var_6], ax mov [bp+var_6], ax
push di push di
push ax push ax
@ -11687,21 +11646,13 @@ arg_2 = word ptr 6
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, [bp+var_2], si, _CosTable8[bx]
push si
push [bp+var_2]
call vector1_at
add sp, 6
mov di, ax mov di, ax
mov al, [bp+arg_0] mov al, [bp+arg_0]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, [bp+var_4], si, _SinTable8[bx]
push si
push [bp+var_4]
call vector1_at
add sp, 6
mov [bp+var_6], ax mov [bp+var_6], ax
push di push di
push ax push ax
@ -12889,21 +12840,13 @@ loc_10C8D:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, word_1F33E, (32 shl 4), _CosTable8[bx]
push 200h
push word_1F33E
call vector1_at
add sp, 6
mov word_23E3E, ax mov word_23E3E, ax
mov al, [bp+var_1] mov al, [bp+var_1]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_1F340, (32 shl 4), _SinTable8[bx]
push 200h
push word_1F340
call vector1_at
add sp, 6
mov word_23E40, ax mov word_23E40, ax
call sub_17730 call sub_17730
mov al, [bp+var_1] mov al, [bp+var_1]
@ -12916,21 +12859,13 @@ loc_10C8D:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, word_1F33E, (32 shl 4), _CosTable8[bx]
push 200h
push word_1F33E
call vector1_at
add sp, 6
mov word_23E3E, ax mov word_23E3E, ax
mov al, [bp+var_1] mov al, [bp+var_1]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_1F340, (32 shl 4), _SinTable8[bx]
push 200h
push word_1F340
call vector1_at
add sp, 6
mov word_23E40, ax mov word_23E40, ax
call sub_17730 call sub_17730
@ -12948,11 +12883,7 @@ loc_10D62:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_1F344, (48 shl 4), _SinTable8[bx]
push 300h
push word_1F344
call vector1_at
add sp, 6
mov word_1F340, ax mov word_1F340, ax
cmp word_1F3B0, 80h cmp word_1F3B0, 80h
jb short locret_10D9E jb short locret_10D9E
@ -13116,11 +13047,7 @@ loc_10EC9:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, word_1F33E, (48 shl 4), _CosTable8[bx]
push 300h
push word_1F33E
call vector1_at
add sp, 6
mov bx, si mov bx, si
add bx, bx add bx, bx
mov [bx+686Ah], ax mov [bx+686Ah], ax
@ -13128,11 +13055,7 @@ loc_10EC9:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_1F340, (48 shl 4), _SinTable8[bx]
push 300h
push word_1F340
call vector1_at
add sp, 6
mov bx, si mov bx, si
add bx, bx add bx, bx
mov [bx+6876h], ax mov [bx+6876h], ax
@ -13611,21 +13534,13 @@ loc_11330:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, word_1F33E, [bp+arg_0], _CosTable8[bx]
push [bp+arg_0]
push word_1F33E
call vector1_at
add sp, 6
mov di, ax mov di, ax
mov al, [bp+arg_2] mov al, [bp+arg_2]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_1F340, [bp+arg_0], _SinTable8[bx]
push [bp+arg_0]
push word_1F340
call vector1_at
add sp, 6
mov [bp+var_2], ax mov [bp+var_2], ax
push di push di
mov al, [bp+var_6] mov al, [bp+var_6]
@ -14380,21 +14295,13 @@ loc_11978:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, word_1F33E, [bp+arg_4], _CosTable8[bx]
push [bp+arg_4]
push word_1F33E
call vector1_at
add sp, 6
mov di, ax mov di, ax
mov al, [bp+arg_0] mov al, [bp+arg_0]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_1F340, [bp+arg_4], _SinTable8[bx]
push [bp+arg_4]
push word_1F340
call vector1_at
add sp, 6
mov [bp+var_2], ax mov [bp+var_2], ax
push di push di
push [bp+var_4] push [bp+var_4]
@ -14572,21 +14479,13 @@ loc_11ADD:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, word_1F33E, word_1F356, _CosTable8[bx]
push word_1F356
push word_1F33E
call vector1_at
add sp, 6
mov [bp+var_2], ax mov [bp+var_2], ax
mov al, [bp+var_5] mov al, [bp+var_5]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_1F340, word_1F356, _SinTable8[bx]
push word_1F356
push word_1F340
call vector1_at
add sp, 6
mov [bp+var_4], ax mov [bp+var_4], ax
mov ax, [bp+var_2] mov ax, [bp+var_2]
mov word_23E3E, ax mov word_23E3E, ax
@ -14836,21 +14735,13 @@ loc_11D77:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, word_1F33E, word_1F356, _CosTable8[bx]
push word_1F356
push word_1F33E
call vector1_at
add sp, 6
mov [bp+var_2], ax mov [bp+var_2], ax
mov al, [bp+var_5] mov al, [bp+var_5]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_1F340, word_1F356, _SinTable8[bx]
push word_1F356
push word_1F340
call vector1_at
add sp, 6
mov [bp+var_4], ax mov [bp+var_4], ax
mov ax, [bp+var_2] mov ax, [bp+var_2]
mov word_23E3E, ax mov word_23E3E, ax
@ -15149,21 +15040,13 @@ loc_12021:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, word_1F33E, [bp+var_6], _CosTable8[bx]
push [bp+var_6]
push word_1F33E
call vector1_at
add sp, 6
mov di, ax mov di, ax
mov al, [bp+var_7] mov al, [bp+var_7]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_1F340, [bp+var_6], _SinTable8[bx]
push [bp+var_6]
push word_1F340
call vector1_at
add sp, 6
mov [bp+var_2], ax mov [bp+var_2], ax
push di push di
mov al, byte ptr word_1FE88 mov al, byte ptr word_1FE88
@ -16197,21 +16080,13 @@ loc_129A0:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, word_1F33E, [bp+var_8], _CosTable8[bx]
push [bp+var_8]
push word_1F33E
call vector1_at
add sp, 6
mov di, ax mov di, ax
mov al, [bp+var_9] mov al, [bp+var_9]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_1F340, [bp+var_8], _SinTable8[bx]
push [bp+var_8]
push word_1F340
call vector1_at
add sp, 6
mov [bp+var_2], ax mov [bp+var_2], ax
push di push di
push [bp+var_6] push [bp+var_6]
@ -17243,21 +17118,13 @@ loc_13286:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, word_1F33E, [bp+var_6], _CosTable8[bx]
push [bp+var_6]
push word_1F33E
call vector1_at
add sp, 6
mov di, ax mov di, ax
mov al, [bp+var_7] mov al, [bp+var_7]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_1F340, [bp+var_6], _SinTable8[bx]
push [bp+var_6]
push word_1F340
call vector1_at
add sp, 6
mov [bp+var_2], ax mov [bp+var_2], ax
push di push di
mov al, byte ptr word_1FE88 mov al, byte ptr word_1FE88
@ -17456,21 +17323,13 @@ loc_13426:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, word_1F33E, (48 shl 4), _CosTable8[bx]
push 300h
push word_1F33E
call vector1_at
add sp, 6
mov word_23E3E, ax mov word_23E3E, ax
mov al, [bp+var_1] mov al, [bp+var_1]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_1F340, (48 shl 4), _SinTable8[bx]
push 300h
push word_1F340
call vector1_at
add sp, 6
mov word_23E40, ax mov word_23E40, ax
mov al, [bp+var_1] mov al, [bp+var_1]
add al, [bp+var_2] add al, [bp+var_2]
@ -17922,21 +17781,13 @@ loc_1383D:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, [bp+var_2], 48, _CosTable8[bx]
push 30h ; '0'
push [bp+var_2]
call vector1_at
add sp, 6
mov [bp+var_6], ax mov [bp+var_6], ax
mov al, [bp+var_9] mov al, [bp+var_9]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, [bp+var_4], 48, _SinTable8[bx]
push 30h ; '0'
push [bp+var_4]
call vector1_at
add sp, 6
mov [bp+var_8], ax mov [bp+var_8], ax
test di, 3 test di, 3
jz short loc_1388B jz short loc_1388B
@ -18026,21 +17877,13 @@ loc_13910:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, word_1F33E, [bp+var_6], _CosTable8[bx]
push [bp+var_6]
push word_1F33E
call vector1_at
add sp, 6
mov di, ax mov di, ax
mov al, [bp+var_7] mov al, [bp+var_7]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, word_1F340, [bp+var_6], _SinTable8[bx]
push [bp+var_6]
push word_1F340
call vector1_at
add sp, 6
mov [bp+var_2], ax mov [bp+var_2], ax
push di push di
mov al, byte ptr word_1FE88 mov al, byte ptr word_1FE88
@ -21393,9 +21236,9 @@ loc_1541D:
cwd cwd
idiv bx idiv bx
mov bx, dx mov bx, dx
mov al, [bx+678h] mov al, angles_1DBD8[bx]
push ax push ax
push 0B0h ; '°' push 176
call vector2 call vector2
mov bx, word_20E22 mov bx, word_20E22
mov byte ptr [bx+1], 0 mov byte ptr [bx+1], 0
@ -22174,11 +22017,7 @@ loc_15A91:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, 144, di, _CosTable8[bx]
push di
push 90h
call vector1_at
add sp, 6
add ax, [bp+var_2] add ax, [bp+var_2]
mov bx, si mov bx, si
add bx, bx add bx, bx
@ -22189,11 +22028,7 @@ loc_15A91:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, 200, di, _SinTable8[bx]
push di
push 0C8h
call vector1_at
add sp, 6
cwd cwd
sub ax, dx sub ax, dx
sar ax, 1 sar ax, 1
@ -22226,11 +22061,7 @@ loc_15B29:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, 144, di, _CosTable8[bx]
push di
push 90h
call vector1_at
add sp, 6
add ax, [bp+var_2] add ax, [bp+var_2]
mov bx, si mov bx, si
add bx, bx add bx, bx
@ -22241,11 +22072,7 @@ loc_15B29:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, 200, di, _SinTable8[bx]
push di
push 0C8h
call vector1_at
add sp, 6
cwd cwd
sub ax, dx sub ax, dx
sar ax, 1 sar ax, 1
@ -24283,22 +24110,14 @@ loc_16BEC:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, [bp+var_6], [bp+arg_2], _CosTable8[bx]
push [bp+arg_2]
push [bp+var_6]
call vector1_at
add sp, 6
mov di, ax mov di, ax
mov al, [bp+var_A] mov al, [bp+var_A]
add al, [bp+arg_0] add al, [bp+arg_0]
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, [bp+var_8], [bp+arg_2], _SinTable8[bx]
push [bp+arg_2]
push [bp+var_8]
call vector1_at
add sp, 6
mov [bp+var_2], ax mov [bp+var_2], ax
push di push di
mov al, byte ptr word_1FE88 mov al, byte ptr word_1FE88
@ -25634,9 +25453,9 @@ loc_1767D:
add al, byte ptr word_23E42+1 add al, byte ptr word_23E42+1
push ax push ax
push ds push ds
push offset word_23E48 push offset point_23E48.x
push ds push ds
push offset word_23E4A push offset point_23E48.y
mov al, [bp+var_9] mov al, [bp+var_9]
mov ah, 0 mov ah, 0
push ax push ax
@ -25646,9 +25465,9 @@ loc_1767D:
loc_176A8: loc_176A8:
push ds push ds
push offset word_23E48 push offset point_23E48.x
push ds push ds
push offset word_23E4A push offset point_23E48.y
mov al, byte ptr [bp+var_2] mov al, byte ptr [bp+var_2]
add al, byte ptr word_23E42+1 add al, byte ptr word_23E42+1
push ax push ax
@ -25941,9 +25760,9 @@ loc_17914:
push [bp+var_4] push [bp+var_4]
call sub_173A2 call sub_173A2
mov [bp+var_B], al mov [bp+var_B], al
mov ax, word_23E48 mov ax, point_23E48.x
mov [si+0Ah], ax mov [si+0Ah], ax
mov ax, word_23E4A mov ax, point_23E48.y
mov [si+0Ch], ax mov [si+0Ch], ax
mov al, byte_26352 mov al, byte_26352
mov [si+0Fh], al mov [si+0Fh], al
@ -27593,7 +27412,7 @@ loc_18667:
push ax push ax
call randring_far_next16 call randring_far_next16
push ax push ax
push 0E0h push 224
call vector2 call vector2
loc_18692: loc_18692:
@ -28025,7 +27844,7 @@ loc_18A68:
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] push _CosTable8[bx]
push 900090h push (144 shl 16) or 144
call vector1_at call vector1_at
add sp, 6 add sp, 6
mov si, ax mov si, ax
@ -28034,7 +27853,7 @@ loc_18A68:
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] push _SinTable8[bx]
push 9000B8h push (144 shl 16) or 184
call vector1_at call vector1_at
add sp, 6 add sp, 6
mov di, ax mov di, ax
@ -28055,7 +27874,7 @@ loc_18A68:
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] push _CosTable8[bx]
push 900090h push (144 shl 16) or 144
call vector1_at call vector1_at
add sp, 6 add sp, 6
mov si, ax mov si, ax
@ -28064,7 +27883,7 @@ loc_18A68:
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] push _SinTable8[bx]
push 9000B8h push (144 shl 16) or 184
call vector1_at call vector1_at
add sp, 6 add sp, 6
mov di, ax mov di, ax
@ -33977,7 +33796,7 @@ loc_1B7BC:
cmp byte ptr [bx+1], 0 cmp byte ptr [bx+1], 0
jnz short loc_1B855 jnz short loc_1B855
mov al, [bx+3] mov al, [bx+3]
add al, 0FEh add al, -2
mov [bp+var_9], al mov [bp+var_9], al
push ds push ds
mov ax, word_1F868 mov ax, word_1F868
@ -33985,7 +33804,7 @@ loc_1B7BC:
push ax push ax
push ds push ds
mov ax, word_1F868 mov ax, word_1F868
add ax, 0Ah add ax, 10
push ax push ax
push word ptr [bx+2] push word ptr [bx+2]
mov al, [bp+var_9] mov al, [bp+var_9]
@ -34013,10 +33832,10 @@ loc_1B7BC:
push ax push ax
push ds push ds
mov ax, word_1F868 mov ax, word_1F868
add ax, 0Ah add ax, 10
push ax push ax
push word ptr [bx+2] push word ptr [bx+2]
push 0A0h push 160
call vector2 call vector2
jmp short loc_1B896 jmp short loc_1B896
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -36463,7 +36282,8 @@ a00ch_bf2 db '00ch.bf2',0
db 0FEh db 0FEh
aEnedat_dat db 'ENEDAT.DAT',0 aEnedat_dat db 'ENEDAT.DAT',0
db 0 db 0
db 'ŔśĘŔ°Đ',0 angles_1DBD8 db 192, 182, 202, 192, 176, 208
db 0
db 4 db 4
db 8 db 8
db 0 db 0
@ -42468,8 +42288,7 @@ word_23E42 dw ?
word_23E44 dw ? word_23E44 dw ?
byte_23E46 db ? byte_23E46 db ?
byte_23E47 db ? byte_23E47 db ?
word_23E48 dw ? point_23E48 Point <?>
word_23E4A dw ?
word_23E4C dw ? word_23E4C dw ?
byte_23E4E db ? byte_23E4E db ?
byte_23E4F db ? byte_23E4F db ?

View File

@ -3461,11 +3461,7 @@ loc_B6CF:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _CosTable8[bx] call vector1_at c, (RES_X / 2), si, _CosTable8[bx]
push si
push 140h
call vector1_at
add sp, 6
mov [bp+var_2], ax mov [bp+var_2], ax
mov al, byte ptr [bp+var_6] mov al, byte ptr [bp+var_6]
add al, [bp+arg_6] add al, [bp+arg_6]
@ -3479,11 +3475,7 @@ loc_B6CF:
mov ah, 0 mov ah, 0
add ax, ax add ax, ax
mov bx, ax mov bx, ax
push _SinTable8[bx] call vector1_at c, (RES_Y / 2), si, _SinTable8[bx]
push si
push 0C8h ; 'Č'
call vector1_at
add sp, 6
mov [bp+var_4], ax mov [bp+var_4], ax
push [bp+var_2] push [bp+var_2]
push ax push ax

13
th04/math/math.h Normal file
View File

@ -0,0 +1,13 @@
#include "th03/math/math.h"
// Vectors
// -------
// (different calling convention and parameter order than the TH03 one)
int pascal far vector1_at(int angle, int length, int origin);
int pascal near vector2_near(Point near *ret, int angle, int length);
int pascal far vector2_at(
Point near *ret, int origin_x, int origin_y, int length, int angle
);
// -------

View File

@ -1,5 +1,4 @@
; int pascal far vector1_at(int angle, int length, int origin) public VECTOR1_AT
; (different calling convention than the TH03 one)
vector1_at proc far vector1_at proc far
@@angle = word ptr 6 @@angle = word ptr 6

View File

@ -1,6 +1,3 @@
; int pascal far vector2_at(
; Point *ret, int origin_x, int origin_y, int length, int angle
; );
public VECTOR2_AT public VECTOR2_AT
vector2_at proc far vector2_at proc far

View File

@ -54,11 +54,6 @@ typedef struct {
} }
} motion_t; } motion_t;
// Vectors
// -------
int pascal near vector2_near(Point near *ret, unsigned char angle, int r);
// -------
#include "th03/math/randring.h" #include "th03/math/randring.h"
inline char randring_angle(char random_range, char offset) inline char randring_angle(char random_range, char offset)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5931,10 +5931,10 @@ loc_D53E:
idiv bx idiv bx
add dx, 5Ch add dx, 5Ch
mov [si+0Eh], dx mov [si+0Eh], dx
push 50D2h push offset point_151D2
push word_156E4 push x_156E4
push word_156E8 push y_156E8
push 0C0h push (12 shl 4)
mov al, [si+12h] mov al, [si+12h]
mov ah, 0 mov ah, 0
push ax push ax
@ -5947,9 +5947,9 @@ loc_D53E:
mov ah, 0 mov ah, 0
push ax push ax
call vector2_at call vector2_at
movsx eax, word_151D2 movsx eax, point_151D2.x
mov [si], eax mov [si], eax
movsx eax, word_151D4 movsx eax, point_151D2.y
mov [si+4], eax mov [si+4], eax
inc di inc di
add si, 14h add si, 14h
@ -6228,7 +6228,7 @@ loc_D7F2:
loc_D7F8: loc_D7F8:
cmp [bp+var_2], 30h ; '0' cmp [bp+var_2], 30h ; '0'
jl loc_D73A jl loc_D73A
mov si, 55E4h mov si, offset x_156E4
cmp dword ptr [si], 0FFFFC190h cmp dword ptr [si], 0FFFFC190h
jz short loc_D83F jz short loc_D83F
mov ax, [si+8] mov ax, [si+8]
@ -6283,17 +6283,17 @@ sub_D853 proc near
and al, 7Fh and al, 7Fh
mov [si+12h], al mov [si+12h], al
mov word ptr [si+0Eh], 30h ; '0' mov word ptr [si+0Eh], 30h ; '0'
push 50D2h push offset point_151D2
push word_156E4 push x_156E4
push word_156E8 push y_156E8
push 0C0h push (12 shl 4)
mov al, [si+12h] mov al, [si+12h]
mov ah, 0 mov ah, 0
push ax push ax
call vector2_at call vector2_at
movsx eax, word_151D2 movsx eax, point_151D2.x
mov [si], eax mov [si], eax
movsx eax, word_151D4 movsx eax, point_151D2.y
mov [si+4], eax mov [si+4], eax
cmp word_1183C, 40h cmp word_1183C, 40h
jl short loc_D8B3 jl short loc_D8B3
@ -6335,9 +6335,9 @@ loc_D8BE:
loc_D8E3: loc_D8E3:
or dx, dx or dx, dx
jge short loc_D8BE jge short loc_D8BE
mov ax, word_156E4 mov ax, x_156E4
mov word_156F8, ax mov word_156F8, ax
mov ax, word_156E8 mov ax, y_156E8
mov word_156FA, ax mov word_156FA, ax
pop bp pop bp
retn retn
@ -11688,8 +11688,7 @@ byte_151CC db ?
db ? db ?
word_151CE dw ? word_151CE dw ?
word_151D0 dw ? word_151D0 dw ?
word_151D2 dw ? point_151D2 Point <?>
word_151D4 dw ?
word_151D6 dw ? word_151D6 dw ?
word_151D8 dw ? word_151D8 dw ?
word_151DA dw ? word_151DA dw ?
@ -12017,9 +12016,9 @@ word_151E2 dw ?
dd ? ; dd ? ;
dd ? ; dd ? ;
dd ? ; dd ? ;
word_156E4 dw ? x_156E4 dw ?
dw ? dw ?
word_156E8 dw ? y_156E8 dw ?
dw ? dw ?
word_156EC dw ? word_156EC dw ?
dd ? ; dd ? ;