.data bpTestDirection db "build\hall-expansion\bowling-play-direction.bmp",0 bpTestDirectionLeft db "build\hall-expansion\bowling-play-direction-left.bmp",0 bpTestPower db "build\hall-expansion\bowling-play-power.bmp",0 bpTestPowerLow db "build\hall-expansion\bowling-play-power-low.bmp",0 bpTestOpponent db "build\hall-expansion\bowling-play-opponent.bmp",0 bpTestRoll db "build\hall-expansion\bowling-play-roll.bmp",0 bpTestScores db "build\hall-expansion\bowling-play-scores.bmp",0 .code BowlingPlayNativeTests PROC uses ebx esi edi local bank:DWORD,savedRng:DWORD,savedHits:DWORD,remainingSteps:DWORD mov expansionStage,150 mov eax,bankroll mov bank,eax call InitBowling3D mov hallLevel3D,HALL_BOWLING mov engineMode,MODE_WALK mov playerX,5*FP_1 mov playerY,25*FP_1 mov playerAngle,384 invoke BeginBowlingPlay3D,0 test eax,eax jnz bp_test_fail invoke BeginBowlingPlay3D,1 cmp eax,1 jne bp_test_fail cmp engineMode,MODE_BOWLING jne bp_test_fail cmp bwBusy3D[4],2 jne bp_test_fail cmp bpState3D,BP_SELECT_BALL jne bp_test_fail mov deltaTime3D,0 mov pressedKeys3D[20h],1 call HandleBowlingPlay3D cmp bpState3D,BP_DIRECTION jne bp_test_fail mov expansionStage,151 mov deltaTime3D,0 mov bpClock3D,0 mov mouseX3D,160 mov mouseY3D,120 mov viewWidth3D,640 mov viewHeight3D,480 mov viewLeft3D,0 mov viewTop3D,0 invoke WindowEvents3D,0,201h,1,00F00140h call HandleBowlingPlay3D cmp bpState3D,BP_POWER jne bp_test_fail invoke WindowEvents3D,0,100h,20h,40000000h call HandleBowlingPlay3D cmp bpState3D,BP_POWER jne bp_test_fail cmp bpLockedAim3D,0 jne bp_test_fail call HandleBowlingPlay3D cmp bpState3D,BP_POWER jne bp_test_fail mov bpClock3D,560 invoke WindowEvents3D,0,100h,20h,0 call HandleBowlingPlay3D cmp bpState3D,BP_RELEASE jne bp_test_fail cmp bpLockedPower3D,70 jne bp_test_fail mov eax,bwRng3D mov savedRng,eax mov deltaTime3D,16 mov remainingSteps,1100 bp_test_roll: call HandleBowlingPlay3D cmp bpState3D,BP_SETTLE je bp_test_roll_done dec remainingSteps jnz bp_test_roll jmp bp_test_fail bp_test_roll_done: mov eax,bwRng3D cmp eax,savedRng jne bp_test_fail cmp bpLast3D,1 jb bp_test_fail cmp bpLast3D,10 ja bp_test_fail mov eax,bpHitMask3D mov savedHits,eax ; The complete fixed-step shot is identical at 16 and 32-ms frame deltas. call ResetBowlingPlay3D mov bpLockedAim3D,0 mov bpLockedPower3D,70 call BowlingPlayLaunch3D mov deltaTime3D,32 mov remainingSteps,600 bp_test_rate32: call HandleBowlingPlay3D cmp bpState3D,BP_SETTLE je bp_test_rate32_done dec remainingSteps jnz bp_test_rate32 jmp bp_test_fail bp_test_rate32_done: mov eax,bpHitMask3D cmp eax,savedHits jne bp_test_fail mov expansionStage,152 call ResetBowlingPlay3D mov bpLockedAim3D,0 mov bpLockedPower3D,70 call BowlingPlayLaunch3D mov esi,600 bp_test_repeat: call BowlingPlayStep3D dec esi jnz bp_test_repeat mov eax,bpHitMask3D cmp eax,savedHits jne bp_test_fail call ResetBowlingPlay3D mov bpLockedAim3D,2*FP_1 mov bpLockedPower3D,70 call BowlingPlayLaunch3D mov esi,600 bp_test_gutter: call BowlingPlayStep3D dec esi jnz bp_test_gutter cmp bpGutter3D,1 jne bp_test_fail cmp bpHitMask3D,0 jne bp_test_fail ; A removed pin can never be credited again. call ResetBowlingPlay3D mov bwRack3D[4],0 mov bpLockedAim3D,0 mov bpLockedPower3D,70 call BowlingPlayLaunch3D mov esi,600 bp_test_empty_rack: call BowlingPlayStep3D dec esi jnz bp_test_empty_rack cmp bpHitMask3D,0 jne bp_test_fail mov expansionStage,153 call ResetBowlingPlay3D mov bpHitMask3D,1 call BowlingPlayFinishRoll3D call BowlingPlayNext3D cmp bwRack3D[4],1022 jne bp_test_fail cmp bwTurn3D[4],0 jne bp_test_fail mov bpHitMask3D,1022 call BowlingPlayFinishRoll3D call BowlingPlayNext3D cmp bwRack3D[4],1023 jne bp_test_fail cmp bwTurn3D[4],1 jne bp_test_fail cmp bpState3D,BP_BOT jne bp_test_fail cmp bpLastKind3D,2 jne bp_test_fail mov deltaTime3D,250 mov esi,5 bp_test_bot: call HandleBowlingPlay3D dec esi jnz bp_test_bot cmp bpState3D,BP_RELEASE jne bp_test_fail mov expansionStage,154 call ResetBowlingPlay3D mov bpHitMask3D,1023 call BowlingPlayFinishRoll3D invoke BowlingFrameTotal3D,2,0 cmp eax,-1 jne bp_test_fail call BowlingPlayNext3D mov esi,23 bp_test_perfect: mov bpHitMask3D,1023 call BowlingPlayFinishRoll3D call BowlingPlayNext3D dec esi jnz bp_test_perfect cmp bpState3D,BP_FINISHED jne bp_test_fail cmp bwScores3D[8],300 jne bp_test_fail cmp bwScores3D[12],300 jne bp_test_fail invoke BowlingFrameTotal3D,2,9 cmp eax,300 jne bp_test_fail mov expansionStage,155 call ResetBowlingPlay3D mov deltaTime3D,0 mov bpClock3D,150 call HandleBowlingPlay3D call RenderBowlingPlay3D invoke ExpansionSnapshot,OFFSET bpTestDirection mov bpClock3D,1550 call HandleBowlingPlay3D call RenderBowlingPlay3D invoke ExpansionSnapshot,OFFSET bpTestDirectionLeft mov bpState3D,BP_POWER mov bpClock3D,560 call HandleBowlingPlay3D call RenderBowlingPlay3D invoke ExpansionSnapshot,OFFSET bpTestPower mov bpClock3D,200 call HandleBowlingPlay3D call RenderBowlingPlay3D invoke ExpansionSnapshot,OFFSET bpTestPowerLow mov bpScoreOpen3D,1 call RenderBowlingPlay3D invoke ExpansionSnapshot,OFFSET bpTestScores mov bpScoreOpen3D,0 mov bpLockedAim3D,0 mov bpLockedPower3D,70 call BowlingPlayLaunch3D mov bpState3D,BP_ROLL mov esi,160 bp_test_flight: call BowlingPlayStep3D dec esi jnz bp_test_flight mov bpTime3D,2560 call RenderBowlingPlay3D invoke ExpansionSnapshot,OFFSET bpTestRoll mov eax,bpBallY3D mov savedHits,eax mov pressedKeys3D[9],1 mov deltaTime3D,16 call HandleBowlingPlay3D call HandleBowlingPlay3D mov eax,bpBallY3D cmp eax,savedHits jne bp_test_fail mov pressedKeys3D[9],1 call HandleBowlingPlay3D mov eax,bpBallY3D cmp eax,savedHits je bp_test_fail mov bwTurn3D[4],1 mov bpState3D,BP_RELEASE mov bpTime3D,1700 call RenderBowlingPlay3D invoke ExpansionSnapshot,OFFSET bpTestOpponent mov expansionStage,156 call LeaveBowlingPlay3D cmp engineMode,MODE_WALK jne bp_test_fail cmp bwBusy3D[4],0 jne bp_test_fail cmp bpActive3D,0 jne bp_test_fail cmp playerX,5*FP_1 jne bp_test_fail cmp playerY,25*FP_1 jne bp_test_fail cmp playerAngle,384 jne bp_test_fail mov eax,bankroll cmp eax,bank jne bp_test_fail call BowlingFeelNativeTests call BowlingReturnNativeTests call BowlingWeightNativeTests ret bp_test_fail: invoke ExitProcess,expansionStage ret BowlingPlayNativeTests ENDP include tools/tests/bowling_feel_test.inc include tools/tests/bowling_return_test.inc include tools/tests/bowling_weight_test.inc