KAZIK/tools/tests/fortune_dialog_test.inc
Artvasil09 ce06659ab2 feat: implement offline neural fortune teller and native tarot divination
- Offline neural worker based on llama.cpp (fortune-engine.exe) with local Qwen3-4B model support

- Native assembly Tarot 3-card spread divination and teacher grade divination mode

- Text input dialog in MODE_FORTUNE communicating over anonymous pipes

- Clean process lifecycle management, WM_CHAR dispatch and fallback handling

- Test suites and packaging tools for offline release
2026-10-21 13:53:06 +03:00

112 lines
3.1 KiB
PHP

.data
fortuneLiveQuestion db 209,242,238,232,242,32,235,232,32,237,224,247,224,242,252,32,243,247,232,242,252,241,255,32,240,232,241,238,226,224,237,232,254,63,0
fortuneLiveShot db "build\hall-expansion\fortune-dialog-answer.bmp",0
fortuneLiveBank dd 0
.code
FortuneDialogNativeTests PROC uses esi edi
mov expansionStage,80
mov hallLevel3D,3
mov engineMode,MODE_WALK
mov worldMap3D,OFFSET fortuneRoomMap3D
mov floorTexture3D,134
mov playerX,FP_1*155/10
mov playerY,11*FP_1
mov playerAngle,256
call UpdateInteriorEye3D
call ExpansionFrame
mov eax,bankroll
mov fortuneLiveBank,eax
call BeginFortuneDialog3D
cmp engineMode,MODE_FORTUNE
jne fortune_live_fail
cmp fortuneWorkerState3D,1
jne fortune_live_fail
mov esi,250
fortune_live_full_input:
invoke WindowEvents3D,0,102h,'a',0
dec esi
jnz fortune_live_full_input
cmp fortuneQuestionLength3D,240
jne fortune_live_fail
cmp fortuneQuestion3D[240],0
jne fortune_live_fail
invoke WindowEvents3D,0,102h,8,0
cmp fortuneQuestionLength3D,239
jne fortune_live_fail
mov fortuneQuestionLength3D,0
mov fortuneQuestion3D,0
mov esi,OFFSET fortuneLiveQuestion
fortune_live_type:
movzx eax,BYTE PTR [esi]
test eax,eax
jz fortune_live_ready
invoke WindowEvents3D,0,102h,eax,0
inc esi
jmp fortune_live_type
fortune_live_ready:
mov edi,9000
fortune_live_wait_ready:
call PollFortuneWorker3D
cmp fortuneWorkerState3D,2
je fortune_live_submit
cmp fortuneWorkerState3D,4
je fortune_live_fail
invoke Sleep,20
dec edi
jnz fortune_live_wait_ready
jmp fortune_live_fail
fortune_live_submit:
mov expansionStage,81
call SubmitFortuneQuestion3D
cmp fortuneWorkerState3D,3
jne fortune_live_fail
mov esi,fortuneQuestionLength3D
invoke WindowEvents3D,0,102h,'X',0
cmp fortuneQuestionLength3D,esi
jne fortune_live_fail
call SubmitFortuneQuestion3D
mov edi,9000
fortune_live_wait_answer:
call PollFortuneWorker3D
cmp fortuneWorkerState3D,2
je fortune_live_answer
cmp fortuneWorkerState3D,4
je fortune_live_fail
invoke Sleep,20
dec edi
jnz fortune_live_wait_answer
jmp fortune_live_fail
fortune_live_answer:
cmp fortuneAnswer3D,0
je fortune_live_fail
cmp fortuneQuestionLength3D,0
jne fortune_live_fail
call RenderFortuneDialog3D
invoke ExpansionSnapshot,OFFSET fortuneLiveShot
mov mouseClick3D,1
mov mouseX3D,260
mov mouseY3D,226
call HandleFortuneDialog3D
cmp engineMode,MODE_WALK
jne fortune_live_fail
cmp fortuneProcess3D,0
jne fortune_live_fail
cmp fortuneRead3D,0
jne fortune_live_fail
cmp fortuneWrite3D,0
jne fortune_live_fail
mov eax,bankroll
cmp eax,fortuneLiveBank
jne fortune_live_fail
cmp playerX,FP_1*155/10
jne fortune_live_fail
cmp playerY,11*FP_1
jne fortune_live_fail
cmp playerAngle,256
jne fortune_live_fail
ret
fortune_live_fail:
call StopFortuneWorker3D
invoke ExitProcess,expansionStage
ret
FortuneDialogNativeTests ENDP