KAZIK/tools/tests/scratch_native_probe.asm
Игорь Федосеев ca62db53e9 feat: implement native billiards, scratch tickets, first-person dice, and city wake scene
- Billiards: add native Russian Pyramid & American Eight-Ball pool with physics prediction, controls, and regression tests
- Scratch Tickets: add dedicated counter, mat presentation, elliptical coin scraping, 4 ticket types, and payout effects
- First-Person Dice: add native dice scene, hand anchor frames, throwing animation, and table perspective
- City Wake & Weather: add arrival cutscene, alley geometry, weather/rain effects, and lighter/rocker animation
- World Dressing: add hall paintings, furniture packs, hall lighting, and scene regression tests
- Build & Tooling: update build.bat for modern MSVC toolchain, update launcher hash, and refresh shipping binaries
2026-10-16 12:37:40 +03:00

219 lines
6.1 KiB
NASM

; Native render-only probe. Links the action-tested game object, not a renderer
; reimplementation. It never loads or writes the player's profile.
.386
.model flat
option casemap:none
ExitProcess PROTO STDCALL :DWORD
wsprintfA PROTO C :DWORD,:DWORD,:VARARG
InitPaths3D PROTO STDCALL
BeginScratch3D PROTO STDCALL
BuyScratch3D PROTO STDCALL
HandleScratch3D PROTO STDCALL
RenderScratch3D PROTO STDCALL
LoadAnimPack3D PROTO STDCALL :DWORD,:DWORD
FreeAnimPack3D PROTO STDCALL :DWORD
WriteActionSnapshot3D PROTO STDCALL :DWORD
LoadTextures3D PROTO STDCALL
LoadArrivalAssets3D PROTO STDCALL
InitializeCasinoSprites3D PROTO STDCALL
InitHall3D PROTO STDCALL
LoadHallAssets3D PROTO STDCALL
UpdateCamera3D PROTO STDCALL
RenderCeilingAndFloor PROTO STDCALL
RenderWalls PROTO STDCALL
PrepareCityDepth3D PROTO STDCALL
RenderSprites PROTO STDCALL
RenderHall3D PROTO STDCALL
CheckHallInteractions3D PROTO STDCALL
TriggerHallInteraction3D PROTO STDCALL
LeaveScratch3D PROTO STDCALL
ScratchCanWalk3D PROTO STDCALL :DWORD,:DWORD
ScratchSelectType3D PROTO STDCALL :DWORD
ScratchToggleZoom3D PROTO STDCALL
SettleScratchOnQuit3D PROTO STDCALL
EXTERN bankroll:DWORD,rngSeed3D:DWORD,engineMode:DWORD
EXTERN scrState3D:DWORD,scrPriceIndex3D:DWORD,scrHeld3D:DWORD
EXTERN scrPointerValid3D:DWORD,scrPointerX3D:DWORD,scrPointerY3D:DWORD
EXTERN animationClock3D:DWORD,deltaTime3D:DWORD
EXTERN scrTableArt3D:DWORD
EXTERN playerX:DWORD,playerY:DWORD,playerAngle:DWORD
EXTERN interactTargetId:DWORD
EXTERN scrType3D:DWORD,scrZoom3D:DWORD,scrCounts3D:DWORD,scrCatalog3D:DWORD
EXTERN scrDealMs3D:DWORD
.data
scratchProbeCounter db "build\actions\scratch-counter.bmp",0
scratchProbePointer db "build\actions\scratch-pointer.bmp",0
scratchProbeFormat db "build\actions\scratch-stroke-%02u.bmp",0
scratchProbePath db 128 dup(0)
scratchProbeTable db "assets\animations\scratch\table-v1.bin",0
scratchPortraitProbeFormat db "build\actions\scratch-portrait-%u-%02u.bmp",0
scratchPortraitProbeKind dd 4
scratchPortraitProbeCount dd 0
.code
ScratchPortraitProbe PROC
scratch_portrait_probe_kind:
call SettleScratchOnQuit3D
mov scrState3D,0
invoke ScratchSelectType3D,scratchPortraitProbeKind
mov bankroll,10000
call BuyScratch3D
mov scrDealMs3D,0
mov scrPointerValid3D,1
xor esi,esi
scratch_portrait_probe_frame:
mov eax,esi
xor edx,edx
mov ecx,13
div ecx
imul eax,12
add eax,188
mov scrPointerY3D,eax
test esi,1
jz @F
; Slightly offset successive strokes, not a pasted reveal animation.
inc scrPointerY3D
@@:
imul edx,20
add edx,220
mov scrPointerX3D,edx
mov scrHeld3D,1
imul eax,esi,33
mov animationClock3D,eax
call HandleScratch3D
call RenderScratch3D
invoke wsprintfA,OFFSET scratchProbePath,OFFSET scratchPortraitProbeFormat,scratchPortraitProbeKind,esi
invoke WriteActionSnapshot3D,OFFSET scratchProbePath
cmp eax,1
jne scratch_portrait_probe_fail
inc esi
cmp esi,26
jb scratch_portrait_probe_frame
xor esi,esi
xor ebx,ebx
scratch_portrait_probe_sum:
add ebx,scrCounts3D[esi*4]
inc esi
cmp esi,24
jb scratch_portrait_probe_sum
test ebx,ebx
jz scratch_portrait_probe_fail
mov scratchPortraitProbeCount,ebx
call ScratchToggleZoom3D
call RenderScratch3D
call ScratchToggleZoom3D
xor esi,esi
xor ebx,ebx
scratch_portrait_probe_compare:
add ebx,scrCounts3D[esi*4]
inc esi
cmp esi,24
jb scratch_portrait_probe_compare
cmp ebx,scratchPortraitProbeCount
jne scratch_portrait_probe_fail
inc scratchPortraitProbeKind
cmp scratchPortraitProbeKind,7
jb scratch_portrait_probe_kind
call SettleScratchOnQuit3D
mov scrState3D,0
mov scrCatalog3D,0
mov bankroll,9950
mov eax,1
ret
scratch_portrait_probe_fail:
xor eax,eax
ret
ScratchPortraitProbe ENDP
PUBLIC _ScratchProbeStart
_ScratchProbeStart:
call InitPaths3D
mov bankroll,10000
mov rngSeed3D,47
mov scrState3D,0
mov scrPriceIndex3D,0
call BeginScratch3D
invoke FreeAnimPack3D,OFFSET scrTableArt3D
invoke LoadAnimPack3D,OFFSET scrTableArt3D,OFFSET scratchProbeTable
call BuyScratch3D
mov scrDealMs3D,0
mov scrHeld3D,1
mov scrPointerValid3D,1
mov deltaTime3D,33
xor esi,esi
scratch_probe_frame:
mov eax,esi
xor edx,edx
mov ecx,12
div ecx
mov ebx,eax
imul eax,15
add eax,183
mov scrPointerY3D,eax
imul edx,28
test ebx,1
jz @F
mov eax,308
sub eax,edx
mov edx,eax
@@:
add edx,164
mov scrPointerX3D,edx
imul eax,esi,33
mov animationClock3D,eax
call HandleScratch3D
call RenderScratch3D
invoke wsprintfA,OFFSET scratchProbePath,OFFSET scratchProbeFormat,esi
invoke WriteActionSnapshot3D,OFFSET scratchProbePath
cmp eax,1
jne scratch_probe_fail
inc esi
cmp esi,36
jb scratch_probe_frame
invoke WriteActionSnapshot3D,OFFSET scratchProbePointer
call ScratchPortraitProbe
cmp eax,1
jne scratch_probe_fail
call LoadTextures3D
call LoadArrivalAssets3D
call InitializeCasinoSprites3D
call InitHall3D
call LoadHallAssets3D
mov engineMode,0
mov playerX,29*65536
mov playerY,5*65536+32768
mov playerAngle,128
call UpdateCamera3D
call RenderCeilingAndFloor
call RenderWalls
call PrepareCityDepth3D
call RenderSprites
call RenderHall3D
invoke WriteActionSnapshot3D,OFFSET scratchProbeCounter
cmp eax,1
jne scratch_probe_fail
invoke ScratchCanWalk3D,29*65536,7*65536+32768
test eax,eax
jnz scratch_probe_fail
invoke ScratchCanWalk3D,20*65536,27*65536
cmp eax,1
jne scratch_probe_fail
mov playerY,6*65536
call UpdateCamera3D
mov interactTargetId,0
call CheckHallInteractions3D
cmp interactTargetId,25
jne scratch_probe_fail
call TriggerHallInteraction3D
cmp eax,1
jne scratch_probe_fail
cmp engineMode,22
jne scratch_probe_fail
call LeaveScratch3D
cmp engineMode,0
jne scratch_probe_fail
cmp bankroll,9950
jne scratch_probe_fail
invoke ExitProcess,0
scratch_probe_fail:
invoke ExitProcess,145
end _ScratchProbeStart