From 31411d77438ea97dd9eea2c2b3360cb8627d6ffe Mon Sep 17 00:00:00 2001 From: nmlgc Date: Wed, 27 Mar 2024 22:33:29 +0100 Subject: [PATCH] [Decompilation] [th02] Verdict screen: Score rendering For once, I'm glad that ZUN copy-pasted this one-off function. Otherwise, it probably wouldn't have been that easy to factor out. Part of P0278, funded by Yanga. --- th02/end/end.cpp | 16 +++++++++++ th02_maine.asm | 69 +++--------------------------------------------- 2 files changed, 19 insertions(+), 66 deletions(-) diff --git a/th02/end/end.cpp b/th02/end/end.cpp index 0a0b3d5a..e34322e5 100644 --- a/th02/end/end.cpp +++ b/th02/end/end.cpp @@ -1,8 +1,13 @@ #include #include "platform.h" +#include "pc98.h" #include "master.hpp" #include "shiftjis.hpp" +#include "th02/score.h" +#include "th02/v_colors.hpp" #include "th02/formats/end.hpp" +#include "th02/gaiji/gaiji.h" +#include "th02/gaiji/score_p.hpp" // State // ----- @@ -21,3 +26,14 @@ void pascal near end_load(const char *fn) file_close(); } + +void pascal near verdict_value_score_put( + screen_x_t left, screen_y_t top, score_t score +) +{ + #define on_digit(i, gaiji) { \ + graph_gaiji_putc((left + (GAIJI_W * i)), top, gaiji, V_WHITE); \ + } + gaiji_score_put(score, on_digit, false); + #undef on_digit +} diff --git a/th02_maine.asm b/th02_maine.asm index f7ceebde..1a397a77 100644 --- a/th02_maine.asm +++ b/th02_maine.asm @@ -117,6 +117,8 @@ _TEXT ends END_TEXT segment byte public 'CODE' use16 @END_LOAD$QNXC procdesc pascal near \ fn_seg:word, fn_off:word + @VERDICT_VALUE_SCORE_PUT$QIIL procdesc pascal near \ + left_and_top:dword, score:dword END_TEXT ends ; Segment type: Pure code @@ -125,69 +127,6 @@ maine_01_TEXT segment byte public 'CODE' use16 ;org 3 assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_95CB proc near - -var_9 = byte ptr -9 -var_8 = dword ptr -8 -var_4 = dword ptr -4 -arg_0 = dword ptr 4 -@@y = word ptr 8 -@@x = word ptr 0Ah - - enter 0Ah, 0 - push si - push di - mov di, gb_0_ - mov [bp+var_4], 10000000 - mov [bp+var_9], 0 - xor si, si - jmp short loc_9638 -; --------------------------------------------------------------------------- - -loc_95E4: - mov eax, [bp+arg_0] - cdq - idiv [bp+var_4] - mov ebx, 10 - cdq - idiv ebx - mov [bp+var_8], edx - mov eax, [bp+var_4] - cdq - idiv ebx - mov [bp+var_4], eax - mov ax, word ptr [bp+var_8] - add ax, gb_0_ - mov di, ax - cmp [bp+var_8], 0 - jz short loc_961D - mov [bp+var_9], 1 - -loc_961D: - cmp [bp+var_9], 0 - jz short loc_9637 - mov ax, si - shl ax, 4 - add ax, [bp+@@x] - call graph_gaiji_putc pascal, ax, [bp+@@y], di, V_WHITE - -loc_9637: - inc si - -loc_9638: - cmp si, 8 - jl short loc_95E4 - pop di - pop si - leave - retn 8 -sub_95CB endp - - ; =============== S U B R O U T I N E ======================================= ; Attributes: bp-based frame @@ -2468,9 +2407,7 @@ loc_A992: push (128 shl 16) or 64 call _graph_putsa_fx add sp, 0Ah - push 0C00080h - pushd [_score] - call sub_95CB + call @verdict_value_score_put$qiil pascal, (192 shl 16) or 128, large [_score] push 100080h push 40h call sub_97F1