.data scratchPortraitCapture3D db "build\actions\scratch-kind-4-covered.bmp",0 scratchPortraitFull3D db "build\actions\scratch-kind-4-full.bmp",0 scratchPortraitResult3D db "build\actions\scratch-kind-4-result.bmp",0 scratchCatalogCapture3D db "build\actions\scratch-catalog.bmp",0 scratchNetCapture3D db "build\actions\scratch-net-0.bmp",0 .code RunScratchPortraitTest3D PROC uses ebx esi edi local kind:DWORD,round:DWORD,total:DWORD,allPrizes:DWORD,expected:DWORD,savedRng:DWORD mov kind,4 portrait_test_kind: mov round,0 portrait_test_round: mov scrState3D,0 mov eax,kind mov scrType3D,eax mov eax,round xor edx,edx mov ecx,3 div ecx mov scrPriceIndex3D,edx mov eax,round add eax,7919 mov rngSeed3D,eax mov bankroll,100000 call BuyScratch3D cmp scrState3D,1 jne portrait_test_fail mov total,0 mov allPrizes,0 xor esi,esi portrait_test_unique: mov eax,scrGrid3D[esi*4] dec eax cmp eax,60 jae portrait_test_fail xor edi,edi portrait_test_previous: cmp edi,esi jae portrait_test_unique_next mov eax,scrGrid3D[esi*4] cmp eax,scrGrid3D[edi*4] je portrait_test_fail inc edi jmp portrait_test_previous portrait_test_unique_next: inc esi cmp esi,scrPortraitWins3D jb portrait_test_unique portrait_test_award: mov eax,scrGrid3D[esi*4] cmp eax,61 je portrait_test_double cmp eax,62 je portrait_test_special dec eax cmp eax,60 jae portrait_test_fail xor edi,edi portrait_test_match: mov eax,scrGrid3D[esi*4] cmp eax,scrGrid3D[edi*4] je portrait_test_normal inc edi cmp edi,scrPortraitWins3D jb portrait_test_match jmp portrait_test_award_next portrait_test_double: imul eax,scrCellPrizes3D[esi*4],2 jmp portrait_test_add portrait_test_special: cmp kind,4 jne portrait_test_all imul eax,scrCellPrizes3D[esi*4],10 jmp portrait_test_add portrait_test_all: mov allPrizes,1 jmp portrait_test_award_next portrait_test_normal: mov eax,scrCellPrizes3D[esi*4] portrait_test_add: add total,eax portrait_test_award_next: inc esi cmp esi,scrCellCount3D jb portrait_test_award cmp allPrizes,0 je portrait_test_total mov total,0 mov esi,scrPortraitWins3D portrait_test_sum_all: mov eax,scrCellPrizes3D[esi*4] add total,eax inc esi cmp esi,scrCellCount3D jb portrait_test_sum_all portrait_test_total: mov eax,total cmp scrGross3D,eax jne portrait_test_fail add eax,bankroll mov expected,eax mov eax,rngSeed3D mov savedRng,eax call SettleScratchOnQuit3D call SettleScratchOnQuit3D mov eax,expected cmp bankroll,eax jne portrait_test_fail mov eax,savedRng cmp rngSeed3D,eax jne portrait_test_fail inc round cmp round,500 jb portrait_test_round ; Stable visual fixture, independent of the generated outcome. mov scrState3D,0 mov scrPriceIndex3D,0 mov bankroll,10000 call BuyScratch3D mov scrDealMs3D,0 xor esi,esi portrait_test_fixture: lea eax,[esi+1] mov scrGrid3D[esi*4],eax mov scrCellPrizes3D[esi*4],50 inc esi cmp esi,scrCellCount3D jb portrait_test_fixture mov esi,scrPortraitWins3D mov eax,scrGrid3D mov scrGrid3D[esi*4],eax mov scrCellPrizes3D[esi*4],250 call ScratchPortraitPayout3D cmp eax,250 jne portrait_test_fail mov scrGross3D,eax mov eax,kind add eax,'0' mov scratchPortraitCapture3D[27],al mov scratchPortraitFull3D[27],al mov scratchPortraitResult3D[27],al mov scrZoom3D,0 call RenderScratch3D invoke WriteActionSnapshot3D,OFFSET scratchPortraitFull3D mov scrZoom3D,1 call RenderScratch3D invoke WriteActionSnapshot3D,OFFSET scratchPortraitCapture3D ; The sea ticket is uncovered at the smaller full-ticket scale, too. cmp kind,6 jne @F mov scrZoom3D,0 @@: call ScratchTestUncover3D mov eax,scrCellCount3D cmp scrOpened3D,eax jne portrait_test_fail cmp scrState3D,2 jne portrait_test_fail cmp bankroll,10200 jne portrait_test_fail mov scrZoom3D,1 call RenderScratch3D invoke WriteActionSnapshot3D,OFFSET scratchPortraitResult3D call ScratchToggleZoom3D ; The state and all source-space masks survive view changes. mov eax,scrCellCount3D cmp scrOpened3D,eax jne portrait_test_fail cmp scrState3D,2 jne portrait_test_fail ; Bonus fixtures: x2, neon x10 and all-prizes (without double payment). xor esi,esi portrait_test_bonus_grid: lea eax,[esi+1] mov scrGrid3D[esi*4],eax mov scrCellPrizes3D[esi*4],50 inc esi cmp esi,scrCellCount3D jb portrait_test_bonus_grid mov esi,scrPortraitWins3D mov scrGrid3D[esi*4],61 call ScratchPortraitPayout3D cmp eax,100 jne portrait_test_fail mov scrGrid3D[esi*4],62 call ScratchPortraitPayout3D mov ecx,500 cmp kind,4 je @F mov ecx,scrCellCount3D sub ecx,scrPortraitWins3D imul ecx,50 @@: cmp eax,ecx jne portrait_test_fail inc kind cmp kind,7 jb portrait_test_kind mov eax,1 ret portrait_test_fail: mov eax,146 ret RunScratchPortraitTest3D ENDP RunScratchCatalogTest3D PROC uses ebx esi edi local catalogRng:DWORD mov viewWidth3D,640 mov viewHeight3D,480 mov viewLeft3D,0 mov viewTop3D,0 mov scrState3D,0 mov scrType3D,0 call ScratchConfigure3D ; Moving after a fast click cannot redirect the pending button action. invoke ScratchMouseEvent3D,0,201h,1,003C01F4h invoke ScratchMouseEvent3D,0,200h,0,00C80014h invoke ScratchMouseEvent3D,0,202h,0,00C80014h call HandleScratch3D cmp scrCatalog3D,1 jne catalog_test_fail call RenderScratch3D invoke WriteActionSnapshot3D,OFFSET scratchCatalogCapture3D mov scrClick3D,1 mov scrClickX3D,220 mov scrClickY3D,358 call HandleScratch3D cmp scrType3D,6 jne catalog_test_fail cmp scrCatalog3D,0 jne catalog_test_fail mov scrClick3D,1 mov scrClickX3D,160 mov scrClickY3D,450 call HandleScratch3D cmp scrPriceIndex3D,1 jne catalog_test_fail cmp scrType3D,6 jne catalog_test_fail mov scrPriceIndex3D,0 mov bankroll,10000 call BuyScratch3D mov eax,rngSeed3D mov catalogRng,eax mov scrCatalog3D,1 mov scrClick3D,1 mov scrClickX3D,220 mov scrClickY3D,120 call HandleScratch3D cmp scrType3D,6 jne catalog_test_fail cmp scrCatalogLocked3D,1 jne catalog_test_fail cmp bankroll,9950 jne catalog_test_fail mov eax,catalogRng cmp rngSeed3D,eax jne catalog_test_fail call LeaveScratch3D cmp scrCatalog3D,0 jne catalog_test_fail cmp engineMode,MODE_SCRATCH jne catalog_test_fail call LeaveScratch3D cmp engineMode,MODE_WALK jne catalog_test_fail call SettleScratchOnQuit3D call BeginScratch3D mov scrType3D,0 mov scrState3D,2 mov scrStake3D,50 mov scrPriceIndex3D,1 mov scrPrizeSymbol3D,-1 xor esi,esi catalog_test_net: mov eax,esi imul eax,50 mov scrGross3D,eax mov eax,esi add eax,'0' mov scratchNetCapture3D[26],al call RenderScratch3D invoke WriteActionSnapshot3D,OFFSET scratchNetCapture3D inc esi cmp esi,3 jb catalog_test_net mov eax,1 ret catalog_test_fail: mov eax,147 ret RunScratchCatalogTest3D ENDP