KAZIK/tools/tests/hall_test.inc
Artvasil09 3ad5bf4c9d Develop assembly-only casino scenes and native games
Add native Durak, poker, blackjack, roulette, Buckshot and billiards scenes with animation assets and regression tests. Improve arrival, city, hall, profiles, shops, audio and exit handling; remove the portable C game core and refresh shipping executables.
2026-10-08 22:39:19 +03:00

438 lines
12 KiB
PHP

.data
hallTestPaths3D db "build\actions\hall-overview.bmp",0
hallTestBar3D db "build\actions\hall-bar.bmp",0
hallTestBunker3D db "build\actions\hall-bunker.bmp",0
hallTestStair3D db "build\actions\hall-stairs.bmp",0
hallTestWheel3D db "build\actions\native-wheel.bmp",0
hallTestPool3D db "build\actions\native-pool.bmp",0
hallTestGuards3D db "build\actions\city-guards-approach.bmp",0
hallTestDrink3D db "build\actions\bar-drink.bmp",0
hallTestDining3D db "build\actions\hall-dining.bmp",0
hallTestStreetV43D db "build\actions\city-street-v4.bmp",0
hallTestCabaret3D db "build\actions\hall-cabaret-v4.bmp",0
hallTestHighball3D db "build\actions\bar-highball-v4.bmp",0
hallTestCocktail3D db "build\actions\bar-cocktail-v4.bmp",0
hallTestWater3D db "build\actions\bar-water-v4.bmp",0
hallTestScratch3D db "build\actions\pool-scratch-v4.bmp",0
hallTestPower3D db "build\actions\pool-power-v4.bmp",0
hallTestStage3D dd 70
.data?
hallSurfaceTestPixels3D dd (256*256) dup(?)
.code
TestHallSurface3D PROC uses ebx esi edi
local oldPixels:DWORD,transitions:DWORD
invoke ResolveWorldSurface3D,58
cmp ecx, 256
jne surface_test_fail
cmp edx, 256
jne surface_test_fail
mov ebx, hallCityDetail3D.pixels
add ebx, 256*256*4
cmp eax, ebx
jne surface_test_fail
mov eax, hallArchitectureHD3D.pixels
mov oldPixels, eax
lea edi, hallSurfaceTestPixels3D
xor esi, esi
surface_test_fill:
mov eax, esi
and eax, 1
neg eax
or eax, 0FF000000h
stosd
inc esi
cmp esi, 256*256
jb surface_test_fill
mov playerX,16*FP_1+FP_HALF
mov playerY,27*FP_1
mov playerAngle,384
call UpdateCamera3D
call RenderCeilingAndFloor
call RenderWalls
call PrepareCityDepth3D
mov hallArchitectureHD3D.pixels, OFFSET hallSurfaceTestPixels3D
invoke DrawCityVertical3D,1,25*FP_1,16*FP_1,17*FP_1,0,FP_1,92
mov transitions, 0
mov esi, 211
mov ebx, screenBuffer[(HALF_H*SCREEN_W+210)*4]
surface_test_samples:
mov eax, screenBuffer[(HALF_H*SCREEN_W)*4+esi*4]
cmp eax, ebx
je @F
inc transitions
@@:
mov ebx, eax
inc esi
cmp esi, 430
jb surface_test_samples
cmp transitions, 150
jb surface_test_restore_fail
lea edi,hallSurfaceTestPixels3D
mov ecx,256*256
mov eax,0FF9933DDh
rep stosd
invoke DrawCityHorizontal3D,16*FP_1,17*FP_1,26*FP_1,28*FP_1,FP_1*3/5,92
cmp screenBuffer[(400*SCREEN_W+HALF_W)*4],009933DDh
jne surface_test_restore_fail
mov eax, oldPixels
mov hallArchitectureHD3D.pixels, eax
mov eax, 1
ret
surface_test_restore_fail:
mov eax, oldPixels
mov hallArchitectureHD3D.pixels, eax
surface_test_fail:
xor eax, eax
ret
TestHallSurface3D ENDP
include tools\tests\world_regression.inc
RunHallTest3D PROC uses ebx esi edi
local oldBank:DWORD,oldSeed:DWORD,endX:DWORD,endV:DWORD
mov eax, bankroll
mov oldBank, eax
mov eax, rngSeed3D
mov oldSeed, eax
call InitializeCasinoSprites3D
call InitHall3D
call LoadHallAssets3D
call LoadCityArrival3D
cmp hallBartender3D.frames, 24
jne hall_test_fail
cmp hallDrink3D.frames, 21
jne hall_test_fail
cmp hallProps3D.frames, 9
jne hall_test_fail
cmp hallCityDetail3D.imageWidth, 256
jne hall_test_fail
cmp hallRoomMaterials3D.frames, 12
jne hall_test_fail
cmp hallPatrons3D.frames, 16
jne hall_test_fail
cmp hallArchitectureHD3D.imageWidth, 256
jne hall_test_fail
cmp hallDecorPack3D.frames, 6
jne hall_test_fail
call TestHallSurface3D
cmp eax, 1
jne hall_test_fail
; Sample the entire walking route; every accepted position must stay navigable.
mov patronClock3D, 0
mov deltaTime3D, 50
mov ebx, 400
hall_test_patron_route:
call UpdatePatrons3D
cmp ebx, 201
jne @F
cmp hallGuests3D.posX,22*FP_1
jne hall_test_fail
cmp hallGuests3D.posY,20*FP_1
jne hall_test_fail
@@:
invoke CanWalk3D,hallGuests3D.posX,hallGuests3D.posY
cmp eax, 1
jne hall_test_fail
invoke CanWalk3D,hallGuests3D[SIZEOF CityProp3D].posX,hallGuests3D[SIZEOF CityProp3D].posY
cmp eax, 1
jne hall_test_fail
dec ebx
jnz hall_test_patron_route
cmp patronClock3D, 0
jne hall_test_fail
cmp hallGuests3D.posX,18*FP_1
jne hall_test_fail
cmp hallGuests3D.posY,18*FP_1
jne hall_test_fail
invoke CanWalk3D,4*FP_1,27*FP_1
test eax, eax
jnz hall_test_fail
invoke CanWalk3D,6*FP_1,21*FP_1+FP_HALF
test eax, eax
jnz hall_test_fail
mov playerX, 16*FP_1+FP_HALF
mov playerY, 27*FP_1+FP_HALF
mov playerAngle, 384
call UpdateCamera3D
call RenderCeilingAndFloor
call RenderWalls
call PrepareCityDepth3D
call RenderSprites
call RenderHall3D
invoke WriteActionSnapshot3D,OFFSET hallTestPaths3D
mov hallTestStage3D, 71
mov playerX, 6*FP_1
mov playerY, 26*FP_1
call UpdateCamera3D
call RenderCeilingAndFloor
call RenderWalls
call PrepareCityDepth3D
call RenderHall3D
invoke WriteActionSnapshot3D,OFFSET hallTestBar3D
mov playerAngle, 256
mov playerX, 13*FP_1
mov playerY, 26*FP_1+FP_HALF
call UpdateCamera3D
call RenderCeilingAndFloor
call RenderWalls
call PrepareCityDepth3D
call RenderHall3D
invoke WriteActionSnapshot3D,OFFSET hallTestDining3D
cmp patronClock3D, 0
jne hall_test_fail
mov playerAngle, 384
invoke CanWalk3D,6*FP_1,23*FP_1+FP_HALF
test eax, eax
jnz hall_test_fail
mov interactTargetId, INTERACT_BASEMENT
call TriggerHallInteraction3D
mov stairsTime3D, 800
call RenderStairs3D
invoke WriteActionSnapshot3D,OFFSET hallTestStair3D
mov deltaTime3D, 1600
call HandleStairs3D
cmp hallLevel3D, 1
jne hall_test_fail
cmp worldMap3D, OFFSET bunkerMap3D
jne hall_test_fail
invoke CanWalk3D,16*FP_1+FP_HALF,16*FP_1
cmp eax, 1
jne hall_test_fail
mov playerY, 17*FP_1
call UpdateCamera3D
call RenderCeilingAndFloor
call RenderWalls
call PrepareCityDepth3D
call RenderHall3D
invoke WriteActionSnapshot3D,OFFSET hallTestBunker3D
mov interactTargetId, INTERACT_UPSTAIRS
call TriggerHallInteraction3D
mov deltaTime3D, 1600
call HandleStairs3D
cmp hallLevel3D, 0
jne hall_test_fail
cmp worldMap3D, OFFSET casinoMap
jne hall_test_fail
mov hallTestStage3D, 72
mov bankroll, 0
mov barPhase3D, 0
invoke BuyBarDrink3D,0
cmp barPhase3D, 0
jne hall_test_fail
mov bankroll, 500
invoke BuyBarDrink3D,0
cmp bankroll, 400
jne hall_test_fail
invoke BuyBarDrink3D,0
cmp bankroll, 400
jne hall_test_fail
mov barTime3D, 2850
call RenderBar3D
cmp bankroll, 400
jne hall_test_fail
mov barPhase3D, 2
mov barTime3D, 1000
call RenderBar3D
invoke WriteActionSnapshot3D,OFFSET hallTestDrink3D
mov barSelection3D, 2
mov barIntoxication3D, 60000
mov barTime3D, 2390
mov deltaTime3D, 16
call HandleBar3D
cmp barIntoxication3D, 0
jne hall_test_fail
mov hallTestStage3D, 73
call InitNativeWheel3D
mov bankroll, 1000
mov wheelChip3D, 50
invoke WheelAddBet3D,1
invoke WheelAddBet3D,37
invoke WheelAddBet3D,43
cmp wheelStake3D, 150
jne hall_test_fail
cmp bankroll, 1000
jne hall_test_fail
mov wheelResult3D, 1
mov roulState, 1
sub bankroll, 150
call WheelSettle3D
cmp wheelReturn3D, 2050
jne hall_test_fail
cmp bankroll, 2900
jne hall_test_fail
call WheelSettle3D
cmp bankroll, 2900
jne hall_test_fail
invoke WheelBetMultiplier3D,0,0
cmp eax, 36
jne hall_test_fail
mov esi, 37
hall_test_zero_outside:
invoke WheelBetMultiplier3D,esi,0
test eax, eax
jnz hall_test_fail
inc esi
cmp esi, 49
jb hall_test_zero_outside
invoke WheelBetMultiplier3D,37,36
cmp eax, 2
jne hall_test_fail
invoke WheelBetMultiplier3D,38,36
test eax, eax
jnz hall_test_fail
call RenderNativeWheel3D
invoke WriteActionSnapshot3D,OFFSET hallTestWheel3D
mov hallTestStage3D, 74
call InitPool3D
mov esi, 2
hall_test_two_balls:
mov poolActive3D[esi*4], 0
inc esi
cmp esi, 16
jb hall_test_two_balls
mov poolX3D, 100*FP_1
mov poolY3D, 115*FP_1
mov poolX3D[4], 105*FP_1+FP_1*4/5
mov poolY3D[4], 115*FP_1
mov poolVX3D, FP_1
invoke PoolCollide3D,0,1
cmp poolVX3D, 2000
ja hall_test_fail
cmp poolVX3D[4], 63000
jb hall_test_fail
mov eax, poolVX3D
add eax, poolVX3D[4]
cmp eax, FP_1
jne hall_test_fail
mov poolX3D, 100*FP_1
mov poolX3D[4], 110*FP_1
mov poolVX3D, 90000
mov poolVX3D[4], 0
mov poolFirst3D, -1
mov ebx, 10
hall_test_fast_contact:
call PoolStep3D
dec ebx
jnz hall_test_fast_contact
cmp poolFirst3D, 1
jne hall_test_fail
cmp poolVX3D[4], 0
jle hall_test_fail
mov poolActive3D[4], 0
mov poolX3D, 33*FP_1
mov poolVX3D, -30000
call PoolStep3D
cmp poolVX3D, 0
jle hall_test_fail
cmp poolVX3D, 30000
jae hall_test_fail
mov hallTestStage3D, 75
mov poolActive3D[4], 0
mov poolX3D, 160*FP_1
mov poolY3D, 52*FP_1
invoke PoolPocketBall3D,0
cmp poolActive3D, 0
jne hall_test_fail
cmp poolPocket3D, 1
jne hall_test_fail
; Near a middle pocket, the jaw must rebound an off-center approach.
mov poolActive3D, 1
mov poolX3D, 145*FP_1
mov poolY3D, 64*FP_1
mov poolVX3D, 0
mov poolVY3D, -20000
invoke PoolJawContact3D,0
cmp poolVY3D, 0
jle hall_test_fail
mov poolVY3D, 0
invoke PoolPlaceCue3D,100*FP_1,115*FP_1
cmp eax, 1
jne hall_test_fail
mov poolVX3D, 30000
mov poolState3D, POOL_MOVING
mov poolActive3D, 1
mov poolAccumulator3D, 0
mov deltaTime3D, 16
mov esi, 10
hall_test_partition_a:
call HandlePool3D
dec esi
jnz hall_test_partition_a
mov eax, poolX3D
mov endX, eax
mov eax, poolVX3D
mov endV, eax
mov poolX3D, 100*FP_1
mov poolVX3D, 30000
mov poolAccumulator3D, 0
mov poolState3D, POOL_MOVING
mov deltaTime3D, 10
mov esi, 16
hall_test_partition_b:
call HandlePool3D
dec esi
jnz hall_test_partition_b
mov eax, endX
cmp eax, poolX3D
jne hall_test_fail
mov eax, endV
cmp eax, poolVX3D
jne hall_test_fail
mov esi, 2000
hall_test_friction:
call PoolStep3D
dec esi
jnz hall_test_friction
cmp poolVX3D, 0
jne hall_test_fail
mov hallTestStage3D, 76
call InitPool3D
mov poolBreak3D, 0
mov poolFirst3D, 8
mov poolRail3D, 1
mov poolActive3D[8*4], 0
mov poolPotted3D, 100h
call PoolFinishShot3D
cmp poolState3D, POOL_RESULT
jne hall_test_fail
cmp poolWinner3D, 1
jne hall_test_fail
call InitPool3D
mov poolGroups3D, 1
mov poolAtStart3D, 0
mov poolBreak3D, 0
mov poolFirst3D, 8
mov poolRail3D, 1
mov poolActive3D[8*4], 0
mov poolPotted3D, 100h
mov poolCalled3D, 8
mov poolCalledPocket3D, 0
mov poolPocket3D[8*4], 0
call PoolFinishShot3D
cmp poolWinner3D, 0
jne hall_test_fail
call InitPool3D
call RenderPool3D
invoke WriteActionSnapshot3D,OFFSET hallTestPool3D
mov arrivalState3D, ARRIVAL_WALK
mov cityPhase3D, CITY_TURN_DOOR
mov cityTime3D, 820
call RenderCityArrival3D
invoke WriteActionSnapshot3D,OFFSET hallTestGuards3D
mov hallTestStage3D, 77
call RunWorldRegression3D
test eax, eax
jz hall_test_fail
mov eax, oldSeed
cmp eax, rngSeed3D
jne hall_test_fail
mov eax, oldBank
mov bankroll, eax
mov deltaTime3D, 16
mov engineMode, MODE_WALK
xor eax, eax
ret
hall_test_fail:
mov eax, hallTestStage3D
ret
RunHallTest3D ENDP