KAZIK/tools/tests/hall_test.inc
Artvasil09 797ee366dc feat: implement upper lounge, manual stairs, cabaret, and casino terminals
- Native player-controlled stairs, upper lounge bar, and Hell Tower infernal portal
- Cabaret stage with musical acts, audience seating, and interaction
- Dedicated cash/trophy wall terminals with native balance and achievement screens
- Projecting 3D wall lanterns with ray/plane intersection
- Six roaming guests with seated poses and card rank rendering updates
- Synchronized launcher hash and updated binaries
2026-10-18 21:36:12 +03:00

513 lines
13 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*7/5,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*4/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
include tools\tests\hall_furniture_test.inc
include tools\tests\world_dressing_test.inc
include tools\tests\wheel_scene_test.inc
include tools\tests\npc_life_test.inc
HallTestWalkFrame3D PROC
add animationClock3D,16
call UpdateInteriorTravel3D
call HandlePlayerInput
call UpdateInteriorTravel3D
call UpdateInteriorEye3D
ret
HallTestWalkFrame3D ENDP
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 TestHallFurniture3D
cmp eax,1
jne hall_test_fail
call TestHallSurface3D
cmp eax, 1
jne hall_test_fail
call TestWorldDressing3D
cmp eax,1
jne hall_test_fail
; Visible people use the same personality positions as the new simulation.
mov patronClock3D, 0
mov deltaTime3D, 50
mov ebx, 400
hall_test_patron_route:
call UpdatePatrons3D
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
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
mov playerX, 27*FP_1
mov playerY, FP_1*105/10
mov playerAngle,0
mov deltaTime3D,16
call ClearKeys3D
call TriggerHallInteraction3D
cmp engineMode,MODE_WALK
jne hall_test_fail
mov esi,60
hall_test_open_door:
add animationClock3D,16
call UpdateInteriorTravel3D
dec esi
jnz hall_test_open_door
mov keys3D[57h],1
mov esi,800
hall_test_enter_stairs:
call HallTestWalkFrame3D
cmp engineMode,MODE_STAIRS
je hall_test_stair_frame
dec esi
jnz hall_test_enter_stairs
jmp hall_test_fail
hall_test_stair_frame:
call RenderStairs3D
invoke WriteActionSnapshot3D,OFFSET hallTestStair3D
mov esi,800
hall_test_descend_basement:
cmp engineMode,MODE_STAIRS
jne @F
cmp playerX,FP_1*165/10
jb @F
mov playerAngle,384
@@:
call HallTestWalkFrame3D
cmp engineMode,MODE_WALK
jne @F
cmp hallLevel3D, 1
je hall_test_basement_arrived
@@:
dec esi
jnz hall_test_descend_basement
jmp hall_test_fail
hall_test_basement_arrived:
mov keys3D[57h],0
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
call UpdateCamera3D
call RenderCeilingAndFloor
call RenderWalls
call PrepareCityDepth3D
call RenderHall3D
invoke WriteActionSnapshot3D,OFFSET hallTestBunker3D
mov playerAngle,128
mov keys3D[57h],1
mov esi,800
hall_test_return_basement:
cmp engineMode,MODE_STAIRS
jne @F
cmp playerY,21*FP_1
jb @F
mov playerAngle,256
@@:
call HallTestWalkFrame3D
cmp engineMode,MODE_WALK
jne @F
cmp hallLevel3D,0
je hall_test_back_in_hall
@@:
dec esi
jnz hall_test_return_basement
jmp hall_test_fail
hall_test_back_in_hall:
mov keys3D[57h],0
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 ResetPool3D
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], 102*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, 31*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, 51*FP_1+FP_1/2
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, 157*FP_1
mov poolY3D, 52*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 ResetPool3D
mov poolBreak3D, 0
mov poolFirst3D, 8
mov poolRail3D, 1
mov poolActive3D[8*4], 0
mov poolPotted3D, 100h
mov pyrScore3D,7
call PoolFinishShot3D
cmp poolState3D, POOL_RESULT
jne hall_test_fail
cmp poolWinner3D, 0
jne hall_test_fail
call ResetPool3D
mov poolBreak3D, 0
mov poolFirst3D, -1
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 poolState3D,POOL_PENALTY
jne hall_test_fail
cmp poolActive3D[8*4],1
jne hall_test_fail
invoke PyramidPenalty3D,1
cmp pyrScore3D[4],1
jne hall_test_fail
call ResetPool3D
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 RunWheelSceneTest3D
test eax,eax
jnz hall_test_fail
call RunWorldRegression3D
test eax, eax
jz hall_test_fail
call RunPyramidTest3D
test eax,eax
jnz hall_test_billiards_fail
call RunNpcLifeTest3D
test eax,eax
jnz 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_billiards_fail:
ret
hall_test_fail:
mov eax, hallTestStage3D
ret
RunHallTest3D ENDP