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.
519 lines
14 KiB
PHP
519 lines
14 KiB
PHP
; Executes Buckshot's MASM handlers and captures its real framebuffer.
|
|
.data
|
|
bsTestStage3D dd 240
|
|
bsPreviewName3D db "buckshot-preview.exe",0
|
|
bsPreviewPause3D db "PAUSED",0
|
|
bsTestCases3D LABEL DWORD
|
|
dd 0,0,0,0,4,4,1
|
|
dd 5,80,0,0,4,4,1
|
|
dd 5,460,0,0,4,4,1
|
|
dd 5,2430,0,0,4,4,1
|
|
dd 5,460,1,0,4,4,1
|
|
dd 6,300,0,1,4,4,1
|
|
dd 6,485,0,1,4,3,1
|
|
dd 6,620,0,1,4,3,1
|
|
dd 6,800,0,1,4,3,1
|
|
dd 6,180,0,0,4,4,0
|
|
dd 6,400,0,0,4,4,0
|
|
dd 6,485,0,0,3,4,0
|
|
dd 6,330,1,0,4,4,0
|
|
dd 6,485,1,0,3,4,0
|
|
dd 6,550,0,1,4,0,1
|
|
dd 9,900,0,1,4,0,1
|
|
dd 9,900,0,0,0,4,0
|
|
dd 10,900,0,1,4,0,1
|
|
dd 10,1800,0,1,4,0,1
|
|
dd 10,3000,0,1,4,0,1
|
|
dd 10,900,0,0,0,4,0
|
|
dd 10,1800,0,0,0,4,0
|
|
dd 3,0,0,1,4,4,1
|
|
dd 4,0,0,0,4,4,0
|
|
dd 7,200,0,0,4,4,1
|
|
dd 7,480,0,1,4,4,1
|
|
dd 7,480,0,2,4,4,1
|
|
dd 7,480,0,3,4,4,1
|
|
dd 6,510,0,0,3,4,0
|
|
dd 6,650,0,0,3,4,0
|
|
bsTestCaseCount3D equ 30
|
|
bsTestPaths3D dd OFFSET bsTestPath0,OFFSET bsTestPath1,OFFSET bsTestPath2,OFFSET bsTestPath3
|
|
dd OFFSET bsTestPath4,OFFSET bsTestPath5,OFFSET bsTestPath6,OFFSET bsTestPath7
|
|
dd OFFSET bsTestPath8,OFFSET bsTestPath9,OFFSET bsTestPath10,OFFSET bsTestPath11
|
|
dd OFFSET bsTestPath12,OFFSET bsTestPath13,OFFSET bsTestPath14,OFFSET bsTestPath15
|
|
dd OFFSET bsTestPath16,OFFSET bsTestPath17,OFFSET bsTestPath18,OFFSET bsTestPath19
|
|
dd OFFSET bsTestPath20,OFFSET bsTestPath21,OFFSET bsTestPath22,OFFSET bsTestPath23
|
|
dd OFFSET bsTestPath24,OFFSET bsTestPath25,OFFSET bsTestPath26,OFFSET bsTestPath27
|
|
dd OFFSET bsTestPath28,OFFSET bsTestPath29
|
|
bsTestPath0 db "build\actions\buckshot-ready.bmp",0
|
|
bsTestPath1 db "build\actions\buckshot-load-reach.bmp",0
|
|
bsTestPath2 db "build\actions\buckshot-load-shell.bmp",0
|
|
bsTestPath3 db "build\actions\buckshot-load-pump.bmp",0
|
|
bsTestPath4 db "build\actions\buckshot-dealer-load.bmp",0
|
|
bsTestPath5 db "build\actions\buckshot-aim.bmp",0
|
|
bsTestPath6 db "build\actions\buckshot-fire.bmp",0
|
|
bsTestPath7 db "build\actions\buckshot-recoil.bmp",0
|
|
bsTestPath8 db "build\actions\buckshot-rack.bmp",0
|
|
bsTestPath9 db "build\actions\buckshot-self-rise.bmp",0
|
|
bsTestPath10 db "build\actions\buckshot-self-aim.bmp",0
|
|
bsTestPath11 db "build\actions\buckshot-self-fire.bmp",0
|
|
bsTestPath12 db "build\actions\buckshot-dealer-aim.bmp",0
|
|
bsTestPath13 db "build\actions\buckshot-dealer-fire.bmp",0
|
|
bsTestPath14 db "build\actions\buckshot-fatal-dealer.bmp",0
|
|
bsTestPath15 db "build\actions\buckshot-death-dealer.bmp",0
|
|
bsTestPath16 db "build\actions\buckshot-death-player.bmp",0
|
|
bsTestPath17 db "build\actions\buckshot-revive-dealer-arms.bmp",0
|
|
bsTestPath18 db "build\actions\buckshot-revive-dealer-shock.bmp",0
|
|
bsTestPath19 db "build\actions\buckshot-revive-dealer-awake.bmp",0
|
|
bsTestPath20 db "build\actions\buckshot-revive-player-arms.bmp",0
|
|
bsTestPath21 db "build\actions\buckshot-revive-player-shock.bmp",0
|
|
bsTestPath22 db "build\actions\buckshot-win.bmp",0
|
|
bsTestPath23 db "build\actions\buckshot-lose.bmp",0
|
|
bsTestPath24 db "build\actions\buckshot-glass.bmp",0
|
|
bsTestPath25 db "build\actions\buckshot-saw.bmp",0
|
|
bsTestPath26 db "build\actions\buckshot-beer.bmp",0
|
|
bsTestPath27 db "build\actions\buckshot-cuffs.bmp",0
|
|
bsTestPath28 db "build\actions\buckshot-self-peak.bmp",0
|
|
bsTestPath29 db "build\actions\buckshot-self-smoke.bmp",0
|
|
.code
|
|
ResetBuckshotFixture3D PROC
|
|
call InitBuckshot3D
|
|
mov bankroll, 10000
|
|
mov engineMode, MODE_BUCKSHOT
|
|
mov bs3d_bet, 50
|
|
mov bs3d_state, BS_PLAYER
|
|
mov bs3d_turn, 0
|
|
mov bs3d_shooter, 0
|
|
mov bs3d_shellCount, 2
|
|
mov bs3d_shellIndex, 0
|
|
mov bs3d_liveCount, 1
|
|
mov bs3d_blankCount, 1
|
|
mov bs3d_shells, 1
|
|
mov bs3d_shells[4], 0
|
|
mov bs3d_damage, 1
|
|
mov bs3d_damage[4], 1
|
|
mov bs3d_skip, 0
|
|
mov bs3d_skip[4], 0
|
|
mov bs3d_known, -1
|
|
mov bs3d_known[4], -1
|
|
mov bs3d_effectDone, 0
|
|
mov bs3d_lastShot, 0
|
|
mov bs3d_messageTime, 0
|
|
mov mouseClick3D, 0
|
|
call ClearKeys3D
|
|
ret
|
|
ResetBuckshotFixture3D ENDP
|
|
|
|
RunBuckshotTest3D PROC uses ebx esi edi
|
|
local rounds:DWORD,ticks:DWORD,expected:DWORD
|
|
local oldBank:DWORD,oldSeed:DWORD,oldMode:DWORD,oldDelta:DWORD
|
|
mov eax, bankroll
|
|
mov oldBank, eax
|
|
mov eax, rngSeed3D
|
|
mov oldSeed, eax
|
|
mov eax, engineMode
|
|
mov oldMode, eax
|
|
mov eax, deltaTime3D
|
|
mov oldDelta, eax
|
|
call ResetBuckshotFixture3D
|
|
cmp bs3d_dealerActions.frames, 16
|
|
jne bs_test_fail
|
|
cmp bs3d_medical.frames, 32
|
|
jne bs_test_fail
|
|
cmp bs3d_self.frames, 8
|
|
jne bs_test_fail
|
|
cmp bs3d_death.frames, 12
|
|
jne bs_test_fail
|
|
cmp bs3d_selfFlash.frames, 8
|
|
jne bs_test_fail
|
|
mov bs3d_state, BS_READY
|
|
call TableBusy3D
|
|
test eax, eax
|
|
jnz bs_test_fail
|
|
mov pressedKeys3D[20h], 1
|
|
call HandleBuckshot3D
|
|
cmp bankroll, 9950
|
|
jne bs_test_fail
|
|
cmp bs3d_state, BS_LOAD
|
|
jne bs_test_fail
|
|
call TableBusy3D
|
|
cmp eax, 1
|
|
jne bs_test_fail
|
|
inc bsTestStage3D
|
|
call ResetBuckshotFixture3D
|
|
invoke BuckshotShoot3D, 1
|
|
cmp bs3d_hpDealer, 4
|
|
jne bs_test_fail
|
|
cmp bs3d_shellIndex, 0
|
|
jne bs_test_fail
|
|
mov deltaTime3D, 449
|
|
call HandleBuckshot3D
|
|
cmp bs3d_hpDealer, 4
|
|
jne bs_test_fail
|
|
mov deltaTime3D, 1
|
|
call HandleBuckshot3D
|
|
cmp bs3d_hpDealer, 3
|
|
jne bs_test_fail
|
|
cmp bs3d_shellIndex, 1
|
|
jne bs_test_fail
|
|
cmp bs3d_turn, 1
|
|
jne bs_test_fail
|
|
cmp bs3d_shooter, 0
|
|
jne bs_test_fail
|
|
call CommitBuckshotShot3D
|
|
cmp bs3d_hpDealer, 3
|
|
jne bs_test_fail
|
|
cmp bs3d_shellIndex, 1
|
|
jne bs_test_fail
|
|
inc bsTestStage3D
|
|
call ResetBuckshotFixture3D
|
|
mov bs3d_shells, 0
|
|
mov bs3d_shells[4], 1
|
|
invoke BuckshotShoot3D, 0
|
|
call CommitBuckshotShot3D
|
|
cmp bs3d_turn, 0
|
|
jne bs_test_fail
|
|
cmp bs3d_hpPlayer, 4
|
|
jne bs_test_fail
|
|
call FinishBuckshotAction3D
|
|
cmp bs3d_state, BS_PLAYER
|
|
jne bs_test_fail
|
|
inc bsTestStage3D
|
|
call ResetBuckshotFixture3D
|
|
mov bs3d_turn, 1
|
|
mov bs3d_state, BS_DEALER
|
|
mov bs3d_hpDealer, 1
|
|
mov bankroll, 9950
|
|
invoke BuckshotShoot3D, 1
|
|
call CommitBuckshotShot3D
|
|
cmp bs3d_afterAnim, BS_WIN
|
|
jne bs_test_fail
|
|
call FinishBuckshotAction3D
|
|
cmp bankroll, 10100
|
|
jne bs_test_fail
|
|
cmp bs3d_state, BS_DEATH
|
|
jne bs_test_fail
|
|
call FinishBuckshotAction3D
|
|
cmp bankroll, 10100
|
|
jne bs_test_fail
|
|
mov deltaTime3D, 1000
|
|
call HandleBuckshot3D
|
|
cmp bs3d_state, BS_RECOVERY
|
|
jne bs_test_fail
|
|
mov deltaTime3D, 3600
|
|
call HandleBuckshot3D
|
|
cmp bs3d_state, BS_WIN
|
|
jne bs_test_fail
|
|
cmp bs3d_hpDealer, 4
|
|
jne bs_test_fail
|
|
cmp bankroll, 10100
|
|
jne bs_test_fail
|
|
call TableBusy3D
|
|
test eax, eax
|
|
jnz bs_test_fail
|
|
inc bsTestStage3D
|
|
call ResetBuckshotFixture3D
|
|
mov bs3d_hpPlayer, 1
|
|
mov bankroll, 9950
|
|
invoke BuckshotShoot3D, 0
|
|
call CommitBuckshotShot3D
|
|
call FinishBuckshotAction3D
|
|
cmp bs3d_result, BS_LOSE
|
|
jne bs_test_fail
|
|
mov deltaTime3D, 1000
|
|
call HandleBuckshot3D
|
|
mov deltaTime3D, 3600
|
|
call HandleBuckshot3D
|
|
cmp bs3d_state, BS_LOSE
|
|
jne bs_test_fail
|
|
cmp bs3d_hpPlayer, 4
|
|
jne bs_test_fail
|
|
cmp bankroll, 9950
|
|
jne bs_test_fail
|
|
inc bsTestStage3D
|
|
call ResetBuckshotFixture3D
|
|
mov bs3d_items, 1
|
|
invoke UseBuckshotItem3D, 0
|
|
cmp eax, 1
|
|
jne bs_test_fail
|
|
call CommitBuckshotItem3D
|
|
cmp bs3d_known, 1
|
|
jne bs_test_fail
|
|
cmp bs3d_known[4], -1
|
|
jne bs_test_fail
|
|
cmp bs3d_items, 0
|
|
jne bs_test_fail
|
|
call RenderBuckshot3D
|
|
call FinishBuckshotAction3D
|
|
cmp bs3d_state, BS_ITEM
|
|
jne bs_test_fail
|
|
mov bs3d_state, BS_PLAYER
|
|
mov bs3d_items[4], 1
|
|
invoke UseBuckshotItem3D, 1
|
|
call CommitBuckshotItem3D
|
|
cmp bs3d_damage, 2
|
|
jne bs_test_fail
|
|
mov bs3d_state, BS_PLAYER
|
|
invoke BuckshotShoot3D, 1
|
|
call CommitBuckshotShot3D
|
|
cmp bs3d_hpDealer, 2
|
|
jne bs_test_fail
|
|
cmp bs3d_damage, 1
|
|
jne bs_test_fail
|
|
inc bsTestStage3D
|
|
call ResetBuckshotFixture3D
|
|
mov bs3d_items[8], 1
|
|
invoke UseBuckshotItem3D, 2
|
|
call CommitBuckshotItem3D
|
|
call CommitBuckshotItem3D
|
|
cmp bs3d_shellIndex, 1
|
|
jne bs_test_fail
|
|
cmp bs3d_liveCount, 0
|
|
jne bs_test_fail
|
|
cmp bs3d_blankCount, 1
|
|
jne bs_test_fail
|
|
inc bsTestStage3D
|
|
call ResetBuckshotFixture3D
|
|
mov bs3d_items[12], 1
|
|
invoke UseBuckshotItem3D, 3
|
|
call CommitBuckshotItem3D
|
|
cmp bs3d_skip[4], 1
|
|
jne bs_test_fail
|
|
mov bs3d_state, BS_PLAYER
|
|
invoke BuckshotShoot3D, 1
|
|
call CommitBuckshotShot3D
|
|
call FinishBuckshotAction3D
|
|
cmp bs3d_state, BS_PLAYER
|
|
jne bs_test_fail
|
|
cmp bs3d_skip[4], 0
|
|
jne bs_test_fail
|
|
inc bsTestStage3D
|
|
; Exercise each item through real input AND rendering, before/after its effect.
|
|
xor esi,esi
|
|
bs_test_item_render:
|
|
call ResetBuckshotFixture3D
|
|
mov bs3d_items[esi*4],1
|
|
lea ebx,[esi+33h]
|
|
mov pressedKeys3D[ebx],1
|
|
call HandleBuckshot3D
|
|
cmp bs3d_state,BS_ITEM
|
|
jne bs_test_fail
|
|
call RenderBuckshot3D
|
|
mov deltaTime3D,430
|
|
call HandleBuckshot3D
|
|
call RenderBuckshot3D
|
|
mov deltaTime3D,470
|
|
call HandleBuckshot3D
|
|
call RenderBuckshot3D
|
|
; An old inspection result must remain safe during every other item.
|
|
mov bs3d_state,BS_ITEM
|
|
mov bs3d_known,0
|
|
call RenderBuckshot3D
|
|
mov bs3d_known,1
|
|
call RenderBuckshot3D
|
|
inc esi
|
|
cmp esi,4
|
|
jb bs_test_item_render
|
|
inc bsTestStage3D
|
|
; Loading always contains live and blank rounds; poses never address an invalid frame.
|
|
mov esi, 100
|
|
bs_test_reload:
|
|
call BuckshotReload3D
|
|
cmp bs3d_liveCount, 0
|
|
je bs_test_fail
|
|
cmp bs3d_blankCount, 0
|
|
je bs_test_fail
|
|
mov eax, bs3d_liveCount
|
|
add eax, bs3d_blankCount
|
|
cmp eax, bs3d_shellCount
|
|
jne bs_test_fail
|
|
mov bs3d_timer, 0
|
|
bs_test_load_pose:
|
|
call ResolveBuckshotPose3D
|
|
cmp eax, 12
|
|
jae bs_test_fail
|
|
add bs3d_timer, 10
|
|
mov eax, bs3d_timer
|
|
cmp eax, bs3d_loadDuration
|
|
jb bs_test_load_pose
|
|
dec esi
|
|
jnz bs_test_reload
|
|
inc bsTestStage3D
|
|
; Run complete rounds through the actual input/state machine, including dealer items.
|
|
mov rounds, 250
|
|
bs_test_round:
|
|
call ResetBuckshotFixture3D
|
|
mov bs3d_state, BS_READY
|
|
mov pressedKeys3D[20h], 1
|
|
call HandleBuckshot3D
|
|
mov deltaTime3D, 100
|
|
mov ticks, 0
|
|
bs_test_tick:
|
|
cmp bs3d_state, BS_PLAYER
|
|
jne @F
|
|
mov pressedKeys3D[32h], 1
|
|
@@:
|
|
call HandleBuckshot3D
|
|
cmp bs3d_hpPlayer, 4
|
|
ja bs_test_fail
|
|
cmp bs3d_hpDealer, 4
|
|
ja bs_test_fail
|
|
mov eax, bs3d_liveCount
|
|
add eax, bs3d_blankCount
|
|
add eax, bs3d_shellIndex
|
|
cmp eax, bs3d_shellCount
|
|
jne bs_test_fail
|
|
cmp bs3d_state, BS_WIN
|
|
je bs_test_round_win
|
|
cmp bs3d_state, BS_LOSE
|
|
je bs_test_round_lose
|
|
inc ticks
|
|
cmp ticks, 1200
|
|
jae bs_test_fail
|
|
jmp bs_test_tick
|
|
bs_test_round_win:
|
|
mov expected, 10100
|
|
jmp bs_test_round_result
|
|
bs_test_round_lose:
|
|
mov expected, 9950
|
|
bs_test_round_result:
|
|
mov eax, expected
|
|
cmp bankroll, eax
|
|
jne bs_test_fail
|
|
call HandleBuckshot3D
|
|
mov eax, expected
|
|
cmp bankroll, eax
|
|
jne bs_test_fail
|
|
dec rounds
|
|
jnz bs_test_round
|
|
inc bsTestStage3D
|
|
; One framebuffer per key pose, without a Python reimplementation of rendering.
|
|
call ResetBuckshotFixture3D
|
|
mov bs3d_shellCount, 6
|
|
mov bs3d_liveCount, 3
|
|
mov bs3d_blankCount, 3
|
|
mov bs3d_loadDuration, 2900
|
|
mov bs3d_payout, 150
|
|
xor esi, esi
|
|
bs_test_snapshot:
|
|
imul edi, esi, 28
|
|
mov eax, bsTestCases3D[edi]
|
|
mov bs3d_state, eax
|
|
mov eax, bsTestCases3D[edi+4]
|
|
mov bs3d_timer, eax
|
|
mov eax, bsTestCases3D[edi+8]
|
|
mov bs3d_shooter, eax
|
|
mov bs3d_loadActor, eax
|
|
mov bs3d_turn, eax
|
|
mov eax, bsTestCases3D[edi+12]
|
|
mov bs3d_target, eax
|
|
mov bs3d_item, eax
|
|
mov eax, bsTestCases3D[edi+16]
|
|
mov bs3d_hpPlayer, eax
|
|
mov eax, bsTestCases3D[edi+20]
|
|
mov bs3d_hpDealer, eax
|
|
mov eax, bsTestCases3D[edi+24]
|
|
mov bs3d_victim, eax
|
|
mov bs3d_lastShot, 1
|
|
mov bs3d_message, OFFSET bs3d_textShot
|
|
mov bs3d_effectDone, 0
|
|
cmp bs3d_timer, 450
|
|
jb @F
|
|
mov bs3d_effectDone, 1
|
|
@@:
|
|
call RenderBuckshot3D
|
|
invoke WriteActionSnapshot3D, bsTestPaths3D[esi*4]
|
|
test eax, eax
|
|
jz bs_test_fail
|
|
inc esi
|
|
cmp esi, bsTestCaseCount3D
|
|
jb bs_test_snapshot
|
|
call FreeBuckshotAssets3D
|
|
cmp bs3d_room.pixels, 0
|
|
jne bs_test_fail
|
|
cmp bs3d_dealerActions.pixels, 0
|
|
jne bs_test_fail
|
|
mov eax, oldBank
|
|
mov bankroll, eax
|
|
mov eax, oldSeed
|
|
mov rngSeed3D, eax
|
|
mov eax, oldMode
|
|
mov engineMode, eax
|
|
mov eax, oldDelta
|
|
mov deltaTime3D, eax
|
|
call ClearKeys3D
|
|
xor eax, eax
|
|
ret
|
|
bs_test_fail:
|
|
mov eax, bsTestStage3D
|
|
ret
|
|
RunBuckshotTest3D ENDP
|
|
|
|
; Separate QA executable: real window/input, temporary bank, no profile writes.
|
|
RunBuckshotPreview3D PROC uses ebx esi edi
|
|
call InitPaths3D
|
|
call Create3DWindow
|
|
test eax, eax
|
|
jz bs_preview_exit
|
|
call InitBuckshot3D
|
|
mov engineMode, MODE_BUCKSHOT
|
|
mov bankroll, 10000
|
|
mov paused3D, 0
|
|
call RenderBuckshot3D
|
|
invoke ShowWindow, h3DWnd, SW_SHOW
|
|
invoke SetForegroundWindow, h3DWnd
|
|
invoke GetTickCount
|
|
mov previousTick3D, eax
|
|
bs_preview_loop:
|
|
invoke PeekMessageA, OFFSET msg3D, 0, 0, 0, PM_REMOVE
|
|
test eax, eax
|
|
jz bs_preview_tick
|
|
cmp msg3D.message, WM_QUIT
|
|
je bs_preview_exit
|
|
invoke TranslateMessage, OFFSET msg3D
|
|
invoke DispatchMessageA, OFFSET msg3D
|
|
jmp bs_preview_loop
|
|
bs_preview_tick:
|
|
invoke GetTickCount
|
|
mov ebx, eax
|
|
sub eax, previousTick3D
|
|
mov previousTick3D, ebx
|
|
cmp eax, 50
|
|
jbe @F
|
|
mov eax, 50
|
|
@@:
|
|
mov deltaTime3D, eax
|
|
invoke Pressed3D, 7Ah
|
|
test eax, eax
|
|
jz @F
|
|
call ToggleFullscreen3D
|
|
@@:
|
|
invoke Pressed3D, 1Bh
|
|
test eax, eax
|
|
jz @F
|
|
call TableBusy3D
|
|
test eax, eax
|
|
jz bs_preview_exit
|
|
xor paused3D, 1
|
|
@@:
|
|
cmp paused3D, 0
|
|
jne @F
|
|
call HandleBuckshot3D
|
|
@@:
|
|
call RenderBuckshot3D
|
|
cmp paused3D, 0
|
|
je @F
|
|
invoke DrawBuckshotPanel3D, 270, 220, 100, 32, 00111116h
|
|
invoke DrawBuckshotText3D, 296, 232, OFFSET bsPreviewPause3D, 00FFFFFFh
|
|
@@:
|
|
call Present3D
|
|
mov mouseClick3D, 0
|
|
lea edi, pressedKeys3D
|
|
xor eax, eax
|
|
mov ecx, 64
|
|
rep stosd
|
|
invoke Sleep, 16
|
|
jmp bs_preview_loop
|
|
bs_preview_exit:
|
|
call FreeBuckshotAssets3D
|
|
xor eax, eax
|
|
ret
|
|
RunBuckshotPreview3D ENDP
|