KAZIK/tools/tests/bowling_test.inc
Artvasil09 3150d217b5 feat: add playable bowling match mode and calibrate rooftop character scaling
- Add playable ten-frame bowling against bot with two timing gates (direction/power) and fixed-step physics

- Add lane match interaction, shaded ball surface, pin collisions, bonus balls, and live score sheet

- Scale rooftop terrace visitor sprites to eye level according to the taller rooftop standing eye height

- Resolve mode and interaction ID conflicts with Hell FPS (MODE_BOWLING=30, INTERACT_BOWL_PLAY=56)

- Update launcher hash, installer package, and expansion regression test suites
2026-11-01 22:50:33 +03:00

242 lines
6.2 KiB
PHP

.data
bwTestEntrance db "build\hall-expansion\bowling-entrance.bmp",0
bwTestOverview db "build\hall-expansion\bowling-overview.bmp",0
bwTestRestaurant db "build\hall-expansion\bowling-restaurant.bmp",0
bwTestLanes db "build\hall-expansion\bowling-lanes.bmp",0
bwTestBar db "build\hall-expansion\bowling-bar.bmp",0
bwTestExit db "build\hall-expansion\bowling-exit.bmp",0
bwTestThrow0 db "build\hall-expansion\bowling-throw-0.bmp",0
bwTestThrow1 db "build\hall-expansion\bowling-throw-1.bmp",0
bwTestThrow2 db "build\hall-expansion\bowling-throw-2.bmp",0
bwTestThrow3 db "build\hall-expansion\bowling-throw-3.bmp",0
bwTestThrowPaths dd OFFSET bwTestThrow0,OFFSET bwTestThrow1,OFFSET bwTestThrow2,OFFSET bwTestThrow3
.code
BowlingNativeTests PROC uses ebx esi edi
local bank:DWORD
mov expansionStage,120
mov eax,bankroll
mov bank,eax
call InitBowling3D
call LoadBowling3D
cmp bwArt3D.frames,14
jne bw_test_fail
mov expansionStage,131
cmp characterCast3D.frames,CAST_COUNT*CAST_STRIDE
jne bw_test_fail
mov expansionStage,132
; Standard ten-frame scoring vectors, including tenth-frame bonuses.
lea edi,bwRolls3D
mov eax,10
mov ecx,12
rep stosd
mov bwRollCount3D,12
invoke BowlingScore3D,0
cmp eax,300
jne bw_test_fail
lea edi,bwRolls3D
mov eax,5
mov ecx,21
rep stosd
mov bwRollCount3D,21
invoke BowlingScore3D,0
cmp eax,150
jne bw_test_fail
lea edi,bwRolls3D
mov eax,1
mov ecx,20
rep stosd
mov bwRollCount3D,20
invoke BowlingScore3D,0
cmp eax,20
jne bw_test_fail
call InitBowling3D
invoke BowlingRegisterRoll3D,0,5
cmp bwBall3D,1
jne bw_test_fail
cmp bwFrames3D,0
jne bw_test_fail
invoke BowlingRegisterRoll3D,0,5
cmp bwFrames3D,1
jne bw_test_fail
cmp bwFrameDone3D,1
jne bw_test_fail
call InitBowling3D
mov bwFrames3D,9
invoke BowlingRegisterRoll3D,0,10
cmp bwBall3D,1
jne bw_test_fail
invoke BowlingRegisterRoll3D,0,10
cmp bwBall3D,2
jne bw_test_fail
invoke BowlingRegisterRoll3D,0,10
cmp bwFrames3D,10
jne bw_test_fail
mov expansionStage,121
call InitBowling3D
mov hallLevel3D,0
mov engineMode,MODE_WALK
mov worldMap3D,OFFSET casinoMap
mov playerX,5*FP_1
mov playerY,5*FP_1
mov playerAngle,384
call UpdateInteriorEye3D
mov esi,5*FP_1
bw_test_entrance_walk:
invoke CanWalk3D,5*FP_1,esi
test eax,eax
jz bw_test_fail
sub esi,FP_1/10
cmp esi,FP_1*14/10
jae bw_test_entrance_walk
call ExpansionFrame
invoke ExpansionSnapshot,OFFSET bwTestEntrance
cmp portalPixelsWritten3D,1000
jb bw_test_fail
mov expansionStage,125
mov playerY,FP_1*14/10
call BowlingTravel3D
cmp hallLevel3D,HALL_BOWLING
jne bw_test_fail
cmp playerX,17*FP_1
jne bw_test_fail
cmp playerY,FP_1*304/10
jne bw_test_fail
cmp viewCeiling3D,6*FP_1
jne bw_test_fail
mov expansionStage,126
invoke CanWalk3D,18*FP_1,25*FP_1
test eax,eax
jz bw_test_fail
invoke CanWalk3D,8*FP_1,10*FP_1
test eax,eax
jnz bw_test_fail
invoke CanWalk3D,22*FP_1,12*FP_1
test eax,eax
jnz bw_test_fail
mov expansionStage,122
mov esi,12000
bw_test_simulate:
mov deltaTime3D,50
add animationClock3D,50
call UpdateBowling3D
xor edi,edi
bw_test_bounds:
cmp bwRollCount3D[edi*4],21
ja bw_test_fail
cmp bwFrames3D[edi*4],10
ja bw_test_fail
cmp bwScores3D[edi*4],300
ja bw_test_fail
inc edi
cmp edi,16
jb bw_test_bounds
dec esi
jnz bw_test_simulate
mov expansionStage,123
mov playerX,17*FP_1
mov playerY,FP_1*301/10
mov playerAngle,350
call UpdateInteriorEye3D
call UpdateCamera3D
call RenderBowling3D
invoke ExpansionSnapshot,OFFSET bwTestOverview
mov playerX,18*FP_1
mov playerY,24*FP_1
mov playerAngle,330
call UpdateCamera3D
call RenderBowling3D
invoke ExpansionSnapshot,OFFSET bwTestLanes
mov playerX,21*FP_1
mov playerY,26*FP_1
mov playerAngle,420
call UpdateCamera3D
call RenderBowling3D
invoke ExpansionSnapshot,OFFSET bwTestRestaurant
mov playerX,23*FP_1
mov playerY,8*FP_1
mov playerAngle,420
call UpdateCamera3D
call RenderBowling3D
invoke ExpansionSnapshot,OFFSET bwTestBar
mov expansionStage,124
mov playerX,6*FP_1
mov playerY,FP_1*277/10
mov playerAngle,350
mov bwState3D,2
xor esi,esi
bw_test_throw_frames:
imul eax,esi,650
mov bwTime3D,eax
call UpdateCamera3D
call RenderBowling3D
invoke ExpansionSnapshot,bwTestThrowPaths[esi*4]
inc esi
cmp esi,4
jb bw_test_throw_frames
mov bwSeatTarget3D,0
mov interactTargetId,INTERACT_BOWL_SEAT
call TryBowlingInteraction3D
cmp bwSeat3D,1
jne bw_test_fail
cmp viewEye3D,FP_1*12/10
jne bw_test_fail
mov interactTargetId,INTERACT_BOWL_SEAT
call TryBowlingInteraction3D
cmp bwSeat3D,0
jne bw_test_fail
cmp playerX,6*FP_1
jne bw_test_fail
mov expansionStage,127
mov edi,4
bw_test_bar_visits:
mov engineMode,MODE_BAR
mov barPhase3D,0
invoke BuyBarDrink3D,2
call RenderBar3D
cmp playerX,6*FP_1
jne bw_test_fail
cmp playerY,FP_1*277/10
jne bw_test_fail
cmp playerAngle,350
jne bw_test_fail
mov deltaTime3D,3000
call HandleBar3D
call RenderBar3D
mov deltaTime3D,2400
call HandleBar3D
mov engineMode,MODE_WALK
call UpdateInteriorEye3D
cmp viewEye3D,HALL_STANDING_EYE
jne bw_test_fail
cmp viewCeiling3D,6*FP_1
jne bw_test_fail
dec edi
jnz bw_test_bar_visits
mov expansionStage,124
mov playerX,17*FP_1
mov playerY,29*FP_1
mov playerAngle,128
call UpdateCamera3D
call RenderBowling3D
invoke ExpansionSnapshot,OFFSET bwTestExit
mov playerY,FP_1*306/10
call BowlingTravel3D
cmp hallLevel3D,0
jne bw_test_fail
cmp playerX,5*FP_1
jne bw_test_fail
cmp playerY,FP_1*16/10
jne bw_test_fail
mov eax,bankroll
cmp eax,bank
jne bw_test_fail
mov engineMode,MODE_WALK
call ClearKeys3D
call CharacterCastNativeTests
call BowlingPlayNativeTests
ret
bw_test_fail:
invoke ExitProcess,expansionStage
ret
BowlingNativeTests ENDP
include tools/tests/bowling_play_test.inc