KAZIK/src_graphics/card_table_input.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

342 lines
7.3 KiB
PHP

; Convert the displayed table buttons into the same edge-triggered commands as keys.
CardTableMouse3D PROC mode:DWORD
cmp mouseClick3D, 0
je table_mouse_done
mov mouseClick3D, 0
cmp mouseY3D, 3
jb table_mouse_done
cmp mouseY3D, 17
jae @F
cmp mouseX3D, 252
jb table_mouse_done
cmp mouseX3D, 312
jae table_mouse_done
call RequestCardExit3D
ret
@@:
mov edx, PK_PLAYER
mov eax, pkState3D
cmp mode, MODE_POKER
je @F
mov edx, CB_PLAYER
mov eax, cbState3D
@@:
cmp eax, edx
je table_mouse_play
test eax, eax
jz table_mouse_ready
cmp eax, 5 ; both table result states
jne table_mouse_done
table_mouse_ready:
cmp mouseY3D, 222
jb table_mouse_amount
cmp mouseY3D, 238
jae table_mouse_done
cmp mouseX3D, 125
jb table_mouse_done
cmp mouseX3D, 195
jae table_mouse_done
mov pressedKeys3D[20h], 1
ret
table_mouse_play:
cmp mouseY3D, 222
jb table_mouse_amount
cmp mouseY3D, 238
jae table_mouse_done
mov eax, mouseX3D
cmp eax, 8
jb table_mouse_done
cmp eax, 78
jb table_mouse_first
cmp eax, 86
jb table_mouse_done
cmp eax, 156
jb table_mouse_second
cmp eax, 164
jb table_mouse_done
cmp eax, 234
jb table_mouse_third
cmp mode, MODE_POKER
jne table_mouse_done
cmp eax, 242
jb table_mouse_done
cmp eax, 312
jae table_mouse_done
mov ecx, 41h
jmp table_mouse_key
table_mouse_third:
mov ecx, 46h
cmp mode, MODE_POKER
je table_mouse_key
mov ecx, 44h
jmp table_mouse_key
table_mouse_first:
mov ecx, 43h
cmp mode, MODE_POKER
je table_mouse_key
mov ecx, 48h
jmp table_mouse_key
table_mouse_second:
mov ecx, 52h
cmp mode, MODE_POKER
je table_mouse_key
mov ecx, 53h
jmp table_mouse_key
table_mouse_amount:
cmp mouseY3D, 199
jb table_mouse_done
cmp mouseY3D, 215
jae table_mouse_done
cmp mouseX3D, 11
jb table_mouse_done
mov ecx, 28h
cmp mouseX3D, 29
jb table_mouse_key
cmp mouseX3D, 35
jb table_mouse_done
cmp mouseX3D, 53
jae table_mouse_done
mov ecx, 26h
table_mouse_key:
mov pressedKeys3D[ecx], 1
table_mouse_done:
ret
CardTableMouse3D ENDP
; Leaving an unfinished hand is a fold/loss, never a refund or a second payout.
LeaveCardTable3D PROC
call TableBusy3D
test eax, eax
jz card_leave_hall
cmp engineMode, MODE_POKER
jne @F
invoke PokerFold3D, 0
jmp card_leave_hall
@@:
cmp engineMode, MODE_BLACKJACK
jne @F
invoke NativeBJSettle3D, 1
jmp card_leave_hall
@@:
cmp engineMode, MODE_DURAK
jne card_leave_hall
invoke NativeDurakSettle3D, 1
card_leave_hall:
mov cardExitActive3D, 0
mov paused3D, 0
mov engineMode, MODE_WALK
call ClearKeys3D
invoke PlayCasinoSound3D, 0, 0, 0
ret
LeaveCardTable3D ENDP
RequestCardExit3D PROC
mov paused3D, 0
call TableBusy3D
test eax, eax
jz card_request_leave
mov cardExitActive3D, 1
mov cardExitChoice3D, 0
call ClearKeys3D
ret
card_request_leave:
call LeaveCardTable3D
ret
RequestCardExit3D ENDP
; Called by the engine's Escape dispatch, before the generic pause branch.
CardTableEscape3D PROC
cmp engineMode, MODE_POKER
je card_escape_handle
cmp engineMode, MODE_BLACKJACK
je card_escape_handle
cmp engineMode, MODE_DURAK
jne card_escape_other
card_escape_handle:
cmp cardExitActive3D, 0
jne card_escape_cancel
call RequestCardExit3D
mov eax, 1
ret
card_escape_cancel:
mov cardExitActive3D, 0
mov paused3D, 0
call ClearKeys3D
mov eax, 1
ret
card_escape_other:
xor eax, eax
ret
CardTableEscape3D ENDP
HandleCardExit3D PROC
cmp cardExitActive3D, 0
je card_exit_inactive
invoke Pressed3D, 1Bh
test eax, eax
jnz card_exit_cancel
invoke Pressed3D, 4Eh
test eax, eax
jnz card_exit_cancel
invoke Pressed3D, 59h
test eax, eax
jnz card_exit_confirm
invoke Pressed3D, 25h
test eax, eax
jz @F
mov cardExitChoice3D, 0
@@:
invoke Pressed3D, 27h
test eax, eax
jz @F
mov cardExitChoice3D, 1
@@:
invoke Pressed3D, 9
test eax, eax
jz @F
xor cardExitChoice3D, 1
@@:
invoke Pressed3D, 0Dh
test eax, eax
jnz card_exit_selected
invoke Pressed3D, 20h
test eax, eax
jnz card_exit_selected
cmp mouseClick3D, 0
je card_exit_handled
mov mouseClick3D, 0
cmp mouseY3D, 150
jb card_exit_handled
cmp mouseY3D, 174
jae card_exit_handled
cmp mouseX3D, 32
jb card_exit_handled
cmp mouseX3D, 156
jb card_exit_cancel
cmp mouseX3D, 164
jb card_exit_handled
cmp mouseX3D, 288
jae card_exit_handled
jmp card_exit_confirm
card_exit_selected:
cmp cardExitChoice3D, 0
je card_exit_cancel
card_exit_confirm:
call LeaveCardTable3D
jmp card_exit_handled
card_exit_cancel:
mov cardExitActive3D, 0
call ClearKeys3D
card_exit_handled:
mov eax, 1
ret
card_exit_inactive:
xor eax, eax
ret
HandleCardExit3D ENDP
TableBusy3D PROC
mov eax, engineMode
cmp eax, MODE_BAR
jne @F
cmp barPhase3D, 0
jne table_is_busy
jmp table_not_busy
@@:
cmp eax, MODE_STAIRS
je table_is_busy
cmp eax, MODE_POOL
jne @F
cmp poolState3D, POOL_STRIKE
je table_is_busy
cmp poolState3D, POOL_MOVING
je table_is_busy
jmp table_not_busy
@@:
cmp eax, MODE_POKER
je table_busy_poker
cmp eax, MODE_BUCKSHOT
je table_busy_buckshot
cmp eax, MODE_BLACKJACK
je table_busy_blackjack
cmp eax, MODE_DURAK
je table_busy_durak
cmp eax, MODE_RUSSIAN
je table_busy_russian
cmp eax, MODE_SLOTS
je table_busy_slots
cmp eax, MODE_ROULETTE
je table_busy_wheel
cmp eax, MODE_COIN
je table_busy_coin
cmp eax, MODE_DICE
je table_busy_dice
cmp eax, MODE_SKULLS
je table_busy_skulls
cmp eax, MODE_SKILL
jne table_not_busy
cmp skill3d_state, 1
je table_is_busy
jmp table_not_busy
table_busy_buckshot:
cmp bs3d_state, BS_READY
je table_not_busy
cmp bs3d_state, BS_ERROR
je table_not_busy
cmp bs3d_state, BS_WIN
je table_not_busy
cmp bs3d_state, BS_LOSE
je table_not_busy
jmp table_is_busy
table_busy_poker:
cmp pkState3D, PK_IDLE
je table_not_busy
cmp pkState3D, PK_RESULT
jne table_is_busy
jmp table_not_busy
table_busy_blackjack:
cmp cbState3D, CB_IDLE
je table_not_busy
cmp cbState3D, CB_RESULT
jne table_is_busy
jmp table_not_busy
table_busy_durak:
cmp dkState3D, DK_IDLE
je table_not_busy
cmp dkState3D, DK_RESULT
jne table_is_busy
jmp table_not_busy
table_busy_russian:
cmp rr3d_state, RR_READY
je table_not_busy
cmp rr3d_state, RR_WIN
jne table_is_busy
jmp table_not_busy
table_busy_slots:
cmp slotSpinState, 1
je table_is_busy
jmp table_not_busy
table_busy_wheel:
cmp roulState, 1
je table_is_busy
jmp table_not_busy
table_busy_coin:
cmp coin3d_state, 1
je table_is_busy
jmp table_not_busy
table_busy_dice:
cmp dice3d_state, 1
je table_is_busy
jmp table_not_busy
table_busy_skulls:
cmp skulls3d_state, 1
je table_is_busy
cmp skulls3d_state, 2
jne table_not_busy
table_is_busy:
mov eax, 1
ret
table_not_busy:
xor eax, eax
ret
TableBusy3D ENDP