LoadNativeDiceArt3D PROC cmp diceArtReady3D,1 je dice_art_loaded invoke LoadAnimPack3D,OFFSET diceTableArt3D,OFFSET diceTablePath3D invoke LoadAnimPack3D,OFFSET diceHandsArt3D,OFFSET diceHandsPath3D invoke ValidateCityPack3D,OFFSET diceTableArt3D,640,480,1 invoke ValidateCityPack3D,OFFSET diceHandsArt3D,256,320,16 cmp diceTableArt3D.pixels,0 je dice_art_failed cmp diceHandsArt3D.pixels,0 je dice_art_failed mov diceArtReady3D,1 dice_art_loaded: mov eax,1 ret dice_art_failed: call FreeNativeDiceArt3D xor eax,eax ret LoadNativeDiceArt3D ENDP FreeNativeDiceArt3D PROC invoke FreeAnimPack3D,OFFSET diceTableArt3D invoke FreeAnimPack3D,OFFSET diceHandsArt3D mov diceArtReady3D,0 ret FreeNativeDiceArt3D ENDP DiceEscape3D PROC mov paused3D,0 cmp dice3d_state,1 jne dice_escape_now mov diceExitQueued3D,1 call ClearKeys3D ret dice_escape_now: mov diceExitQueued3D,0 cmp tournamentMode,1 jne @F call TowerExitToHall ret @@: mov engineMode,MODE_WALK call ClearKeys3D invoke PlayCasinoSound3D,0,0,0 ret DiceEscape3D ENDP HandleDiceMouse3D PROC cmp mouseClick3D,0 je dice_mouse_done mov mouseClick3D,0 cmp mouseY3D,3 jb dice_mouse_done cmp mouseY3D,17 jae dice_mouse_footer cmp mouseX3D,252 jb dice_mouse_done cmp mouseX3D,312 jae dice_mouse_done call DiceEscape3D ret dice_mouse_footer: cmp dice3d_state,1 je dice_mouse_done cmp mouseY3D,218 jb dice_mouse_stake cmp mouseY3D,236 jae dice_mouse_done cmp mouseX3D,198 jb dice_mouse_choice cmp mouseX3D,312 jae dice_mouse_done mov pressedKeys3D[20h],1 ret dice_mouse_choice: cmp dice3d_state,0 jne dice_mouse_done cmp mouseX3D,8 jb dice_mouse_done cmp mouseX3D,96 jae @F mov pressedKeys3D[31h],1 ret @@: cmp mouseX3D,100 jb dice_mouse_done cmp mouseX3D,188 jae dice_mouse_done mov pressedKeys3D[32h],1 ret dice_mouse_stake: cmp dice3d_state,0 jne dice_mouse_done cmp mouseY3D,199 jb dice_mouse_done cmp mouseY3D,215 jae dice_mouse_done cmp mouseX3D,118 jb dice_mouse_done cmp mouseX3D,134 jae @F mov pressedKeys3D[28h],1 ret @@: cmp mouseX3D,140 jb dice_mouse_done cmp mouseX3D,156 jae dice_mouse_done mov pressedKeys3D[26h],1 dice_mouse_done: ret HandleDiceMouse3D ENDP ; Original payment/parity rules remain a single command path for both inputs. HandleDiceInput PROC call HandleDiceMouse3D call HandleDiceRules3D cmp diceExitQueued3D,1 jne dice_input_done cmp dice3d_state,1 je dice_input_done call DiceEscape3D dice_input_done: ret HandleDiceInput ENDP DrawDiceHand3D PROC uses ebx esi local frame:DWORD,py:DWORD mov frame,0 mov py,90 cmp dice3d_state,0 je dice_hand_draw cmp dice3d_state,1 jne dice_hand_done mov eax,dice3d_timer cmp eax,240 jae dice_hand_release imul eax,4 xor edx,edx mov ecx,240 div ecx mov frame,eax jmp dice_hand_draw dice_hand_release: cmp eax,1000 jae dice_hand_lower sub eax,240 imul eax,12 xor edx,edx mov ecx,760 div ecx add eax,4 mov frame,eax jmp dice_hand_draw dice_hand_lower: cmp eax,1250 jae dice_hand_done sub eax,1000 imul eax,260 xor edx,edx mov ecx,250 div ecx add py,eax mov frame,15 dice_hand_draw: invoke DrawAnimSprite3D,OFFSET diceHandsArt3D,frame,320,py,256,320 dice_hand_done: ret DrawDiceHand3D ENDP RenderNativeDice3D PROC uses ebx esi edi local evenTint:DWORD,oddTint:DWORD cmp diceArtReady3D,1 jne dice_scene_fallback mov esi,diceTableArt3D.pixels lea edi,screenBuffer mov ecx,SCREEN_SIZE rep movsd jmp dice_scene_objects dice_scene_fallback: invoke DrawBox,0,0,320,240,000B342Bh invoke DrawString8x8,96,64,OFFSET coinMissingText3D,00E5D29Eh dice_scene_objects: ; Cloth shadows belong behind the foreground hand, never on its skin. mov diceShadowPass3D,1 call RenderDiceThrow3D mov diceShadowPass3D,0 call DrawDiceHand3D call RenderDiceThrow3D invoke DrawBox,0,0,320,20,0014191Dh invoke DrawString8x8,12,6,OFFSET textDiceTitle,00E5D29Eh invoke DrawBoxBorder,252,3,60,14,00252D2Ah,0086754Eh,1 invoke DrawString8x8,266,6,OFFSET coinExitText3D,00E5D29Eh invoke DrawBox,4,23,132,15,0014191Dh invoke DrawString8x8,8,27,OFFSET textBankPrompt,00E5D29Eh invoke FormatNumber,bankroll,OFFSET hudNumBuffer invoke DrawString8x8,56,27,OFFSET hudNumBuffer,00FFFFFFh invoke DrawBox,0,194,320,46,0014191Dh invoke DrawString8x8,8,201,OFFSET coinStakeText3D,00E5D29Eh invoke FormatNumber,dice3d_bet,OFFSET hudNumBuffer invoke DrawString8x8,72,201,OFFSET hudNumBuffer,00FFFFFFh invoke DrawBoxBorder,118,199,16,16,00252D2Ah,0086754Eh,1 invoke DrawString8x8,124,203,OFFSET coinMinusText3D,00E5D29Eh invoke DrawBoxBorder,140,199,16,16,00252D2Ah,0086754Eh,1 invoke DrawString8x8,146,203,OFFSET coinPlusText3D,00E5D29Eh mov evenTint,0086754Eh mov oddTint,0086754Eh cmp dice3d_choice,1 jne @F mov evenTint,00E5D29Eh jmp dice_scene_choices @@: mov oddTint,00E5D29Eh dice_scene_choices: invoke DrawBoxBorder,8,218,88,18,00252D2Ah,evenTint,1 invoke DrawString8x8,26,223,OFFSET textDiceEven,evenTint invoke DrawBoxBorder,100,218,88,18,00252D2Ah,oddTint,1 invoke DrawString8x8,112,223,OFFSET textDiceOdd,oddTint invoke DrawBoxBorder,198,218,114,18,00252D2Ah,0086754Eh,1 cmp dice3d_state,2 jne @F invoke DrawString8x8,224,223,OFFSET diceAgainText3D,00E5D29Eh jmp dice_scene_status @@: invoke DrawString8x8,226,223,OFFSET diceThrowText3D,00E5D29Eh dice_scene_status: cmp diceExitQueued3D,0 je @F invoke DrawString8x8,164,201,OFFSET coinLeavingText3D,00E5D29Eh @@: cmp dice3d_state,2 jne dice_scene_done invoke DrawBox,8,176,304,16,0014191Dh invoke DrawString8x8,12,180,OFFSET textDiceSumHdr,00E5D29Eh invoke FormatNumber,dice3d_val1,OFFSET hudNumBuffer invoke DrawString8x8,72,180,OFFSET hudNumBuffer,00FFFFFFh invoke DrawString8x8,86,180,OFFSET coinPlusText3D,00E5D29Eh invoke FormatNumber,dice3d_val2,OFFSET hudNumBuffer invoke DrawString8x8,98,180,OFFSET hudNumBuffer,00FFFFFFh invoke DrawString8x8,112,180,OFFSET textDiceEqual+1,00E5D29Eh invoke FormatNumber,dice3d_sum,OFFSET hudNumBuffer invoke DrawString8x8,126,180,OFFSET hudNumBuffer,00FFFFFFh cmp dice3d_win,0 je dice_scene_loss invoke DrawString8x8,158,180,OFFSET textDiceWin,0090D5ADh invoke FormatNumber,dice3d_win,OFFSET hudNumBuffer invoke DrawString8x8,248,180,OFFSET hudNumBuffer,0090D5ADh jmp dice_scene_done dice_scene_loss: invoke DrawString8x8,192,180,OFFSET textDiceLose,00FF6464h dice_scene_done: ret RenderNativeDice3D ENDP