KAZIK/docs/native-actions.md
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

85 lines
4 KiB
Markdown

# Native Game Actions
The existing casino hall and mini-game screens are preserved. Gameplay and
animation run in MASM32 in the same 2.5D window, without Python at runtime.
## Dice
Choose even/odd with 1/2, adjust the stake with W/S or Up/Down, and throw with
Space. Two projected cubes rotate, fly, bounce and settle over 1600 ms.
The result is chosen once before the animation; rendering cannot reroll it.
Opposite faces add to seven. Space returns from the result to the next bet.
## Russian Roulette
The existing revolver table now starts the native scene instead of the old
console game. Select 1-3 cartridges with 1/2/3, adjust the stake with W/S or
Up/Down, then Space. Loading takes 1800 ms and the table spin 1400 ms.
Space on the player turn raises the revolver. Empty chambers alternate turns
without randomizing the cylinder again. A dealer hit pays back twice the stake.
A player hit transitions through interference, darkness, an eight-frame G-man
scene and interference over the casino hall, then returns to walking.
Escape pauses a paid roulette round; another Escape resumes it. Escape from
the ready/result screen returns to the hall. Other paid games retain their
existing Escape behavior. F11 remains the existing fullscreen toggle.
Optional voice-over: `assets/audio/gman-wakeup.wav`. The G-man scene currently
lasts 4200 ms; adjust `rr3d_durations` to fit a longer recording when adding it.
Generated sprite sheets and prompts are in `assets/sprites/roulette/`.
The runtime atlas is `assets/animations/roulette/roulette-scenes.bin`.
## Audio Repairs
Assignments from the old console source were checked against
`backups/poker_before_doom_engine_20260923_040745.asm`. Older graphical backups
already contained wrong assignments, so they were not blindly restored.
| Event | Recording |
| --- | --- |
| Card dealing | `playing_cards_deck_flick_through_001_20485.wav` |
| Casino roulette wheel | `roulette-wheel-throw-2.wav` |
| Revolver loading/spin | `toy-gun-revolver-close-chamber-spin_f1ruc5nd.wav` |
| Revolver empty chamber | `revolverdryfirec.wav` |
| Revolver shot | `b05e1ac8be34248.wav` |
| Slot spin | `hKhoJArfEGAxxMewx0UQiddakTdBjFc.wav` |
| Cups moving | `moving-stone.wav` |
| Coin throw | Original coin-throw recording |
| Slot jackpot / zero payout | Original jackpot recording |
| Bank goal reached | `victory-tf2.wav` |
| Empty bank | Original bankruptcy recording |
| UI, dice, ordinary results, skill checks | Short original PCM effects in `assets/audio/generated/` |
Native audio assignments and playback are separated into `audio_data.inc` and
`audio_code.inc`. UI ticks yield to ongoing actions. WAV playback uses explicit
filename/asynchronous/no-default flags, following the
[WinMM documentation](https://learn.microsoft.com/en-us/previous-versions/dd743680(v=vs.85)).
Legacy games initialize their original MCI aliases on entry and close them on
exit. Original audio files were not modified. Existing console-game procedures,
the hall renderer, movement, textures and saves were not replaced.
## Build And Verify
`powershell -File tools/tests/build_graphics.ps1` builds `build/graphics/poker.exe`.
When the MASM32 import libraries lack newer console APIs, the build uses the
installed Windows SDK import libraries first.
`powershell -File tools/tests/test_casino_actions.ps1` compiles and runs the actual
MASM handlers/renderer without creating a window or saving a profile. It checks
audio routing, dice settlement, 2000 roulette rounds, payouts, cylinder
conservation and automatic return. Native frame-buffer snapshots are saved in
`build/actions/`.
`python tools/tests/check_audio_bindings.py` verifies all paths and opens the
WAV recordings through Windows MCI without playing them.
Offline regeneration only:
```
python tools/generators/pack_roulette_scenes.py
python tools/generators/generate_game_sfx.py
```
Manual fullscreen/input playtesting still needs a visible desktop. During this
change the game created one responsive graphical window, but Computer Use
capture timed out; fullscreen and live controls were not visually verified.