diff --git a/build/graphics/poker.exe b/build/graphics/poker.exe index f8df6dc..1c3578f 100644 Binary files a/build/graphics/poker.exe and b/build/graphics/poker.exe differ diff --git a/casino3d.inc b/casino3d.inc index 5c4ee4d..584d4e6 100644 --- a/casino3d.inc +++ b/casino3d.inc @@ -347,6 +347,9 @@ skulls3d_win dd 0 skulls3d_swapPair0 dd 0 skulls3d_swapPair1 dd 1 skulls3d_swapPair2 dd 2 +skulls3d_cup0 dd 0 +skulls3d_cup1 dd 1 +skulls3d_cup2 dd 2 textSkullsTitle db "* * * Í À Ï ¨ Ð Ñ Ò Ê È * * *",0 textSkullsPhase0 db "ÄÅËÀÉ ÑÒÀÂÊÓ È ÆÌÈ [ÏÐÎÁÅË]",0 @@ -3763,9 +3766,12 @@ InitSkullsGame PROC mov skulls3d_state, 0 mov skulls3d_timer, 0 mov skulls3d_win, 0 + mov skulls3d_choice, 1 + mov skulls3d_cup0, 0 + mov skulls3d_cup1, 1 + mov skulls3d_cup2, 2 invoke RandomRange3D, 3 mov skulls3d_ballPos, eax - mov skulls3d_choice, 1 ret InitSkullsGame ENDP @@ -3774,7 +3780,7 @@ FinalizeSkullsGuess PROC uses ebx cmp eax, skulls3d_ballPos jne skulls_guess_wrong - ; Won! 3x payout + ; Correct! 3x payout mov eax, skulls3d_bet imul eax, 3 add bankroll, eax @@ -3854,33 +3860,46 @@ skulls_start_game: mov eax, bankroll mov skulls3d_bet, eax test eax, eax - jz skulls_done + jz skulls_input_done @@: mov eax, skulls3d_bet sub bankroll, eax invoke RandomRange3D, 3 mov skulls3d_ballPos, eax + mov skulls3d_cup0, 0 + mov skulls3d_cup1, 1 + mov skulls3d_cup2, 2 + + ; Pre-generate 3 dynamic swap pairs + invoke RandomRange3D, 3 + mov skulls3d_swapPair0, eax + invoke RandomRange3D, 3 + mov skulls3d_swapPair1, eax + invoke RandomRange3D, 3 + mov skulls3d_swapPair2, eax + mov skulls3d_state, 1 - mov skulls3d_timer, 45 - invoke PlaySoundA, OFFSET soundShuffle, 0, 1 + mov skulls3d_timer, 0 + invoke PlaySoundA, OFFSET soundClick, 0, 1 ret skulls_handle_show: - dec skulls3d_timer - cmp skulls3d_timer, 0 - jg skulls_done + inc skulls3d_timer + cmp skulls3d_timer, 45 + jl skulls_input_done + ; Transition to Phase 2: Active Shuffle Animation mov skulls3d_state, 2 - mov skulls3d_timer, 60 + mov skulls3d_timer, 0 invoke PlaySoundA, OFFSET soundShuffle, 0, 1 ret skulls_handle_shuffle: - dec skulls3d_timer - cmp skulls3d_timer, 0 - jg skulls_done - invoke RandomRange3D, 3 - mov skulls3d_ballPos, eax + inc skulls3d_timer + cmp skulls3d_timer, 60 + jl skulls_input_done + ; Transition to Phase 3: Pick cup mov skulls3d_state, 3 + mov skulls3d_timer, 0 ret skulls_handle_pick: @@ -3913,15 +3932,18 @@ skulls_pick_3: skulls_handle_reveal: invoke Pressed3D, 20h test eax, eax - jz skulls_done + jz skulls_input_done mov skulls3d_state, 0 invoke PlaySoundA, OFFSET soundClick, 0, 1 -skulls_done: +skulls_input_done: ret HandleSkullsInput ENDP RenderSkullsGame PROC uses ebx esi edi local kx:DWORD + local passTick:DWORD, curPair:DWORD, swapSlotA:DWORD, swapSlotB:DWORD + local xA:DWORD, xB:DWORD, curXA:DWORD, curXB:DWORD, curYA:DWORD, curYB:DWORD + local distX:DWORD, dxVal:DWORD, archY:DWORD ; Mahogany & Gothic Purple table invoke DrawBox, 0, 0, 320, 240, 00140906h @@ -3929,7 +3951,7 @@ RenderSkullsGame PROC uses ebx esi edi ; Header invoke DrawBoxBorder, 20, 12, 280, 26, 001A0812h, 00FFD700h, 2 - invoke DrawString8x8, 40, 21, OFFSET textSkullsTitle, 00FFFF00h + invoke DrawString8x8, 44, 21, OFFSET textSkullsTitle, 00FFFF00h ; Status invoke DrawBoxBorder, 20, 44, 110, 18, 001A0812h, 00452033h, 1 @@ -3942,99 +3964,301 @@ RenderSkullsGame PROC uses ebx esi edi invoke FormatNumber, skulls3d_bet, OFFSET hudNumBuffer invoke DrawString8x8, 254, 49, OFFSET hudNumBuffer, 00FFD700h - ; Subtitle phase prompts + ; Phase Prompts cmp skulls3d_state, 0 jne @F invoke DrawString8x8, 56, 62, OFFSET textSkullsPhase0, 00FFD700h - jmp skulls_render_cups + jmp skulls_draw_idle_cups @@: cmp skulls3d_state, 1 jne @F invoke DrawString8x8, 56, 62, OFFSET textSkullsPhase1, 00FFFF00h - jmp skulls_render_cups + jmp skulls_draw_phase1_cups @@: cmp skulls3d_state, 2 jne @F - invoke DrawString8x8, 56, 62, OFFSET textSkullsPhase2, 00FFFF00h - jmp skulls_render_cups + invoke DrawString8x8, 44, 62, OFFSET textSkullsPhase2, 00FFFF00h + jmp skulls_draw_animated_cups @@: cmp skulls3d_state, 3 jne @F - invoke DrawString8x8, 40, 62, OFFSET textSkullsPhase3, 00FFFF00h - jmp skulls_render_cups + invoke DrawString8x8, 28, 62, OFFSET textSkullsPhase3, 00FFFF00h + jmp skulls_draw_idle_cups @@: - ; Reveal outcome + ; Phase 4: Reveal outcome mov eax, skulls3d_win test eax, eax - jz skulls_show_loss_text + jz skulls_reveal_loss_text invoke DrawString8x8, 40, 62, OFFSET textSkullsWin, 003CFF3Ch invoke FormatNumber, skulls3d_win, OFFSET hudNumBuffer invoke DrawString8x8, 136, 62, OFFSET hudNumBuffer, 003CFF3Ch invoke DrawString8x8, 168, 62, OFFSET textSkullsWinMult, 003CFF3Ch - jmp skulls_render_cups + jmp skulls_draw_reveal_cups -skulls_show_loss_text: +skulls_reveal_loss_text: invoke DrawString8x8, 40, 62, OFFSET textSkullsLose, 00FF6464h + jmp skulls_draw_reveal_cups -skulls_render_cups: - ; Draw Cup 1 (X=36, Y=114) +skulls_draw_idle_cups: + ; Draw resting cups at static slots: Slot 0 (X=36), Slot 1 (X=136), Slot 2 (X=236) + invoke DrawGothicCup, 36, 114, skulls3d_cup0, 0, 0 + invoke DrawGothicCup, 136, 114, skulls3d_cup1, 0, 0 + invoke DrawGothicCup, 236, 114, skulls3d_cup2, 0, 0 + jmp skulls_render_controls + +skulls_draw_phase1_cups: + ; Draw with golden ball showing under starting cup mov ebx, 0 mov edx, 0 - cmp skulls3d_state, 1 - jne @F cmp skulls3d_ballPos, 0 jne @F mov ebx, 1 mov edx, 1 @@: - cmp skulls3d_state, 4 + invoke DrawGothicCup, 36, 114, skulls3d_cup0, ebx, edx + + mov ebx, 0 + mov edx, 0 + cmp skulls3d_ballPos, 1 jne @F + mov ebx, 1 + mov edx, 1 +@@: + invoke DrawGothicCup, 136, 114, skulls3d_cup1, ebx, edx + + mov ebx, 0 + mov edx, 0 + cmp skulls3d_ballPos, 2 + jne @F + mov ebx, 1 + mov edx, 1 +@@: + invoke DrawGothicCup, 236, 114, skulls3d_cup2, ebx, edx + jmp skulls_render_controls + +skulls_draw_animated_cups: + ; 60 frames = 3 passes of 20 frames + mov eax, skulls3d_timer + cmp eax, 20 + jbe pass_0 + cmp eax, 40 + jbe pass_1 + sub eax, 41 + mov passTick, eax + mov eax, skulls3d_swapPair2 + mov curPair, eax + jmp setup_pass + +pass_0: + dec eax + mov passTick, eax + mov eax, skulls3d_swapPair0 + mov curPair, eax + jmp setup_pass + +pass_1: + sub eax, 21 + mov passTick, eax + mov eax, skulls3d_swapPair1 + mov curPair, eax + +setup_pass: + ; curPair determines swap pair: + ; 0: swap slot 0 (X=36) and slot 1 (X=136) + ; 1: swap slot 1 (X=136) and slot 2 (X=236) + ; 2: swap slot 0 (X=36) and slot 2 (X=236) + cmp curPair, 1 + je pair_1 + cmp curPair, 2 + je pair_2 + mov swapSlotA, 0 + mov swapSlotB, 1 + mov xA, 36 + mov xB, 136 + jmp calc_coords +pair_1: + mov swapSlotA, 1 + mov swapSlotB, 2 + mov xA, 136 + mov xB, 236 + jmp calc_coords +pair_2: + mov swapSlotA, 0 + mov swapSlotB, 2 + mov xA, 36 + mov xB, 236 + +calc_coords: + ; distX = xB - xA + mov eax, xB + sub eax, xA + mov distX, eax + + ; dxVal = (distX * passTick) / 20 + mov eax, distX + imul eax, passTick + xor edx, edx + mov ecx, 20 + div ecx + mov dxVal, eax + + ; curXA = xA + dxVal + mov eax, xA + add eax, dxVal + mov curXA, eax + + ; curXB = xB - dxVal + mov eax, xB + sub eax, dxVal + mov curXB, eax + + ; archY = (passTick * (20 - passTick)) / 10 + mov eax, passTick + mov ecx, 20 + sub ecx, eax + imul eax, ecx + xor edx, edx + mov ecx, 10 + div ecx + mov archY, eax + + ; Cup A hops UP: 114 - archY + mov eax, 114 + sub eax, archY + mov curYA, eax + + ; Cup B hops DOWN: 114 + archY + mov eax, 114 + add eax, archY + mov curYB, eax + + ; Check if pass ended (frame 19): swap ball position and cups + cmp passTick, 19 + jne draw_active_shuffle + + ; Swap ball position if involved + mov eax, skulls3d_ballPos + cmp eax, swapSlotA + jne check_ball_b + mov edx, swapSlotB + mov skulls3d_ballPos, edx + jmp swap_slot_identities +check_ball_b: + cmp eax, swapSlotB + jne swap_slot_identities + mov edx, swapSlotA + mov skulls3d_ballPos, edx + +swap_slot_identities: + cmp curPair, 1 + je swap_ids_1_2 + cmp curPair, 2 + je swap_ids_0_2 + ; swap 0 and 1 + mov eax, skulls3d_cup0 + xchg eax, skulls3d_cup1 + mov skulls3d_cup0, eax + jmp swap_sound_tick +swap_ids_1_2: + mov eax, skulls3d_cup1 + xchg eax, skulls3d_cup2 + mov skulls3d_cup1, eax + jmp swap_sound_tick +swap_ids_0_2: + mov eax, skulls3d_cup0 + xchg eax, skulls3d_cup2 + mov skulls3d_cup0, eax + +swap_sound_tick: + invoke PlaySoundA, OFFSET soundShuffle, 0, 1 + +draw_active_shuffle: + ; Draw stationary cup + cmp curPair, 1 + je draw_stat_cup0 + cmp curPair, 2 + je draw_stat_cup1 + ; Stationary cup is slot 2 (X=236) + invoke DrawGothicCup, 236, 114, skulls3d_cup2, 0, 0 + jmp draw_moving_cups +draw_stat_cup0: + ; Stationary cup is slot 0 (X=36) + invoke DrawGothicCup, 36, 114, skulls3d_cup0, 0, 0 + jmp draw_moving_cups +draw_stat_cup1: + ; Stationary cup is slot 1 (X=136) + invoke DrawGothicCup, 136, 114, skulls3d_cup1, 0, 0 + +draw_moving_cups: + ; Moving Cup A and Moving Cup B + cmp curPair, 1 + je ids_pair_1 + cmp curPair, 2 + je ids_pair_2 + mov eax, skulls3d_cup0 + mov ebx, skulls3d_cup1 + jmp draw_the_pair +ids_pair_1: + mov eax, skulls3d_cup1 + mov ebx, skulls3d_cup2 + jmp draw_the_pair +ids_pair_2: + mov eax, skulls3d_cup0 + mov ebx, skulls3d_cup2 + +draw_the_pair: + push ebx + invoke DrawGothicCup, curXA, curYA, eax, 0, 0 + pop ebx + invoke DrawGothicCup, curXB, curYB, ebx, 0, 0 + jmp skulls_render_controls + +skulls_draw_reveal_cups: + ; Reveal Phase: lift chosen cup and lift actual ball cup if different + ; Slot 0 + mov ebx, 0 + mov edx, 0 cmp skulls3d_choice, 0 - sete bl + je slot0_is_lifted + cmp skulls3d_ballPos, 0 + jne @F +slot0_is_lifted: + mov ebx, 1 cmp skulls3d_ballPos, 0 sete dl @@: - invoke DrawGothicCup, 36, 114, 0, ebx, edx + invoke DrawGothicCup, 36, 114, skulls3d_cup0, ebx, edx - ; Draw Cup 2 (X=136, Y=114) + ; Slot 1 mov ebx, 0 mov edx, 0 - cmp skulls3d_state, 1 - jne @F - cmp skulls3d_ballPos, 1 - jne @F - mov ebx, 1 - mov edx, 1 -@@: - cmp skulls3d_state, 4 - jne @F cmp skulls3d_choice, 1 - sete bl + je slot1_is_lifted + cmp skulls3d_ballPos, 1 + jne @F +slot1_is_lifted: + mov ebx, 1 cmp skulls3d_ballPos, 1 sete dl @@: - invoke DrawGothicCup, 136, 114, 1, ebx, edx + invoke DrawGothicCup, 136, 114, skulls3d_cup1, ebx, edx - ; Draw Cup 3 (X=236, Y=114) + ; Slot 2 mov ebx, 0 mov edx, 0 - cmp skulls3d_state, 1 - jne @F + cmp skulls3d_choice, 2 + je slot2_is_lifted cmp skulls3d_ballPos, 2 jne @F +slot2_is_lifted: mov ebx, 1 - mov edx, 1 -@@: - cmp skulls3d_state, 4 - jne @F - cmp skulls3d_choice, 2 - sete bl cmp skulls3d_ballPos, 2 sete dl @@: - invoke DrawGothicCup, 236, 114, 2, ebx, edx + invoke DrawGothicCup, 236, 114, skulls3d_cup2, ebx, edx - ; Cup selection indicators +skulls_render_controls: + ; Cup selection slot labels [1], [2], [3] invoke DrawString8x8, 54, 168, OFFSET textSkullsKey1, 00D0D8E0h invoke DrawString8x8, 150, 168, OFFSET textSkullsKey2, 00D0D8E0h invoke DrawString8x8, 250, 168, OFFSET textSkullsKey3, 00D0D8E0h @@ -4042,33 +4266,57 @@ skulls_render_cups: ; Keycaps mov kx, 16 xor eax, eax + cmp skulls3d_state, 3 + je key1_active cmp skulls3d_choice, 0 sete al + jmp draw_key1 +key1_active: + mov eax, 1 +draw_key1: invoke DrawKeycap3D, kx, 192, OFFSET textSkullsKey1, eax add kx, eax xor eax, eax + cmp skulls3d_state, 3 + je key2_active cmp skulls3d_choice, 1 sete al + jmp draw_key2 +key2_active: + mov eax, 1 +draw_key2: invoke DrawKeycap3D, kx, 192, OFFSET textSkullsKey2, eax add kx, eax xor eax, eax + cmp skulls3d_state, 3 + je key3_active cmp skulls3d_choice, 2 sete al + jmp draw_key3 +key3_active: + mov eax, 1 +draw_key3: invoke DrawKeycap3D, kx, 192, OFFSET textSkullsKey3, eax add kx, eax - invoke DrawKeycap3D, kx, 192, OFFSET textSkullsKeySpace, 1 + xor eax, eax + cmp skulls3d_state, 0 + je start_active + cmp skulls3d_state, 4 + je start_active + jmp draw_start_key +start_active: + mov eax, 1 +draw_start_key: + invoke DrawKeycap3D, kx, 192, OFFSET textSkullsKeySpace, eax add kx, eax invoke DrawKeycap3D, kx, 192, OFFSET textKeyEsc, 0 ret RenderSkullsGame ENDP -; ============================================================================== -; IN-ENGINE 2.5D MINI-GAME: SKILL CHECK (DEAD BY DAYLIGHT SURVIVOR CHECK) -; ============================================================================== InitSkillGame PROC mov skill3d_state, 0 mov skill3d_timer, 0 diff --git a/poker.exe b/poker.exe index f8df6dc..1c3578f 100644 Binary files a/poker.exe and b/poker.exe differ diff --git a/tools/generators/generate_rich_minigames.py b/tools/generators/generate_rich_minigames.py index 89a8b0a..a6380e6 100644 --- a/tools/generators/generate_rich_minigames.py +++ b/tools/generators/generate_rich_minigames.py @@ -1260,9 +1260,12 @@ InitSkullsGame PROC mov skulls3d_state, 0 mov skulls3d_timer, 0 mov skulls3d_win, 0 + mov skulls3d_choice, 1 + mov skulls3d_cup0, 0 + mov skulls3d_cup1, 1 + mov skulls3d_cup2, 2 invoke RandomRange3D, 3 mov skulls3d_ballPos, eax - mov skulls3d_choice, 1 ret InitSkullsGame ENDP @@ -1271,7 +1274,7 @@ FinalizeSkullsGuess PROC uses ebx cmp eax, skulls3d_ballPos jne skulls_guess_wrong - ; Won! 3x payout + ; Correct! 3x payout mov eax, skulls3d_bet imul eax, 3 add bankroll, eax @@ -1351,33 +1354,46 @@ skulls_start_game: mov eax, bankroll mov skulls3d_bet, eax test eax, eax - jz skulls_done + jz skulls_input_done @@: mov eax, skulls3d_bet sub bankroll, eax invoke RandomRange3D, 3 mov skulls3d_ballPos, eax + mov skulls3d_cup0, 0 + mov skulls3d_cup1, 1 + mov skulls3d_cup2, 2 + + ; Pre-generate 3 dynamic swap pairs + invoke RandomRange3D, 3 + mov skulls3d_swapPair0, eax + invoke RandomRange3D, 3 + mov skulls3d_swapPair1, eax + invoke RandomRange3D, 3 + mov skulls3d_swapPair2, eax + mov skulls3d_state, 1 - mov skulls3d_timer, 45 - invoke PlaySoundA, OFFSET soundShuffle, 0, 1 + mov skulls3d_timer, 0 + invoke PlaySoundA, OFFSET soundClick, 0, 1 ret skulls_handle_show: - dec skulls3d_timer - cmp skulls3d_timer, 0 - jg skulls_done + inc skulls3d_timer + cmp skulls3d_timer, 45 + jl skulls_input_done + ; Transition to Phase 2: Active Shuffle Animation mov skulls3d_state, 2 - mov skulls3d_timer, 60 + mov skulls3d_timer, 0 invoke PlaySoundA, OFFSET soundShuffle, 0, 1 ret skulls_handle_shuffle: - dec skulls3d_timer - cmp skulls3d_timer, 0 - jg skulls_done - invoke RandomRange3D, 3 - mov skulls3d_ballPos, eax + inc skulls3d_timer + cmp skulls3d_timer, 60 + jl skulls_input_done + ; Transition to Phase 3: Pick cup mov skulls3d_state, 3 + mov skulls3d_timer, 0 ret skulls_handle_pick: @@ -1410,15 +1426,18 @@ skulls_pick_3: skulls_handle_reveal: invoke Pressed3D, 20h test eax, eax - jz skulls_done + jz skulls_input_done mov skulls3d_state, 0 invoke PlaySoundA, OFFSET soundClick, 0, 1 -skulls_done: +skulls_input_done: ret HandleSkullsInput ENDP RenderSkullsGame PROC uses ebx esi edi local kx:DWORD + local passTick:DWORD, curPair:DWORD, swapSlotA:DWORD, swapSlotB:DWORD + local xA:DWORD, xB:DWORD, curXA:DWORD, curXB:DWORD, curYA:DWORD, curYB:DWORD + local distX:DWORD, dxVal:DWORD, archY:DWORD ; Mahogany & Gothic Purple table invoke DrawBox, 0, 0, 320, 240, 00140906h @@ -1426,7 +1445,7 @@ RenderSkullsGame PROC uses ebx esi edi ; Header invoke DrawBoxBorder, 20, 12, 280, 26, 001A0812h, 00FFD700h, 2 - invoke DrawString8x8, 40, 21, OFFSET textSkullsTitle, 00FFFF00h + invoke DrawString8x8, 44, 21, OFFSET textSkullsTitle, 00FFFF00h ; Status invoke DrawBoxBorder, 20, 44, 110, 18, 001A0812h, 00452033h, 1 @@ -1439,99 +1458,301 @@ RenderSkullsGame PROC uses ebx esi edi invoke FormatNumber, skulls3d_bet, OFFSET hudNumBuffer invoke DrawString8x8, 254, 49, OFFSET hudNumBuffer, 00FFD700h - ; Subtitle phase prompts + ; Phase Prompts cmp skulls3d_state, 0 jne @F invoke DrawString8x8, 56, 62, OFFSET textSkullsPhase0, 00FFD700h - jmp skulls_render_cups + jmp skulls_draw_idle_cups @@: cmp skulls3d_state, 1 jne @F invoke DrawString8x8, 56, 62, OFFSET textSkullsPhase1, 00FFFF00h - jmp skulls_render_cups + jmp skulls_draw_phase1_cups @@: cmp skulls3d_state, 2 jne @F - invoke DrawString8x8, 56, 62, OFFSET textSkullsPhase2, 00FFFF00h - jmp skulls_render_cups + invoke DrawString8x8, 44, 62, OFFSET textSkullsPhase2, 00FFFF00h + jmp skulls_draw_animated_cups @@: cmp skulls3d_state, 3 jne @F - invoke DrawString8x8, 40, 62, OFFSET textSkullsPhase3, 00FFFF00h - jmp skulls_render_cups + invoke DrawString8x8, 28, 62, OFFSET textSkullsPhase3, 00FFFF00h + jmp skulls_draw_idle_cups @@: - ; Reveal outcome + ; Phase 4: Reveal outcome mov eax, skulls3d_win test eax, eax - jz skulls_show_loss_text + jz skulls_reveal_loss_text invoke DrawString8x8, 40, 62, OFFSET textSkullsWin, 003CFF3Ch invoke FormatNumber, skulls3d_win, OFFSET hudNumBuffer invoke DrawString8x8, 136, 62, OFFSET hudNumBuffer, 003CFF3Ch invoke DrawString8x8, 168, 62, OFFSET textSkullsWinMult, 003CFF3Ch - jmp skulls_render_cups + jmp skulls_draw_reveal_cups -skulls_show_loss_text: +skulls_reveal_loss_text: invoke DrawString8x8, 40, 62, OFFSET textSkullsLose, 00FF6464h + jmp skulls_draw_reveal_cups -skulls_render_cups: - ; Draw Cup 1 (X=36, Y=114) +skulls_draw_idle_cups: + ; Draw resting cups at static slots: Slot 0 (X=36), Slot 1 (X=136), Slot 2 (X=236) + invoke DrawGothicCup, 36, 114, skulls3d_cup0, 0, 0 + invoke DrawGothicCup, 136, 114, skulls3d_cup1, 0, 0 + invoke DrawGothicCup, 236, 114, skulls3d_cup2, 0, 0 + jmp skulls_render_controls + +skulls_draw_phase1_cups: + ; Draw with golden ball showing under starting cup mov ebx, 0 mov edx, 0 - cmp skulls3d_state, 1 - jne @F cmp skulls3d_ballPos, 0 jne @F mov ebx, 1 mov edx, 1 @@: - cmp skulls3d_state, 4 + invoke DrawGothicCup, 36, 114, skulls3d_cup0, ebx, edx + + mov ebx, 0 + mov edx, 0 + cmp skulls3d_ballPos, 1 jne @F + mov ebx, 1 + mov edx, 1 +@@: + invoke DrawGothicCup, 136, 114, skulls3d_cup1, ebx, edx + + mov ebx, 0 + mov edx, 0 + cmp skulls3d_ballPos, 2 + jne @F + mov ebx, 1 + mov edx, 1 +@@: + invoke DrawGothicCup, 236, 114, skulls3d_cup2, ebx, edx + jmp skulls_render_controls + +skulls_draw_animated_cups: + ; 60 frames = 3 passes of 20 frames + mov eax, skulls3d_timer + cmp eax, 20 + jbe pass_0 + cmp eax, 40 + jbe pass_1 + sub eax, 41 + mov passTick, eax + mov eax, skulls3d_swapPair2 + mov curPair, eax + jmp setup_pass + +pass_0: + dec eax + mov passTick, eax + mov eax, skulls3d_swapPair0 + mov curPair, eax + jmp setup_pass + +pass_1: + sub eax, 21 + mov passTick, eax + mov eax, skulls3d_swapPair1 + mov curPair, eax + +setup_pass: + ; curPair determines swap pair: + ; 0: swap slot 0 (X=36) and slot 1 (X=136) + ; 1: swap slot 1 (X=136) and slot 2 (X=236) + ; 2: swap slot 0 (X=36) and slot 2 (X=236) + cmp curPair, 1 + je pair_1 + cmp curPair, 2 + je pair_2 + mov swapSlotA, 0 + mov swapSlotB, 1 + mov xA, 36 + mov xB, 136 + jmp calc_coords +pair_1: + mov swapSlotA, 1 + mov swapSlotB, 2 + mov xA, 136 + mov xB, 236 + jmp calc_coords +pair_2: + mov swapSlotA, 0 + mov swapSlotB, 2 + mov xA, 36 + mov xB, 236 + +calc_coords: + ; distX = xB - xA + mov eax, xB + sub eax, xA + mov distX, eax + + ; dxVal = (distX * passTick) / 20 + mov eax, distX + imul eax, passTick + xor edx, edx + mov ecx, 20 + div ecx + mov dxVal, eax + + ; curXA = xA + dxVal + mov eax, xA + add eax, dxVal + mov curXA, eax + + ; curXB = xB - dxVal + mov eax, xB + sub eax, dxVal + mov curXB, eax + + ; archY = (passTick * (20 - passTick)) / 10 + mov eax, passTick + mov ecx, 20 + sub ecx, eax + imul eax, ecx + xor edx, edx + mov ecx, 10 + div ecx + mov archY, eax + + ; Cup A hops UP: 114 - archY + mov eax, 114 + sub eax, archY + mov curYA, eax + + ; Cup B hops DOWN: 114 + archY + mov eax, 114 + add eax, archY + mov curYB, eax + + ; Check if pass ended (frame 19): swap ball position and cups + cmp passTick, 19 + jne draw_active_shuffle + + ; Swap ball position if involved + mov eax, skulls3d_ballPos + cmp eax, swapSlotA + jne check_ball_b + mov edx, swapSlotB + mov skulls3d_ballPos, edx + jmp swap_slot_identities +check_ball_b: + cmp eax, swapSlotB + jne swap_slot_identities + mov edx, swapSlotA + mov skulls3d_ballPos, edx + +swap_slot_identities: + cmp curPair, 1 + je swap_ids_1_2 + cmp curPair, 2 + je swap_ids_0_2 + ; swap 0 and 1 + mov eax, skulls3d_cup0 + xchg eax, skulls3d_cup1 + mov skulls3d_cup0, eax + jmp swap_sound_tick +swap_ids_1_2: + mov eax, skulls3d_cup1 + xchg eax, skulls3d_cup2 + mov skulls3d_cup1, eax + jmp swap_sound_tick +swap_ids_0_2: + mov eax, skulls3d_cup0 + xchg eax, skulls3d_cup2 + mov skulls3d_cup0, eax + +swap_sound_tick: + invoke PlaySoundA, OFFSET soundShuffle, 0, 1 + +draw_active_shuffle: + ; Draw stationary cup + cmp curPair, 1 + je draw_stat_cup0 + cmp curPair, 2 + je draw_stat_cup1 + ; Stationary cup is slot 2 (X=236) + invoke DrawGothicCup, 236, 114, skulls3d_cup2, 0, 0 + jmp draw_moving_cups +draw_stat_cup0: + ; Stationary cup is slot 0 (X=36) + invoke DrawGothicCup, 36, 114, skulls3d_cup0, 0, 0 + jmp draw_moving_cups +draw_stat_cup1: + ; Stationary cup is slot 1 (X=136) + invoke DrawGothicCup, 136, 114, skulls3d_cup1, 0, 0 + +draw_moving_cups: + ; Moving Cup A and Moving Cup B + cmp curPair, 1 + je ids_pair_1 + cmp curPair, 2 + je ids_pair_2 + mov eax, skulls3d_cup0 + mov ebx, skulls3d_cup1 + jmp draw_the_pair +ids_pair_1: + mov eax, skulls3d_cup1 + mov ebx, skulls3d_cup2 + jmp draw_the_pair +ids_pair_2: + mov eax, skulls3d_cup0 + mov ebx, skulls3d_cup2 + +draw_the_pair: + push ebx + invoke DrawGothicCup, curXA, curYA, eax, 0, 0 + pop ebx + invoke DrawGothicCup, curXB, curYB, ebx, 0, 0 + jmp skulls_render_controls + +skulls_draw_reveal_cups: + ; Reveal Phase: lift chosen cup and lift actual ball cup if different + ; Slot 0 + mov ebx, 0 + mov edx, 0 cmp skulls3d_choice, 0 - sete bl + je slot0_is_lifted + cmp skulls3d_ballPos, 0 + jne @F +slot0_is_lifted: + mov ebx, 1 cmp skulls3d_ballPos, 0 sete dl @@: - invoke DrawGothicCup, 36, 114, 0, ebx, edx + invoke DrawGothicCup, 36, 114, skulls3d_cup0, ebx, edx - ; Draw Cup 2 (X=136, Y=114) + ; Slot 1 mov ebx, 0 mov edx, 0 - cmp skulls3d_state, 1 - jne @F - cmp skulls3d_ballPos, 1 - jne @F - mov ebx, 1 - mov edx, 1 -@@: - cmp skulls3d_state, 4 - jne @F cmp skulls3d_choice, 1 - sete bl + je slot1_is_lifted + cmp skulls3d_ballPos, 1 + jne @F +slot1_is_lifted: + mov ebx, 1 cmp skulls3d_ballPos, 1 sete dl @@: - invoke DrawGothicCup, 136, 114, 1, ebx, edx + invoke DrawGothicCup, 136, 114, skulls3d_cup1, ebx, edx - ; Draw Cup 3 (X=236, Y=114) + ; Slot 2 mov ebx, 0 mov edx, 0 - cmp skulls3d_state, 1 - jne @F + cmp skulls3d_choice, 2 + je slot2_is_lifted cmp skulls3d_ballPos, 2 jne @F +slot2_is_lifted: mov ebx, 1 - mov edx, 1 -@@: - cmp skulls3d_state, 4 - jne @F - cmp skulls3d_choice, 2 - sete bl cmp skulls3d_ballPos, 2 sete dl @@: - invoke DrawGothicCup, 236, 114, 2, ebx, edx + invoke DrawGothicCup, 236, 114, skulls3d_cup2, ebx, edx - ; Cup selection indicators +skulls_render_controls: + ; Cup selection slot labels [1], [2], [3] invoke DrawString8x8, 54, 168, OFFSET textSkullsKey1, 00D0D8E0h invoke DrawString8x8, 150, 168, OFFSET textSkullsKey2, 00D0D8E0h invoke DrawString8x8, 250, 168, OFFSET textSkullsKey3, 00D0D8E0h @@ -1539,33 +1760,57 @@ skulls_render_cups: ; Keycaps mov kx, 16 xor eax, eax + cmp skulls3d_state, 3 + je key1_active cmp skulls3d_choice, 0 sete al + jmp draw_key1 +key1_active: + mov eax, 1 +draw_key1: invoke DrawKeycap3D, kx, 192, OFFSET textSkullsKey1, eax add kx, eax xor eax, eax + cmp skulls3d_state, 3 + je key2_active cmp skulls3d_choice, 1 sete al + jmp draw_key2 +key2_active: + mov eax, 1 +draw_key2: invoke DrawKeycap3D, kx, 192, OFFSET textSkullsKey2, eax add kx, eax xor eax, eax + cmp skulls3d_state, 3 + je key3_active cmp skulls3d_choice, 2 sete al + jmp draw_key3 +key3_active: + mov eax, 1 +draw_key3: invoke DrawKeycap3D, kx, 192, OFFSET textSkullsKey3, eax add kx, eax - invoke DrawKeycap3D, kx, 192, OFFSET textSkullsKeySpace, 1 + xor eax, eax + cmp skulls3d_state, 0 + je start_active + cmp skulls3d_state, 4 + je start_active + jmp draw_start_key +start_active: + mov eax, 1 +draw_start_key: + invoke DrawKeycap3D, kx, 192, OFFSET textSkullsKeySpace, eax add kx, eax invoke DrawKeycap3D, kx, 192, OFFSET textKeyEsc, 0 ret RenderSkullsGame ENDP -; ============================================================================== -; IN-ENGINE 2.5D MINI-GAME: SKILL CHECK (DEAD BY DAYLIGHT SURVIVOR CHECK) -; ============================================================================== InitSkillGame PROC mov skill3d_state, 0 mov skill3d_timer, 0