diff --git a/th04/playperf.asm b/th04/playperf.asm new file mode 100644 index 00000000..4ba983e5 --- /dev/null +++ b/th04/playperf.asm @@ -0,0 +1,33 @@ +; void playperf_raise(char delta); +_playperf_raise proc far +delta = byte ptr 4 + + mov bx, sp + mov al, ss:[bx+delta] + add al, _playperf + cmp al, _playperf_max + jbe short @@ret + mov al, _playperf_max + +@@ret: + mov _playperf, al + retf 2 +_playperf_raise endp + even + + +; void playperf_lower(char delta); +_playperf_lower proc far +delta = byte ptr 4 + + mov bx, sp + mov al, _playperf + sub al, ss:[bx+delta] + cmp al, _playperf_min + jge short @@ret + mov al, _playperf_min + +@@ret: + mov _playperf, al + retf 2 +_playperf_lower endp diff --git a/th04/playperf[bss].asm b/th04/playperf[bss].asm new file mode 100644 index 00000000..d27bcdfc --- /dev/null +++ b/th04/playperf[bss].asm @@ -0,0 +1,4 @@ +; Player performance ("rank") +_playperf db ? +_playperf_max db ? +_playperf_min db ? diff --git a/th04_main.asm b/th04_main.asm index 10887def..405ee127 100644 --- a/th04_main.asm +++ b/th04_main.asm @@ -469,7 +469,7 @@ loc_ACDE: or dx, dx jnz short loc_ACF4 push 1 - nopcall sub_C364 + nopcall _playperf_raise jmp short $+2 loc_ACF4: @@ -563,7 +563,7 @@ loc_ADBB: les bx, dword_2CDC6 cmp byte ptr es:[bx+3Eh], 0 jz short loc_ADD7 - mov byte_266D5, 1Ch + mov _playperf, 28 mov byte_25688, 2 loc_ADD0: @@ -572,7 +572,7 @@ loc_ADD0: ; --------------------------------------------------------------------------- loc_ADD7: - mov byte_266D5, 10h + mov _playperf, 16 cmp stage_id, 6 jnz short loc_ADEA mov byte_25688, 4 @@ -599,8 +599,8 @@ loc_ADFC: loc_AE17: mov word_2CFFE, 64h ; 'd' - mov byte_266D7, 4 - mov byte_266D6, 10h + mov _playperf_min, 4 + mov _playperf_max, 16 mov fp_2D000, offset sub_1CEEE mov fp_2D002, offset sub_1CF4E mov fp_2D004, offset sub_1CEC5 @@ -609,16 +609,16 @@ loc_AE17: loc_AE3C: mov word_2CFFE, 0FAh - mov byte_266D7, 0Bh - mov byte_266D6, 18h + mov _playperf_min, 11 + mov _playperf_max, 24 jmp short loc_AEB0 ; --------------------------------------------------------------------------- loc_AE4E: - mov byte_266D5, 14h + mov _playperf, 20 mov word_2CFFE, 190h - mov byte_266D7, 14h - mov byte_266D6, 20h ; ' ' + mov _playperf_min, 20 + mov _playperf_max, 32 mov fp_2D000, offset sub_1CF32 mov fp_2D002, offset sub_1CF86 mov fp_2D004, offset sub_1CED8 @@ -627,9 +627,9 @@ loc_AE4E: loc_AE77: mov word_2CFFE, 1F4h - mov byte_266D5, 16h - mov byte_266D7, 16h - mov byte_266D6, 22h ; '"' + mov _playperf, 22 + mov _playperf_min, 22 + mov _playperf_max, 34 mov fp_2D000, offset sub_1CF32 mov fp_2D002, offset sub_1CF86 mov fp_2D004, offset sub_1CEE3 @@ -638,8 +638,8 @@ loc_AE77: loc_AEA0: mov word_2CFFE, 0A00h - mov byte_266D7, 10h - mov byte_266D6, 14h + mov _playperf_min, 16 + mov _playperf_max, 20 loc_AEB0: mov fp_2D000, offset sub_1CF16 @@ -3252,42 +3252,7 @@ sub_C34E proc near retn 4 sub_C34E endp - -; =============== S U B R O U T I N E ======================================= - - -sub_C364 proc far - mov bx, sp - mov al, ss:[bx+4] - add al, byte_266D5 - cmp al, byte_266D6 - jbe short loc_C377 - mov al, byte_266D6 - -loc_C377: - mov byte_266D5, al - retf 2 -sub_C364 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_C37E proc far - mov bx, sp - mov al, byte_266D5 - sub al, ss:[bx+4] - cmp al, byte_266D7 - jge short loc_C390 - mov al, byte_266D7 - -loc_C390: - mov byte_266D5, al - retf 2 -sub_C37E endp - +include th04/playperf.asm ; =============== S U B R O U T I N E ======================================= @@ -8935,7 +8900,7 @@ loc_EE60: cmp [bp+var_1], 0 jz short locret_EEA3 push 4 - nopcall sub_C364 + nopcall _playperf_raise inc byte_22DA6 les bx, dword_2CDC6 assume es:nothing @@ -12586,13 +12551,13 @@ loc_109E9: nopcall sub_F07A nopcall sub_11DE6 call snd_se_play pascal, 2 - cmp byte_266D5, 16h + cmp _playperf, 22 jb short loc_10A16 - mov byte_266D5, 15h + mov _playperf, 21 loc_10A16: push 4 - nopcall sub_C37E + nopcall _playperf_lower les bx, dword_2CDC6 assume es:nothing inc byte ptr es:[bx+31h] @@ -21396,11 +21361,11 @@ loc_158F7: mov al, es:[di+1] mov ah, 0 mov [bp+var_4], ax - cmp byte_266D5, 10h + cmp _playperf, 16 jbe short loc_1593A - mov al, byte_266D5 + mov al, _playperf mov ah, 0 - add ax, 0FFF0h + add ax, -16 imul [bp+var_4] mov [bp+var_4], ax mov bx, 20h ; ' ' @@ -21419,9 +21384,9 @@ loc_158F7: ; --------------------------------------------------------------------------- loc_1593A: - cmp byte_266D5, 10h + cmp _playperf, 16 jnb short loc_15977 - mov al, byte_266D5 + mov al, _playperf mov ah, 0 push ax mov ax, 10h @@ -34965,8 +34930,8 @@ loc_1CAFC: jl loc_1C8EC cmp byte_266E0, 0 jnz loc_1CC19 - mov di, 18h - mov al, byte_266D5 + mov di, 24 + mov al, _playperf mov ah, 0 add di, ax mov al, byte_25688 @@ -35423,7 +35388,7 @@ sub_1CE12 proc near jmp cs:off_1CEAF[bx] loc_1CE2D: - cmp byte_266D5, 18h + cmp _playperf, 24 jb short loc_1CE3A inc byte_266EF pop bp @@ -35431,7 +35396,7 @@ loc_1CE2D: ; --------------------------------------------------------------------------- loc_1CE3A: - cmp byte_266D5, 6 + cmp _playperf, 6 ja short loc_1CEAD cmp byte_266EF, 2 jb short loc_1CEAD @@ -35441,13 +35406,13 @@ loc_1CE3A: ; --------------------------------------------------------------------------- loc_1CE4E: - cmp byte_266D5, 18h + cmp _playperf, 24 jb short loc_1CE57 jmp short loc_1CE81 ; --------------------------------------------------------------------------- loc_1CE57: - cmp byte_266D5, 6 + cmp _playperf, 6 ja short loc_1CEAD cmp byte_266EF, 3 jb short loc_1CEAD @@ -35457,7 +35422,7 @@ loc_1CE57: ; --------------------------------------------------------------------------- loc_1CE6C: - cmp byte_266D5, 18h + cmp _playperf, 24 jb short loc_1CE7A mov al, byte_266EF add al, 4 @@ -35465,7 +35430,7 @@ loc_1CE6C: ; --------------------------------------------------------------------------- loc_1CE7A: - cmp byte_266D5, 14h + cmp _playperf, 20 jb short loc_1CE88 loc_1CE81: @@ -35477,14 +35442,14 @@ loc_1CE81: loc_1CE88: cmp byte_266EF, 5 jb short loc_1CEAD - cmp byte_266D5, 0Ah + cmp _playperf, 10 ja short loc_1CE9E mov al, byte_266EF add al, 0FEh mov byte_266EF, al loc_1CE9E: - cmp byte_266D5, 4 + cmp _playperf, 4 ja short loc_1CEAD mov al, byte_266EF add al, 0FCh @@ -36021,7 +35986,7 @@ sub_1D1CD proc near mov byte_266EE, al mov ah, 0 mov cx, ax - mov al, byte_266D5 + mov al, _playperf mov ah, 0 imul cx mov cx, ax @@ -36798,7 +36763,7 @@ loc_1D822: push 1 loc_1D82E: - call sub_C364 + call _playperf_raise jmp short loc_1D854 ; --------------------------------------------------------------------------- @@ -36815,7 +36780,7 @@ loc_1D843: push 1 loc_1D84F: - call sub_C37E + call _playperf_lower loc_1D854: les bx, dword_2CDC6 @@ -36825,8 +36790,7 @@ loc_1D854: mov al, es:[bx+31h] cmp al, stage_id ja short loc_1D876 - push 2 - call sub_C364 + call _playperf_raise pascal, 2 loc_1D876: les bx, dword_2CDC6 @@ -36837,8 +36801,7 @@ loc_1D876: add dx, dx cmp ax, dx jg short loc_1D893 - push 2 - call sub_C364 + call _playperf_raise pascal, 2 loc_1D893: pop si @@ -37348,8 +37311,7 @@ loc_1DD35: ; --------------------------------------------------------------------------- loc_1DD47: - push 3 - call sub_C364 + call _playperf_raise pascal, 3 les bx, dword_2CDC6 inc byte ptr es:[bx+0Bh] call sub_EEE8 @@ -37408,8 +37370,7 @@ loc_1DDC9: mov al, byte_23660 add al, 0E0h mov byte_23660, al - push 1 - call sub_C364 + call _playperf_raise pascal, 1 loc_1DDDF: inc word_236DA @@ -37476,7 +37437,7 @@ loc_1DE2F: push 4 loc_1DE31: - call sub_C37E + call _playperf_lower loc_1DE36: cmp byte_23661, 40h @@ -37484,8 +37445,7 @@ loc_1DE36: mov al, byte_23661 add al, 0D0h mov byte_23661, al - push 1 - call sub_C37E + call _playperf_lower pascal, 1 loc_1DE4C: pop si @@ -46875,9 +46835,7 @@ word_266D0 dw ? byte_266D2 db ? byte_266D3 db ? stage_id db ? -byte_266D5 db ? -byte_266D6 db ? -byte_266D7 db ? +include th04/playperf[bss].asm playchar db ? db ? word_266DA dw ? diff --git a/th05_main.asm b/th05_main.asm index 32a3cd02..1a782d5b 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -541,7 +541,7 @@ loc_B003: test frame, 0FFFh jnz short loc_B055 push 1 - nopcall sub_E720 + nopcall _playperf_raise jmp short $+2 loc_B055: @@ -631,18 +631,18 @@ loc_B112: jz short loc_B145 cmp byte ptr es:[bx+1Fh], 5 jnb short loc_B13E - mov byte_25FEC, 28h ; '(' + mov _playperf, 40 mov byte_25FEB, 3 jmp short loc_B156 ; --------------------------------------------------------------------------- loc_B13E: - mov byte_25FEC, 20h ; ' ' + mov _playperf, 32 jmp short loc_B151 ; --------------------------------------------------------------------------- loc_B145: - mov byte_25FEC, 20h ; ' ' + mov _playperf, 32 cmp stage_id, 6 jnz short loc_B15D @@ -675,8 +675,8 @@ loc_B16F: loc_B18A: mov word_2C988, 1770h mov word_2C97C, 19h - mov byte_25FEE, 10h - mov byte_25FED, 20h ; ' ' + mov _playperf_min, 16 + mov _playperf_max, 32 mov fp_25344, offset sub_15EF4 jmp short loc_B222 ; --------------------------------------------------------------------------- @@ -684,17 +684,17 @@ loc_B18A: loc_B1A8: mov word_2C988, 2710h mov word_2C97C, 32h ; '2' - mov byte_25FEE, 18h - mov byte_25FED, 28h ; '(' + mov _playperf_min, 24 + mov _playperf_max, 40 jmp short loc_B21C ; --------------------------------------------------------------------------- loc_B1C0: mov word_2C988, 3A98h - mov byte_25FEC, 2Ch ; ',' + mov _playperf, 44 mov word_2C97C, 64h ; 'd' - mov byte_25FEE, 2Ch ; ',' - mov byte_25FED, 36h ; '6' + mov _playperf_min, 44 + mov _playperf_max, 54 mov fp_25344, offset sub_15F00 jmp short loc_B222 ; --------------------------------------------------------------------------- @@ -702,9 +702,9 @@ loc_B1C0: loc_B1E3: mov word_2C988, 4E20h mov word_2C97C, 0C8h - mov byte_25FEC, 30h ; '0' - mov byte_25FEE, 30h ; '0' - mov byte_25FED, 3Ah ; ':' + mov _playperf, 48 + mov _playperf_min, 48 + mov _playperf_max, 58 mov fp_25344, offset sub_15F08 jmp short loc_B222 ; --------------------------------------------------------------------------- @@ -712,8 +712,8 @@ loc_B1E3: loc_B206: mov word_2C988, 9C40h mov word_2C97C, 1F4h - mov byte_25FEE, 20h ; ' ' - mov byte_25FED, 24h ; '$' + mov _playperf_min, 32 + mov _playperf_max, 36 loc_B21C: mov fp_25344, offset sub_15EFC @@ -3177,7 +3177,7 @@ loc_C4BC: assume es:nothing inc byte ptr es:[bx+1Ch] push 1 - nopcall sub_E73A + nopcall _playperf_lower loc_C518: pop bp @@ -7851,42 +7851,7 @@ sub_E708 endp ; --------------------------------------------------------------------------- nop - -; =============== S U B R O U T I N E ======================================= - - -sub_E720 proc far - mov bx, sp - mov al, ss:[bx+4] - add al, byte_25FEC - cmp al, byte_25FED - jbe short loc_E733 - mov al, byte_25FED - -loc_E733: - mov byte_25FEC, al - retf 2 -sub_E720 endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_E73A proc far - mov bx, sp - mov al, byte_25FEC - sub al, ss:[bx+4] - cmp al, byte_25FEE - jge short loc_E74C - mov al, byte_25FEE - -loc_E74C: - mov byte_25FEC, al - retf 2 -sub_E73A endp - +include th04/playperf.asm ; =============== S U B R O U T I N E ======================================= @@ -15019,13 +14984,13 @@ loc_12064: sub power, al nopcall sub_E4FC call snd_se_play pascal, 2 - cmp byte_25FEC, 26h ; '&' + cmp _playperf, 38 jbe short loc_12083 - mov byte_25FEC, 26h ; '&' + mov _playperf, 38 loc_12083: push 4 - nopcall sub_E73A + nopcall _playperf_lower les bx, dword_23EF0 inc byte ptr es:[bx+1Bh] @@ -21079,10 +21044,10 @@ loc_1559C: loc_155A1: mov al, ah xor ah, ah - mov dl, byte_25FEC - cmp dl, 20h ; ' ' + mov dl, _playperf + cmp dl, 32 jbe short loc_155C7 - sub dl, 20h ; ' ' + sub dl, 32 mul dl shr ax, 6 xor dh, dh @@ -21735,12 +21700,12 @@ sub_15A24 endp sub_15A42 proc near shr al, 1 mov cl, al - mul byte_25FEC + mul _playperf shr ax, 5 add al, cl - cmp al, 80h + cmp al, 128 jbe short loc_15A55 - mov al, 80h + mov al, 128 loc_15A55: cmp al, 8 @@ -22413,8 +22378,8 @@ sub_15ECE proc near and al, 0FEh cmp al, 6 jnz short locret_15EF2 - mov al, byte_25FEC - cmp al, 26h ; '&' + mov al, _playperf + cmp al, 38 jb short loc_15EE3 inc byte ptr dword_26002+2 retn @@ -23388,7 +23353,7 @@ loc_166E9: push 1 loc_166F5: - call sub_E720 + call _playperf_raise jmp short loc_1671B ; --------------------------------------------------------------------------- @@ -23405,7 +23370,7 @@ loc_1670A: push 1 loc_16716: - call sub_E73A + call _playperf_lower loc_1671B: push ss @@ -24454,8 +24419,7 @@ sub_16F05 proc near add ax, 64h ; 'd' cmp ax, word_22648 ja short loc_16F52 - push 4 - call sub_E720 + call _playperf_raise pascal, 4 inc byte_226C4 cmp lives, 99 jnb short loc_16F52 @@ -24676,7 +24640,7 @@ loc_1711E: loc_1712C: push 3 - call sub_E720 + call _playperf_raise inc lives call sub_10407 call snd_se_play pascal, 7 @@ -24723,8 +24687,7 @@ loc_17199: mov al, byte_225CC add al, 0E0h mov byte_225CC, al - push 1 - call sub_E720 + call _playperf_raise pascal, 1 loc_171AF: inc word_22646 @@ -24785,7 +24748,7 @@ loc_171FD: push 4 loc_171FF: - call sub_E73A + call _playperf_lower loc_17204: call sub_1059D @@ -45923,9 +45886,7 @@ byte_25FE8 db ? byte_25FE9 db ? stage_id db ? byte_25FEB db ? -byte_25FEC db ? -byte_25FED db ? -byte_25FEE db ? +include th04/playperf[bss].asm playchar db ? word_25FF0 dw ? byte_25FF2 db ?