KAZIK/tools/tests/billiards_choice_test.inc
Игорь Федосеев ca62db53e9 feat: implement native billiards, scratch tickets, first-person dice, and city wake scene
- Billiards: add native Russian Pyramid & American Eight-Ball pool with physics prediction, controls, and regression tests
- Scratch Tickets: add dedicated counter, mat presentation, elliptical coin scraping, 4 ticket types, and payout effects
- First-Person Dice: add native dice scene, hand anchor frames, throwing animation, and table perspective
- City Wake & Weather: add arrival cutscene, alley geometry, weather/rain effects, and lighter/rocker animation
- World Dressing: add hall paintings, furniture packs, hall lighting, and scene regression tests
- Build & Tooling: update build.bat for modern MSVC toolchain, update launcher hash, and refresh shipping binaries
2026-10-16 12:37:40 +03:00

221 lines
5.6 KiB
PHP

include tools\tests\eightball_regression.inc
.data
billiardsTestStage3D dd 0
billiardsSelectBmp3D db "build\actions\billiards-select.bmp",0
billiardsEightBmp3D db "build\actions\billiards-eight.bmp",0
billiardsTraceBmp3D db "build\actions\billiards-trace.bmp",0
.code
RunBilliardsChoiceTest3D PROC uses ebx esi edi
local ticks:DWORD,oldPower:DWORD
mov billiardsTestStage3D,1
call InitPool3D
cmp poolState3D,POOL_SELECT
jne billiards_test_bad
call RenderPool3D
invoke WriteActionSnapshot3D,OFFSET billiardsSelectBmp3D
mov pressedKeys3D[32h],1
call HandlePool3D
cmp poolVariant3D,1
jne billiards_test_bad
cmp poolState3D,POOL_AIM
jne billiards_test_bad
cmp poolCapture2Q8,1024*1024
jne billiards_test_bad
call RenderPool3D
invoke WriteActionSnapshot3D,OFFSET billiardsEightBmp3D
mov billiardsTestStage3D,2
mov poolBreak3D,0
mov poolGroups3D,1
mov poolGroups3D[4],2
call EightCount3D
cmp poolAtStart3D,7
jne billiards_test_bad
invoke EightLegal3D,9
test eax,eax
jnz billiards_test_bad
mov poolFirst3D,9
mov poolRail3D,1
call PoolFinishShot3D
cmp poolState3D,POOL_HAND
jne billiards_test_bad
cmp poolPlayer3D,1
jne billiards_test_bad
cmp poolActive3D,0
jne billiards_test_bad
mov mouseClick3D,1
mov mouseX3D,110
mov mouseY3D,110
call EightHand3D
cmp poolState3D,POOL_AIM
jne billiards_test_bad
cmp poolActive3D,1
jne billiards_test_bad
mov billiardsTestStage3D,3
call ResetPool3D
mov poolBreak3D,0
mov poolCalled3D,1
mov poolCalledPocket3D,1
mov poolFirst3D,2
mov poolRail3D,1
mov poolPotted3D,2
mov poolActive3D[4],0
mov poolPocket3D[4],1
call EightCount3D
call PoolFinishShot3D
cmp poolGroups3D,1
jne billiards_test_bad
cmp poolGroups3D[4],2
jne billiards_test_bad
cmp poolPlayer3D,0
jne billiards_test_bad
call ResetPool3D
mov poolBreak3D,0
mov poolGroups3D,1
mov poolAtStart3D,0
mov poolFirst3D,8
mov poolCalled3D,8
mov poolCalledPocket3D,4
mov poolPotted3D,100h
mov poolActive3D[32],0
mov poolPocket3D[32],4
call PoolFinishShot3D
cmp poolWinner3D,0
jne billiards_test_bad
cmp poolState3D,POOL_RESULT
jne billiards_test_bad
; A break eight is spotted and the legal breaker keeps the turn.
call ResetPool3D
mov poolFirst3D,1
mov poolPotted3D,100h
mov poolActive3D[32],0
mov poolPocket3D[32],0
call PoolFinishShot3D
cmp poolActive3D[32],1
jne billiards_test_bad
cmp poolPlayer3D,0
jne billiards_test_bad
cmp poolState3D,POOL_AIM
jne billiards_test_bad
call ResetPool3D
mov poolBreak3D,0
mov poolFirst3D,8
mov poolPotted3D,100h
mov poolActive3D[32],0
call PoolFinishShot3D
cmp poolWinner3D,1
jne billiards_test_bad
mov billiardsTestStage3D,4
; Preview must be pure and bit-identical to an actual fixed-step shot.
invoke StartBilliards3D,0
mov poolBreak3D,0
mov esi,2
billiards_trace_clear:
mov poolActive3D[esi*4],0
inc esi
cmp esi,16
jb billiards_trace_clear
mov poolX3D,100*FP_1
mov poolY3D,100*FP_1
mov poolX3D[4],160*FP_1
mov poolY3D[4],100*FP_1
mov poolPower3D,90000
call PoolPredict3D
cmp poolTraceFirst3D,1
jne billiards_test_bad
cmp poolTraceCount3D,3
jb billiards_test_bad
lea esi,poolX3D
lea edi,poolPhysicsBackup3D
mov ecx,112
repe cmpsd
jne billiards_test_bad
lea esi,pyrRoll3D
lea edi,poolHistoryBackup3D
mov ecx,80
repe cmpsd
jne billiards_test_bad
cmp poolFirst3D,-1
jne billiards_test_bad
cmp poolPotted3D,0
jne billiards_test_bad
cmp poolPlayer3D,0
jne billiards_test_bad
mov eax,poolTraceKey3D
mov oldPower,eax
mov poolPower3D,20000
call PoolPredict3D
mov eax,oldPower
cmp poolTraceKey3D,eax
je billiards_test_bad
mov poolPower3D,90000
call PoolPredict3D
call RenderPool3D
invoke WriteActionSnapshot3D,OFFSET billiardsTraceBmp3D
call PoolShoot3D
mov deltaTime3D,240
call HandlePool3D
mov eax,poolTraceSteps3D
mov ticks,eax
billiards_trace_actual:
call PoolStep3D
dec ticks
jnz billiards_trace_actual
lea esi,poolX3D
lea edi,poolTraceFinal3D
mov ecx,112
repe cmpsd
jne billiards_test_bad
mov eax,poolTraceFirst3D
cmp poolFirst3D,eax
jne billiards_test_bad
mov eax,poolTracePotted3D
cmp poolPotted3D,eax
jne billiards_test_bad
mov billiardsTestStage3D,5
invoke StartBilliards3D,1
mov poolBreak3D,0
mov poolCalled3D,1
mov mouseClick3D,1
mov pyrPickClick3D,1
mov mouseX3D,160
mov mouseY3D,50
call HandlePool3D
cmp poolCalledPocket3D,1
jne billiards_test_bad
cmp pyrCue3D,0
jne billiards_test_bad
mov poolActive3D[8],0
mov poolCalled3D,1
mov pressedKeys3D[42h],1
call HandlePool3D
cmp poolCalled3D,2
je billiards_test_bad
mov poolBreak3D,1
mov poolFirst3D,1
mov poolBreakRails3D,0
mov poolPotted3D,0
call PoolFinishShot3D
cmp poolState3D,POOL_CHOICE
jne billiards_test_bad
invoke PyramidChoice3D,2
cmp poolBreak3D,1
jne billiards_test_bad
cmp poolState3D,POOL_AIM
jne billiards_test_bad
invoke PyramidSelect3D,5
cmp pyrCue3D,0
jne billiards_test_bad
call RunEightRegression3D
test eax,eax
jnz billiards_test_forward
invoke StartBilliards3D,0
cmp poolCapture2Q8,480*480
jne billiards_test_bad
xor eax,eax
ret
billiards_test_bad:
mov eax,billiardsTestStage3D
add eax,950
billiards_test_forward:
ret
RunBilliardsChoiceTest3D ENDP