KAZIK/tools/tests/coin_detail_test.inc
Artvasil09 4f8ae0893b Implement native slots, coin toss, European roulette and hall furniture
Add native assembly scenes and assets for Slots (777), Coin flip, and European Roulette; add 3D hall furniture packs and prompts; improve Russian UI strings in CP1251; update launcher hash and rebuild shipping binaries.
2026-10-10 14:43:30 +03:00

200 lines
5.6 KiB
PHP

.data
coinDetailBmpHeader3D db 42h,4Dh
dd 512054
dw 0,0
dd 54,40,320,-400
dw 1,32
dd 0,512000,0,0,0,0
coinDetailCapture0 db "build\actions\coin-detail-idle.bmp",0
coinDetailCapture1 db "build\actions\coin-detail-air.bmp",0
coinDetailCapture2 db "build\actions\coin-detail-heads.bmp",0
coinDetailCapture3 db "build\actions\coin-detail-tails.bmp",0
coinDetailCapture4 db "build\actions\coin-detail-loss.bmp",0
coinDetailCaptures3D dd OFFSET coinDetailCapture0,OFFSET coinDetailCapture1,OFFSET coinDetailCapture2,OFFSET coinDetailCapture3,OFFSET coinDetailCapture4
.code
RunCoinDetailWindowTest3D PROC uses ebx esi edi
local before:CoinDetailRect3D,after:CoinDetailRect3D,panel:CoinDetailRect3D,message:C3D_MSG
invoke GetWindowRect,h3DWnd,ADDR before
call OpenCoinDetail3D
cmp coinDetailWnd3D,0
je detail_window_test_fail
mov ebx,coinDetailWnd3D
call OpenCoinDetail3D
cmp coinDetailWnd3D,ebx
jne detail_window_test_fail
invoke GetWindow,ebx,4
cmp eax,h3DWnd
jne detail_window_test_fail
invoke IsWindowVisible,ebx
test eax,eax
jnz detail_window_test_fail
call LayoutCoinDetail3D
invoke GetWindowRect,ebx,ADDR panel
invoke GetWindowRect,h3DWnd,ADDR after
mov eax,after.right
add eax,8
cmp panel.left,eax
jne detail_window_test_fail
mov eax,panel.right
cmp eax,coinDetailMonitor3D[28]
jg detail_window_test_fail
mov eax,panel.top
cmp eax,coinDetailMonitor3D[24]
jl detail_window_test_fail
mov eax,panel.bottom
cmp eax,coinDetailMonitor3D[32]
jg detail_window_test_fail
call CloseCoinDetail3D
cmp coinDetailWnd3D,0
jne detail_window_test_fail
invoke IsWindow,ebx
test eax,eax
jnz detail_window_test_fail
invoke GetWindowRect,h3DWnd,ADDR after
lea esi,before
lea edi,after
mov ecx,4
repe cmpsd
jne detail_window_test_fail
invoke PeekMessageA,ADDR message,0,WM_QUIT,WM_QUIT,0
test eax,eax
jnz detail_window_test_fail
; F11 preserves a live detail window without saving its temporary resize.
call OpenCoinDetail3D
call ToggleFullscreen3D
cmp fullscreen3D,0
jne detail_window_test_fail
cmp coinDetailWnd3D,0
je detail_window_test_fail
call ToggleFullscreen3D
cmp fullscreen3D,1
jne detail_window_test_fail
call CloseCoinDetail3D
invoke GetWindowRect,h3DWnd,ADDR after
lea esi,before
lea edi,after
mov ecx,4
repe cmpsd
jne detail_window_test_fail
; Closing the preview must not undo an explicit later move of the owner.
call OpenCoinDetail3D
invoke SetWindowPos,h3DWnd,0,coinDetailMonitor3D[20],coinDetailMonitor3D[24],600,300,14h
invoke GetWindowRect,h3DWnd,ADDR panel
call CloseCoinDetail3D
invoke GetWindowRect,h3DWnd,ADDR after
lea esi,panel
lea edi,after
mov ecx,4
repe cmpsd
jne detail_window_test_fail
mov eax,before.right
sub eax,before.left
mov edx,before.bottom
sub edx,before.top
invoke SetWindowPos,h3DWnd,0,before.left,before.top,eax,edx,14h
xor eax,eax
ret
detail_window_test_fail:
mov eax,8601
ret
RunCoinDetailWindowTest3D ENDP
WriteCoinDetailSnapshot3D PROC uses ebx path:DWORD
local count:DWORD
invoke CreateFileA,path,40000000h,0,0,2,80h,0
cmp eax,-1
je detail_snapshot_fail
mov ebx,eax
invoke WriteFile,ebx,OFFSET coinDetailBmpHeader3D,54,ADDR count,0
invoke WriteFile,ebx,OFFSET coinDetailBuffer3D,512000,ADDR count,0
invoke CloseHandle,ebx
cmp count,512000
jne detail_snapshot_fail
mov eax,1
ret
detail_snapshot_fail:
xor eax,eax
ret
WriteCoinDetailSnapshot3D ENDP
RunCoinDetailRenderTest3D PROC uses ebx esi edi
local oldBank:DWORD,oldSeed:DWORD,oldTimer:DWORD,oldMode:DWORD,oldState:DWORD,oldChoice:DWORD,oldResult:DWORD
mov eax,bankroll
mov oldBank,eax
mov eax,rngSeed3D
mov oldSeed,eax
mov eax,coin3d_timer
mov oldTimer,eax
mov eax,engineMode
mov oldMode,eax
mov eax,coin3d_state
mov oldState,eax
mov eax,coin3d_choice
mov oldChoice,eax
mov eax,coin3d_result
mov oldResult,eax
mov edi,OFFSET screenBuffer
mov ecx,SCREEN_SIZE
mov eax,00123456h
rep stosd
mov engineMode,MODE_COIN
mov coin3d_choice,1
mov coin3d_result,1
mov coinStartPhase3D,96
xor ebx,ebx
detail_render_test_frame:
mov coin3d_state,COIN_IDLE
mov coin3d_timer,0
test ebx,ebx
jz detail_render_test_capture
mov coin3d_state,COIN_TOSS
mov coin3d_timer,600
cmp ebx,1
je detail_render_test_capture
mov coin3d_state,COIN_RESULT
mov coin3d_timer,COIN_TOTAL_MS
mov coin3d_result,1
cmp ebx,2
je detail_render_test_capture
mov coin3d_result,2
mov coin3d_choice,2
cmp ebx,3
je detail_render_test_capture
mov coin3d_choice,1
detail_render_test_capture:
call RenderCoinDetail3D
mov eax,oldBank
cmp bankroll,eax
jne detail_render_test_fail
mov eax,oldSeed
cmp rngSeed3D,eax
jne detail_render_test_fail
mov esi,OFFSET screenBuffer
mov ecx,SCREEN_SIZE
detail_render_test_scene:
cmp DWORD PTR [esi],00123456h
jne detail_render_test_fail
add esi,4
loop detail_render_test_scene
invoke WriteCoinDetailSnapshot3D,coinDetailCaptures3D[ebx*4]
test eax,eax
jz detail_render_test_fail
inc ebx
cmp ebx,5
jb detail_render_test_frame
mov eax,oldTimer
mov coin3d_timer,eax
mov eax,oldMode
mov engineMode,eax
mov eax,oldState
mov coin3d_state,eax
mov eax,oldChoice
mov coin3d_choice,eax
mov eax,oldResult
mov coin3d_result,eax
xor eax,eax
ret
detail_render_test_fail:
mov eax,8602
ret
RunCoinDetailRenderTest3D ENDP