feat(charms): port and integrate roguelike charms system into 3D casino

- Add 4 unique charms: Clover of Luck, Golden Horseshoe, Skull of Immortality, Devil's Contract

- Add Sidorovich shop tabs ([РУБАШКИ] / [ТАЛИСМАНЫ]) with TAB/arrow navigation and purchases

- Extend casino3d-progress.dat to 32 bytes with backward-compatible save/load

- Hook event triggers into Blackjack, Poker, Durak, Coin, Dice, Scratch, Slots, Roulette, Russian Roulette, Buckshot, and Hell Tower

- Display active charm badges on HUD and Hell Tower briefing
This commit is contained in:
Игорь Федосеев 2026-10-16 13:47:23 +03:00
parent 2c1b83865a
commit fed880cce2
21 changed files with 8574 additions and 7989 deletions

Binary file not shown.

View file

@ -170,6 +170,7 @@ include src_graphics\native_coin_data.inc
include src_graphics\native_dice_data.inc include src_graphics\native_dice_data.inc
include src_graphics\scratch_data.inc include src_graphics\scratch_data.inc
include src_graphics\hell_tower_data.inc include src_graphics\hell_tower_data.inc
include src_graphics\charms_data.inc
.data .data
ALIGN 4 ALIGN 4
@ -1337,10 +1338,14 @@ RenderHUD PROC uses ebx esi edi
invoke DrawBox, 159, 118, 2, 5, 00E7DFC8h invoke DrawBox, 159, 118, 2, 5, 00E7DFC8h
invoke DrawBox, 157, 120, 6, 1, 00E7DFC8h invoke DrawBox, 157, 120, 6, 1, 00E7DFC8h
cmp interactPromptPtr, 0 cmp interactPromptPtr, 0
je @F je hud_charms_bottom
invoke DrawBoxBorder, 4, 199, 312, 18, 0014191Dh, 00D8BC6Ah, 1 invoke DrawBoxBorder, 4, 199, 312, 18, 0014191Dh, 00D8BC6Ah, 1
invoke DrawString8x8, 10, 204, interactPromptPtr, 00F5E2B0h invoke DrawString8x8, 10, 204, interactPromptPtr, 00F5E2B0h
@@: invoke DrawCharmsHUD, 8, 18
jmp hud_charms_done
hud_charms_bottom:
invoke DrawCharmsHUD, 8, 214
hud_charms_done:
cmp flashTimer, 0 cmp flashTimer, 0
je hud_finished je hud_finished
dec flashTimer dec flashTimer
@ -3226,7 +3231,11 @@ dice_check_win:
dice_roll_lost: dice_roll_lost:
mov dice3d_win, 0 mov dice3d_win, 0
mov dice3d_state, 2 mov dice3d_state, 2
invoke TriggerCharmLossProtection, dice3d_bet
test eax, eax
jnz @F
invoke PlayCasinoSound3D, OFFSET soundLose, 0, 1 invoke PlayCasinoSound3D, OFFSET soundLose, 0, 1
@@:
invoke NpcRecordRound3D,8,0 invoke NpcRecordRound3D,8,0
call SaveProgress3D call SaveProgress3D
ret ret
@ -5105,6 +5114,7 @@ include src_graphics\buckshot.inc
include src_graphics\russian_table.inc include src_graphics\russian_table.inc
include src_graphics\unavailable.inc include src_graphics\unavailable.inc
include src_graphics\hell_tower.inc include src_graphics\hell_tower.inc
include src_graphics\charms.inc
; --- Main Loop of the 3D Casino Engine --- ; --- Main Loop of the 3D Casino Engine ---
StartHellTower3D PROC uses ebx esi edi StartHellTower3D PROC uses ebx esi edi

BIN
poker.exe

Binary file not shown.

BIN
poker.obj

Binary file not shown.

View file

@ -151,6 +151,12 @@ CommitBuckshotShot3D PROC uses ebx esi edi
sub bs3d_hpPlayer, ecx sub bs3d_hpPlayer, ecx
cmp bs3d_hpPlayer, 0 cmp bs3d_hpPlayer, 0
jg bs_commit_live_turn jg bs_commit_live_turn
invoke TriggerCharmBulletProtection
test eax, eax
jz @F
mov bs3d_hpPlayer, 1
jmp bs_commit_live_turn
@@:
mov bs3d_hpPlayer, 0 mov bs3d_hpPlayer, 0
mov bs3d_afterAnim, BS_LOSE mov bs3d_afterAnim, BS_LOSE
jmp bs_commit_live_sound jmp bs_commit_live_sound

204
src_graphics/charms.inc Normal file
View file

@ -0,0 +1,204 @@
.code
; ------------------------------------------------------------------------------
; TriggerCharmLossProtection: Checks Devil's Contract and Clover to save bet
; Input: betAmount (DWORD)
; Output: eax = 1 if saved (bet refunded to bankroll), 0 if not saved
; ------------------------------------------------------------------------------
TriggerCharmLossProtection PROC uses ebx ecx edx, betAmount:DWORD
; 1. Check Devil's Contract (50% chance to refund full bet)
cmp charmDevilUses, 0
jle check_clover
invoke RandomRange, 100
cmp eax, 50
jge check_clover
; Devil Contract Triggered!
dec charmDevilUses
mov eax, betAmount
test eax, eax
jz @F
add bankroll, eax
@@:
invoke CopyString3D, OFFSET msgCharmDevilSave, OFFSET flashMessage
mov flashTimer, 120
invoke PlayCasinoSound3D, OFFSET soundJackpot, 0, 1
call SaveProgress3D
mov eax, 1
ret
check_clover:
; 2. Check Clover of Luck (15% chance to refund bet)
cmp charmCloverUses, 0
jle protection_none
invoke RandomRange, 100
cmp eax, 15
jge protection_none
; Clover Triggered!
dec charmCloverUses
mov eax, betAmount
test eax, eax
jz @F
add bankroll, eax
@@:
invoke CopyString3D, OFFSET msgCharmCloverSave, OFFSET flashMessage
mov flashTimer, 120
invoke PlayCasinoSound3D, OFFSET soundJackpot, 0, 1
call SaveProgress3D
mov eax, 1
ret
protection_none:
xor eax, eax
ret
TriggerCharmLossProtection ENDP
; ------------------------------------------------------------------------------
; TriggerCharmWinBonus: Grants +15% extra payout on slot / roulette win
; Input: winAmount (DWORD)
; Output: eax = bonus amount added to bankroll, 0 if no horseshoe active
; ------------------------------------------------------------------------------
TriggerCharmWinBonus PROC uses ebx ecx edx, winAmount:DWORD
cmp charmHorseshoeUses, 0
jle bonus_none
mov eax, winAmount
test eax, eax
jle bonus_none
; Calculate 15% bonus: (winAmount * 15) / 100
imul eax, 15
xor edx, edx
mov ecx, 100
div ecx
cmp eax, 1
jge @F
mov eax, 1
@@:
mov ebx, eax
add bankroll, ebx
dec charmHorseshoeUses
invoke CopyString3D, OFFSET msgCharmHorseshoeWin, OFFSET flashMessage
mov flashTimer, 120
invoke PlayCasinoSound3D, OFFSET soundCoin, 0, 1
call SaveProgress3D
mov eax, ebx
ret
bonus_none:
xor eax, eax
ret
TriggerCharmWinBonus ENDP
; ------------------------------------------------------------------------------
; TriggerCharmBulletProtection: Protects player from fatal gunshot
; Output: eax = 1 if saved (bullet misfired), 0 if no skull active
; ------------------------------------------------------------------------------
TriggerCharmBulletProtection PROC uses ebx ecx edx
cmp charmSkullUses, 0
jle bullet_none
dec charmSkullUses
invoke CopyString3D, OFFSET msgCharmSkullSave, OFFSET flashMessage
mov flashTimer, 140
invoke PlayCasinoSound3D, OFFSET rrDrySound3D, 0, 1
call SaveProgress3D
mov eax, 1
ret
bullet_none:
xor eax, eax
ret
TriggerCharmBulletProtection ENDP
; ------------------------------------------------------------------------------
; DrawCharmsHUD: Draws active charm badges with remaining charges
; Input: drawX, drawY (screen coordinates)
; ------------------------------------------------------------------------------
DrawCharmsHUD PROC uses ebx esi edi, drawX:DWORD, drawY:DWORD
local curX:DWORD, tempBuf[16]:BYTE
mov eax, charmCloverUses
or eax, charmHorseshoeUses
or eax, charmSkullUses
or eax, charmDevilUses
test eax, eax
jz hud_done
mov eax, drawX
mov curX, eax
; 1. Clover Badge
cmp charmCloverUses, 0
jle check_horse_hud
invoke DrawString8x8, curX, drawY, OFFSET badgeCloverPrefix, 0080FF80h
add curX, 32
invoke FormatNumber, charmCloverUses, ADDR tempBuf
invoke DrawString8x8, curX, drawY, ADDR tempBuf, 00FFFFFFh
cmp charmCloverUses, 10
jb @F
add curX, 8
@@:
add curX, 8
invoke DrawString8x8, curX, drawY, OFFSET badgeCloseBracket, 0080FF80h
add curX, 16
check_horse_hud:
; 2. Horseshoe Badge
cmp charmHorseshoeUses, 0
jle check_skull_hud
invoke DrawString8x8, curX, drawY, OFFSET badgeHorsePrefix, 00FFE060h
add curX, 32
invoke FormatNumber, charmHorseshoeUses, ADDR tempBuf
invoke DrawString8x8, curX, drawY, ADDR tempBuf, 00FFFFFFh
cmp charmHorseshoeUses, 10
jb @F
add curX, 8
@@:
add curX, 8
invoke DrawString8x8, curX, drawY, OFFSET badgeCloseBracket, 00FFE060h
add curX, 16
check_skull_hud:
; 3. Skull Badge
cmp charmSkullUses, 0
jle check_devil_hud
invoke DrawString8x8, curX, drawY, OFFSET badgeSkullPrefix, 0080FFFFh
add curX, 32
invoke FormatNumber, charmSkullUses, ADDR tempBuf
invoke DrawString8x8, curX, drawY, ADDR tempBuf, 00FFFFFFh
cmp charmSkullUses, 10
jb @F
add curX, 8
@@:
add curX, 8
invoke DrawString8x8, curX, drawY, OFFSET badgeCloseBracket, 0080FFFFh
add curX, 16
check_devil_hud:
; 4. Devil Contract Badge
cmp charmDevilUses, 0
jle hud_done
invoke DrawString8x8, curX, drawY, OFFSET badgeDevilPrefix, 00FF6060h
add curX, 32
invoke FormatNumber, charmDevilUses, ADDR tempBuf
invoke DrawString8x8, curX, drawY, ADDR tempBuf, 00FFFFFFh
cmp charmDevilUses, 10
jb @F
add curX, 8
@@:
add curX, 8
invoke DrawString8x8, curX, drawY, OFFSET badgeCloseBracket, 00FF6060h
add curX, 16
hud_done:
ret
DrawCharmsHUD ENDP

View file

@ -0,0 +1,58 @@
CHARM_COUNT equ 4
CHARM_CLOVER_PRICE equ 12000
CHARM_CLOVER_USES equ 3
CHARM_HORSESHOE_PRICE equ 20000
CHARM_HORSESHOE_USES equ 5
CHARM_SKULL_PRICE equ 35000
CHARM_SKULL_USES equ 1
CHARM_DEVIL_PRICE equ 50000
CHARM_DEVIL_USES equ 2
TriggerCharmLossProtection PROTO :DWORD
TriggerCharmWinBonus PROTO :DWORD
TriggerCharmBulletProtection PROTO
DrawCharmsHUD PROTO :DWORD, :DWORD
.data
; Active Charm Charges
charmCloverUses dd 0
charmHorseshoeUses dd 0
charmSkullUses dd 0
charmDevilUses dd 0
; Charm Store Metadata
charmPrices3D dd CHARM_CLOVER_PRICE, CHARM_HORSESHOE_PRICE, CHARM_SKULL_PRICE, CHARM_DEVIL_PRICE
charmUsesPack3D dd CHARM_CLOVER_USES, CHARM_HORSESHOE_USES, CHARM_SKULL_USES, CHARM_DEVIL_USES
charmNameClover db 'Êëåâåð Óäà÷è',0
charmNameHorseshoe db 'Çîëîòàÿ Ïîäêîâà',0
charmNameSkull db '×åðåï Áåññìåðòèÿ',0
charmNameDevil db 'Êîíòðàêò Äüÿâîëà',0
charmNames3D dd OFFSET charmNameClover, OFFSET charmNameHorseshoe, OFFSET charmNameSkull, OFFSET charmNameDevil
charmDescClover db '15% øàíñ ñïàñòè ñòàâêó',0
charmDescHorseshoe db '+15% ê âûèãðûøó â ñëîòàõ',0
charmDescSkull db '100% ñïàñåíèå îò ïóëè',0
charmDescDevil db '50% øàíñ ñïàñòè ñòàâêó',0
charmDescs3D dd OFFSET charmDescClover, OFFSET charmDescHorseshoe, OFFSET charmDescSkull, OFFSET charmDescDevil
; HUD Flash Messages
msgCharmCloverSave db 'Êëåâåð ñïàñ âàøó ñòàâêó!',0
msgCharmDevilSave db 'Äüÿâîë: ñòàâêà âîçâðàùåíà!',0
msgCharmHorseshoeWin db 'Ïîäêîâà: +15% ê âûèãðûøó!',0
msgCharmSkullSave db '×åðåï: Îñå÷êà! Âû âûæèëè!',0
msgCharmTowerSave db 'Òàëèñìàí ñïàñ âàñ îò ïàäåíèÿ ñ Áàøíè!',0
; Compact HUD Badges
badgeCloverPrefix db '[ÊË:',0
badgeHorsePrefix db '[ÏÊ:',0
badgeSkullPrefix db '[×Ð:',0
badgeDevilPrefix db '[ÊÒ:',0
badgeCloseBracket db '] ',0

View file

@ -126,6 +126,16 @@ report_champion:
ret ret
report_loss: report_loss:
invoke TriggerCharmLossProtection, 0
test eax, eax
jz @F
mov towerFloorState, TOWER_STATE_BRIEFING
invoke CopyString3D, OFFSET msgCharmTowerSave, OFFSET flashMessage
mov flashTimer, 140
mov engineMode, MODE_HELL_TOWER
call ClearKeys3D
ret
@@:
mov towerFloorState, TOWER_STATE_DEFEAT mov towerFloorState, TOWER_STATE_DEFEAT
call StopTowerMusic call StopTowerMusic
invoke PlayCasinoSound3D, OFFSET soundRoundLose, 0, 1 invoke PlayCasinoSound3D, OFFSET soundRoundLose, 0, 1
@ -236,6 +246,7 @@ RenderHellTower3D PROC uses ebx esi edi
invoke FormatNumber, towerStage, OFFSET hudNumBuffer invoke FormatNumber, towerStage, OFFSET hudNumBuffer
invoke DrawString8x8, 66, 42, OFFSET hudNumBuffer, 00FFFFFFh invoke DrawString8x8, 66, 42, OFFSET hudNumBuffer, 00FFFFFFh
invoke DrawString8x8, 74, 42, OFFSET towerOfTen, 00AAAAAAh invoke DrawString8x8, 74, 42, OFFSET towerOfTen, 00AAAAAAh
invoke DrawCharmsHUD, 130, 42
; Draw 10 stage pips across x = 26 .. 293 ; Draw 10 stage pips across x = 26 .. 293
xor esi, esi xor esi, esi

View file

@ -2,7 +2,10 @@ BeginMerchant3D PROTO
HandleMerchant3D PROTO HandleMerchant3D PROTO
RenderMerchant3D PROTO RenderMerchant3D PROTO
BuyMerchantBack3D PROTO :DWORD BuyMerchantBack3D PROTO :DWORD
BuyMerchantCharm3D PROTO :DWORD
.data .data
merchantTab3D dd 0
merchantCharmSelected3D dd 0
merchantSelected3D dd 0 merchantSelected3D dd 0
merchantTime3D dd 0 merchantTime3D dd 0
merchantReaction3D dd 1200 merchantReaction3D dd 1200
@ -35,6 +38,10 @@ merchantEquipped3D db 205,192,196,197,210,206,0
merchantPoor3D db 204,192,203,206,32,212,200,216,197,202,0 merchantPoor3D db 204,192,203,206,32,212,200,216,197,202,0
merchantShopKeys3D db 194,194,197,208,213,47,194,205,200,199,32,32,69,78,84,69,82,58,32,202,211,207,200,210,220,32,32,69,83,67,58,32 merchantShopKeys3D db 194,194,197,208,213,47,194,205,200,199,32,32,69,78,84,69,82,58,32,202,211,207,200,210,220,32,32,69,83,67,58,32
db 213,206,203,203,0 db 213,206,203,203,0
merchantTabCharmsLabel db 210,192,203,200,209,204,192,205,219,0
merchantDollar3D db '$',0
merchantStockUsesLabel db 199,224,240,58,32,0
merchantShopKeysWithTabs db 84,65,66,58,32,194,234,235,224,228,234,224,32,32,69,78,84,69,82,58,32,202,243,239,232,242,252,32,32,69,83,67,58,32,213,238,235,235,0
merchantHello3D db 207,206,209,204,206,210,208,200,44,32,215,210,206,32,197,209,210,220,46,0 merchantHello3D db 207,206,209,204,206,210,208,200,44,32,215,210,206,32,197,209,210,220,46,0
merchantThanks3D db 213,206,208,206,216,200,201,32,194,219,193,206,208,46,0 merchantThanks3D db 213,206,208,206,216,200,201,32,194,219,193,206,208,46,0
merchantArrowUp3D db "^",0 merchantArrowUp3D db "^",0

View file

@ -4,6 +4,8 @@ BeginMerchant3D PROC
mov merchantTime3D, 0 mov merchantTime3D, 0
mov merchantReaction3D, 1280 mov merchantReaction3D, 1280
mov merchantMessage3D, 0 mov merchantMessage3D, 0
mov merchantTab3D, 0
mov merchantCharmSelected3D, 0
mov eax, selectedBack3D mov eax, selectedBack3D
cmp eax, 12 cmp eax, 12
jbe @F jbe @F
@ -46,6 +48,48 @@ merchant_purchase_done:
ret ret
BuyMerchantBack3D ENDP BuyMerchantBack3D ENDP
BuyMerchantCharm3D PROC uses ebx charmIndex:DWORD
mov ebx, charmIndex
cmp ebx, 3
ja charm_purchase_done
mov eax, charmPrices3D[ebx*4]
cmp bankroll, eax
jb charm_purchase_poor
sub bankroll, eax
mov ecx, charmUsesPack3D[ebx*4]
cmp ebx, 0
jne @F
add charmCloverUses, ecx
jmp charm_bought
@@:
cmp ebx, 1
jne @F
add charmHorseshoeUses, ecx
jmp charm_bought
@@:
cmp ebx, 2
jne @F
add charmSkullUses, ecx
jmp charm_bought
@@:
cmp ebx, 3
jne charm_bought
add charmDevilUses, ecx
charm_bought:
mov merchantMessage3D, 1
mov merchantReaction3D, 0
mov merchantReactionKind3D, 2
call SaveProgress3D
invoke PlayCasinoSound3D, OFFSET soundCoin, 0, 1
ret
charm_purchase_poor:
mov merchantMessage3D, 2
mov merchantReaction3D, 0
mov merchantReactionKind3D, 1
charm_purchase_done:
ret
BuyMerchantCharm3D ENDP
HandleMerchant3D PROC uses ebx HandleMerchant3D PROC uses ebx
mov eax, merchantSelected3D mov eax, merchantSelected3D
cmp eax, merchantPreviousFocus3D cmp eax, merchantPreviousFocus3D
@ -57,6 +101,27 @@ HandleMerchant3D PROC uses ebx
mov eax, deltaTime3D mov eax, deltaTime3D
add merchantTime3D, eax add merchantTime3D, eax
add merchantReaction3D, eax add merchantReaction3D, eax
; TAB (09h), Left Arrow (25h), Right Arrow (27h) toggle tabs
invoke Pressed3D, 09h
test eax, eax
jnz merchant_tab_toggle
invoke Pressed3D, 25h
test eax, eax
jnz merchant_tab_toggle
invoke Pressed3D, 27h
test eax, eax
jz @F
merchant_tab_toggle:
xor merchantTab3D, 1
mov merchantReaction3D, 0
mov merchantReactionKind3D, 1
invoke PlayCasinoSound3D, OFFSET soundClick, 0, 1
@@:
cmp merchantTab3D, 0
jne handle_charms_vertical
; Shirts vertical navigation
invoke Pressed3D, 26h invoke Pressed3D, 26h
test eax, eax test eax, eax
jz @F jz @F
@ -66,17 +131,53 @@ HandleMerchant3D PROC uses ebx
@@: @@:
invoke Pressed3D, 28h invoke Pressed3D, 28h
test eax, eax test eax, eax
jz @F jz merchant_after_vertical
cmp merchantSelected3D, 12 cmp merchantSelected3D, 12
jae @F jae merchant_after_vertical
inc merchantSelected3D inc merchantSelected3D
jmp merchant_after_vertical
handle_charms_vertical:
; Charms vertical navigation
invoke Pressed3D, 26h
test eax, eax
jz @F
cmp merchantCharmSelected3D, 0
je @F
dec merchantCharmSelected3D
@@: @@:
invoke Pressed3D, 28h
test eax, eax
jz merchant_after_vertical
cmp merchantCharmSelected3D, 3
jae merchant_after_vertical
inc merchantCharmSelected3D
merchant_after_vertical:
cmp mouseClick3D, 0 cmp mouseClick3D, 0
je merchant_enter je merchant_enter
cmp mouseX3D, 168 cmp mouseX3D, 168
jb merchant_enter jb merchant_enter
cmp mouseX3D, 311 cmp mouseX3D, 311
jae merchant_enter jae merchant_enter
; Tab header clicks (y 31..46)
cmp mouseY3D, 31
jb merchant_enter
cmp mouseY3D, 46
jae merchant_mouse_content
cmp mouseX3D, 235
jae tab_charms_click
mov merchantTab3D, 0
ret
tab_charms_click:
mov merchantTab3D, 1
ret
merchant_mouse_content:
cmp merchantTab3D, 0
jne merchant_mouse_charms
cmp mouseY3D, 48 cmp mouseY3D, 48
jae merchant_mouse_rows jae merchant_mouse_rows
cmp mouseY3D, 34 cmp mouseY3D, 34
@ -114,18 +215,41 @@ merchant_mouse_rows:
ja merchant_handle_done ja merchant_handle_done
mov merchantSelected3D, eax mov merchantSelected3D, eax
ret ret
merchant_mouse_charms:
cmp mouseY3D, 50
jb merchant_mouse_buy
cmp mouseY3D, 178
jae merchant_mouse_buy
mov eax, mouseY3D
sub eax, 50
xor edx, edx
mov ecx, 32
div ecx
cmp eax, 3
ja merchant_handle_done
mov merchantCharmSelected3D, eax
ret
merchant_mouse_buy: merchant_mouse_buy:
cmp mouseY3D, 193 cmp mouseY3D, 193
jb merchant_handle_done jb merchant_handle_done
cmp mouseY3D, 211 cmp mouseY3D, 211
ja merchant_handle_done ja merchant_handle_done
jmp merchant_confirm jmp merchant_confirm
merchant_enter: merchant_enter:
invoke Pressed3D, 0Dh invoke Pressed3D, 0Dh
test eax, eax test eax, eax
jz merchant_handle_done jz merchant_handle_done
merchant_confirm: merchant_confirm:
cmp merchantTab3D, 0
jne @F
invoke BuyMerchantBack3D, merchantSelected3D invoke BuyMerchantBack3D, merchantSelected3D
ret
@@:
invoke BuyMerchantCharm3D, merchantCharmSelected3D
merchant_handle_done: merchant_handle_done:
ret ret
HandleMerchant3D ENDP HandleMerchant3D ENDP
@ -173,14 +297,45 @@ merchant_draw_pose:
mov esi, OFFSET merchantThanks3D mov esi, OFFSET merchantThanks3D
@@: @@:
invoke DrawString8x8, 6, 209, esi, 00F0D7ABh invoke DrawString8x8, 6, 209, esi, 00F0D7ABh
; Draw card back preview only on Shirts tab
cmp merchantTab3D, 0
jne @F
invoke DrawAnimSprite3D, OFFSET backsPack3D, merchantSelected3D, 24, 282, 68, 96 invoke DrawAnimSprite3D, OFFSET backsPack3D, merchantSelected3D, 24, 282, 68, 96
@@:
invoke DrawBox, 0, 0, 320, 21, 00181D1Bh invoke DrawBox, 0, 0, 320, 21, 00181D1Bh
invoke DrawString8x8, 8, 6, OFFSET merchantTitle3D, 00E9CD9Ah invoke DrawString8x8, 8, 6, OFFSET merchantTitle3D, 00E9CD9Ah
invoke DrawString8x8, 152, 6, OFFSET textBank3D, 00B8D5B3h invoke DrawString8x8, 152, 6, OFFSET textBank3D, 00B8D5B3h
invoke FormatNumber, bankroll, OFFSET hudNumBuffer invoke FormatNumber, bankroll, OFFSET hudNumBuffer
invoke DrawString8x8, 203, 6, OFFSET hudNumBuffer, 00FFFFFFh invoke DrawString8x8, 203, 6, OFFSET hudNumBuffer, 00FFFFFFh
; Right Panel
invoke DrawBoxBorder, 166, 31, 147, 187, 00191D1Fh, 009A825Ah, 1 invoke DrawBoxBorder, 166, 31, 147, 187, 00191D1Fh, 009A825Ah, 1
invoke DrawString8x8, 173, 36, OFFSET merchantStock3D, 00E9CD9Ah
; Tab 1: [ ÐÓÁÀØÊÈ ] (x 169..232)
cmp merchantTab3D, 0
jne @F
invoke DrawBox, 169, 33, 64, 13, 00395046h
invoke DrawString8x8, 171, 36, OFFSET merchantStock3D, 00FFFFFFh
jmp tab2_draw
@@:
invoke DrawString8x8, 171, 36, OFFSET merchantStock3D, 007E8E81h
tab2_draw:
; Tab 2: [ ÒÀËÈÑÌÀÍÛ ] (x 236..310)
cmp merchantTab3D, 1
jne @F
invoke DrawBox, 236, 33, 74, 13, 00395046h
invoke DrawString8x8, 238, 36, OFFSET merchantTabCharmsLabel, 00FFFFFFh
jmp tab_draw_done
@@:
invoke DrawString8x8, 238, 36, OFFSET merchantTabCharmsLabel, 007E8E81h
tab_draw_done:
cmp merchantTab3D, 0
jne render_charms_view
; --- SHIRTS VIEW ---
invoke DrawBoxBorder, 248, 34, 24, 12, 00373F3Bh, 00889985h, 1 invoke DrawBoxBorder, 248, 34, 24, 12, 00373F3Bh, 00889985h, 1
invoke DrawString8x8, 256, 36, OFFSET merchantArrowUp3D, 00FFFFFFh invoke DrawString8x8, 256, 36, OFFSET merchantArrowUp3D, 00FFFFFFh
invoke DrawBoxBorder, 279, 34, 24, 12, 00373F3Bh, 00889985h, 1 invoke DrawBoxBorder, 279, 34, 24, 12, 00373F3Bh, 00889985h, 1
@ -225,6 +380,66 @@ merchant_item_status:
sub eax, start sub eax, start
cmp eax, 5 cmp eax, 5
jb merchant_render_row jb merchant_render_row
jmp merchant_render_footer
render_charms_view:
; --- CHARMS VIEW ---
xor ebx, ebx
mov rowY, 50
charm_render_loop:
cmp ebx, 4
jae merchant_render_footer
mov ink, 00C1C8C1h
cmp ebx, merchantCharmSelected3D
jne @F
invoke DrawBoxBorder, 168, rowY, 142, 28, 00395046h, 00A7C4AEh, 1
mov ink, 00FFFFFFh
@@:
; Line 1: Charm Name
mov eax, rowY
add eax, 2
invoke DrawString8x8, 171, eax, charmNames3D[ebx*4], ink
; Line 2: Charm Description
mov eax, rowY
add eax, 11
invoke DrawString8x8, 171, eax, charmDescs3D[ebx*4], 0088B8A8h
; Line 3: Price and Charges
mov eax, rowY
add eax, 20
push eax
invoke DrawString8x8, 171, eax, OFFSET merchantDollar3D, 00C7B58Ah
invoke FormatNumber, charmPrices3D[ebx*4], OFFSET hudNumBuffer
pop eax
push eax
invoke DrawString8x8, 179, eax, OFFSET hudNumBuffer, 00FFFFFFh
pop eax
push eax
invoke DrawString8x8, 234, eax, OFFSET merchantStockUsesLabel, 00A0A0A0h
mov edx, charmCloverUses
cmp ebx, 0
je draw_cur_uses
mov edx, charmHorseshoeUses
cmp ebx, 1
je draw_cur_uses
mov edx, charmSkullUses
cmp ebx, 2
je draw_cur_uses
mov edx, charmDevilUses
draw_cur_uses:
invoke FormatNumber, edx, OFFSET hudNumBuffer
pop eax
invoke DrawString8x8, 274, eax, OFFSET hudNumBuffer, 00FFE060h
add rowY, 31
inc ebx
jmp charm_render_loop
merchant_render_footer: merchant_render_footer:
cmp merchantMessage3D, 2 cmp merchantMessage3D, 2
jne @F jne @F
@ -233,6 +448,6 @@ merchant_render_footer:
invoke DrawBoxBorder, 171, 194, 136, 17, 003B5949h, 00CBAF73h, 1 invoke DrawBoxBorder, 171, 194, 136, 17, 003B5949h, 00CBAF73h, 1
invoke DrawString8x8, 194, 199, OFFSET merchantBuy3D, 00FFFFFFh invoke DrawString8x8, 194, 199, OFFSET merchantBuy3D, 00FFFFFFh
invoke DrawBox, 0, 224, 320, 16, 00181D1Bh invoke DrawBox, 0, 224, 320, 16, 00181D1Bh
invoke DrawString8x8, 8, 229, OFFSET merchantShopKeys3D, 00C5C7B8h invoke DrawString8x8, 8, 229, OFFSET merchantShopKeysWithTabs, 00C5C7B8h
ret ret
RenderMerchant3D ENDP RenderMerchant3D ENDP

View file

@ -78,6 +78,9 @@ bj_settle_credit:
invoke PlayCasinoSound3D, OFFSET soundRoundWin, 0, 1 invoke PlayCasinoSound3D, OFFSET soundRoundWin, 0, 1
jmp bj_settle_save jmp bj_settle_save
bj_settle_loss: bj_settle_loss:
invoke TriggerCharmLossProtection, cbStake3D
test eax, eax
jnz bj_settle_save
invoke PlayCasinoSound3D, OFFSET soundRoundLose, 0, 1 invoke PlayCasinoSound3D, OFFSET soundRoundLose, 0, 1
bj_settle_save: bj_settle_save:
call ClearKeys3D call ClearKeys3D

View file

@ -186,8 +186,12 @@ SettleNativeClover3D PROC
jmp clp_settle_leave jmp clp_settle_leave
@@: @@:
invoke PlayCasinoSound3D,OFFSET soundRoundWin,0,1 invoke PlayCasinoSound3D,OFFSET soundRoundWin,0,1
invoke TriggerCharmWinBonus, clpGross3D
jmp clp_settle_leave jmp clp_settle_leave
clp_settle_loss: clp_settle_loss:
invoke TriggerCharmLossProtection, clpStake3D
test eax, eax
jnz clp_settle_leave
invoke PlayCasinoSound3D,OFFSET soundRoundLose,0,1 invoke PlayCasinoSound3D,OFFSET soundRoundLose,0,1
clp_settle_leave: clp_settle_leave:
cmp clpLeave3D,0 cmp clpLeave3D,0

View file

@ -100,6 +100,9 @@ CoinSettle3D PROC
jmp coin_settle_save jmp coin_settle_save
coin_settle_loss: coin_settle_loss:
mov coin3d_streak,0 mov coin3d_streak,0
invoke TriggerCharmLossProtection, coin3d_bet
test eax, eax
jnz coin_settle_save
invoke PlayCasinoSound3D,OFFSET soundLose,0,1 invoke PlayCasinoSound3D,OFFSET soundLose,0,1
coin_settle_save: coin_settle_save:
mov coin3d_state,COIN_RESULT mov coin3d_state,COIN_RESULT

View file

@ -130,6 +130,9 @@ NativeDurakSettle3D PROC result:DWORD
invoke PlayCasinoSound3D, OFFSET soundRoundWin, 0, 1 invoke PlayCasinoSound3D, OFFSET soundRoundWin, 0, 1
jmp dk_settle_save jmp dk_settle_save
dk_settle_loss: dk_settle_loss:
invoke TriggerCharmLossProtection, dkStake3D
test eax, eax
jnz dk_settle_save
invoke PlayCasinoSound3D, OFFSET soundRoundLose, 0, 1 invoke PlayCasinoSound3D, OFFSET soundRoundLose, 0, 1
dk_settle_save: dk_settle_save:
call ClearKeys3D call ClearKeys3D

View file

@ -261,6 +261,9 @@ PokerFold3D PROC actor:DWORD
poker_fold_player: poker_fold_player:
mov eax, pkPot3D mov eax, pkPot3D
add pkStack3D, eax add pkStack3D, eax
invoke TriggerCharmLossProtection, pkPaid3D[0]
test eax, eax
jnz poker_fold_settled
invoke PlayCasinoSound3D, OFFSET soundRoundLose, 0, 1 invoke PlayCasinoSound3D, OFFSET soundRoundLose, 0, 1
poker_fold_settled: poker_fold_settled:
mov pkState3D, PK_RESULT mov pkState3D, PK_RESULT
@ -347,6 +350,9 @@ poker_showdown_lose:
mov eax, pkPot3D mov eax, pkPot3D
add pkStack3D, eax add pkStack3D, eax
mov pkOutcome3D, 1 mov pkOutcome3D, 1
invoke TriggerCharmLossProtection, pkPaid3D[0]
test eax, eax
jnz poker_showdown_settled
invoke PlayCasinoSound3D, OFFSET soundRoundLose, 0, 1 invoke PlayCasinoSound3D, OFFSET soundRoundLose, 0, 1
jmp poker_showdown_settled jmp poker_showdown_settled
poker_showdown_tie: poker_showdown_tie:

View file

@ -173,8 +173,12 @@ slot_settle_stops:
jmp slot_settle_exit jmp slot_settle_exit
@@: @@:
invoke PlayCasinoSound3D,OFFSET soundRoundWin,0,1 invoke PlayCasinoSound3D,OFFSET soundRoundWin,0,1
invoke TriggerCharmWinBonus, slotWinAmount
jmp slot_settle_exit jmp slot_settle_exit
slot_settle_loss: slot_settle_loss:
invoke TriggerCharmLossProtection, slotStake3D
test eax, eax
jnz slot_settle_exit
invoke PlayCasinoSound3D,OFFSET soundRoundLose,0,1 invoke PlayCasinoSound3D,OFFSET soundRoundLose,0,1
slot_settle_exit: slot_settle_exit:
cmp slotLeaveAfter3D,0 cmp slotLeaveAfter3D,0

View file

@ -131,6 +131,16 @@ wheel_settle_next:
wheel_bank_cap: wheel_bank_cap:
mov bankroll, 1000000000 mov bankroll, 1000000000
@@: @@:
mov ecx, wheelReturn3D
cmp ecx, wheelStake3D
ja wheel_win_charm
cmp ecx, 0
jne wheel_charm_done
invoke TriggerCharmLossProtection, wheelStake3D
jmp wheel_charm_done
wheel_win_charm:
invoke TriggerCharmWinBonus, wheelReturn3D
wheel_charm_done:
mov roulState, 2 mov roulState, 2
xor eax,eax xor eax,eax
mov ecx,wheelReturn3D mov ecx,wheelReturn3D

View file

@ -505,14 +505,18 @@ LoadProgress3D PROC uses ebx
mov bankroll, 10000 mov bankroll, 10000
mov ownedBacks3D, 1 mov ownedBacks3D, 1
mov selectedBack3D, 0 mov selectedBack3D, 0
mov charmCloverUses, 0
mov charmHorseshoeUses, 0
mov charmSkullUses, 0
mov charmDevilUses, 0
invoke CreateFileA, OFFSET savePath3D, 80000000h, 1, 0, 3, 80h, 0 invoke CreateFileA, OFFSET savePath3D, 80000000h, 1, 0, 3, 80h, 0
cmp eax, -1 cmp eax, -1
je progress_loaded je progress_loaded
mov ebx, eax mov ebx, eax
invoke ReadFile, ebx, OFFSET saveData3D, 16, OFFSET saveIo3D, 0 invoke ReadFile, ebx, OFFSET saveData3D, 32, OFFSET saveIo3D, 0
invoke CloseHandle, ebx invoke CloseHandle, ebx
cmp saveIo3D, 16 cmp saveIo3D, 16
jne progress_loaded jb progress_loaded
cmp saveData3D, 33443343h cmp saveData3D, 33443343h
je progress_version_ok je progress_version_ok
cmp saveData3D, 32443343h cmp saveData3D, 32443343h
@ -552,6 +556,16 @@ progress_version_ok:
bt eax, ecx bt eax, ecx
jnc progress_loaded jnc progress_loaded
mov selectedBack3D, ecx mov selectedBack3D, ecx
cmp saveIo3D, 32
jb progress_loaded
mov eax, saveData3D[16]
mov charmCloverUses, eax
mov eax, saveData3D[20]
mov charmHorseshoeUses, eax
mov eax, saveData3D[24]
mov charmSkullUses, eax
mov eax, saveData3D[28]
mov charmDevilUses, eax
progress_loaded: progress_loaded:
ret ret
LoadProgress3D ENDP LoadProgress3D ENDP
@ -575,11 +589,19 @@ ENDIF
mov saveData3D[8], eax mov saveData3D[8], eax
mov eax, selectedBack3D mov eax, selectedBack3D
mov saveData3D[12], eax mov saveData3D[12], eax
mov eax, charmCloverUses
mov saveData3D[16], eax
mov eax, charmHorseshoeUses
mov saveData3D[20], eax
mov eax, charmSkullUses
mov saveData3D[24], eax
mov eax, charmDevilUses
mov saveData3D[28], eax
invoke CreateFileA, OFFSET savePath3D, 40000000h, 0, 0, 2, 80h, 0 invoke CreateFileA, OFFSET savePath3D, 40000000h, 0, 0, 2, 80h, 0
cmp eax, -1 cmp eax, -1
je progress_saved je progress_saved
mov ebx, eax mov ebx, eax
invoke WriteFile, ebx, OFFSET saveData3D, 16, OFFSET saveIo3D, 0 invoke WriteFile, ebx, OFFSET saveData3D, 32, OFFSET saveIo3D, 0
invoke CloseHandle, ebx invoke CloseHandle, ebx
progress_saved: progress_saved:
ret ret

View file

@ -66,7 +66,7 @@ displaySettingsPath3D db "runtime\display.cfg",0
displaySettingsData3D dd 44535031h,1,0 displaySettingsData3D dd 44535031h,1,0
displaySettingsIo3D dd 0 displaySettingsIo3D dd 0
savePath3D db "runtime\casino3d-progress.dat",0 savePath3D db "runtime\casino3d-progress.dat",0
saveData3D dd 32443343h, 10000, 0, 0 saveData3D dd 32443343h, 10000, 0, 0, 0, 0, 0, 0
saveIo3D dd 0 saveIo3D dd 0
previewBackMap3D dd 0,3,5,2 previewBackMap3D dd 0,3,5,2
textPause3D db 202,192,199,200,205,206,32,47,32,205,192,209,210,208,206,201,202,200,0 textPause3D db 202,192,199,200,205,206,32,47,32,205,192,209,210,208,206,201,202,200,0

View file

@ -149,9 +149,18 @@ rr_next_fire:
setc al setc al
movzx eax, al movzx eax, al
mov rr3d_shot, eax mov rr3d_shot, eax
mov rr3d_state, RR_FIRE cmp rr3d_turn, 0
jne @F
cmp rr3d_shot, 0
je @F
invoke TriggerCharmBulletProtection
test eax, eax test eax, eax
jz @F jz @F
mov rr3d_shot, 0
@@:
mov rr3d_state, RR_FIRE
cmp rr3d_shot, 0
jz @F
invoke PlayCasinoSound3D, OFFSET rrFireSound3D, 0, 20003h invoke PlayCasinoSound3D, OFFSET rrFireSound3D, 0, 20003h
ret ret
@@: @@:

View file

@ -410,6 +410,16 @@ FinishScratch3D PROC
mov eax,1000000000 mov eax,1000000000
@@: @@:
mov bankroll,eax mov bankroll,eax
mov ecx, scrGross3D
cmp ecx, scrStake3D
ja scratch_charm_win
cmp ecx, 0
jne @F
invoke TriggerCharmLossProtection, scrStake3D
jmp @F
scratch_charm_win:
invoke TriggerCharmWinBonus, scrGross3D
@@:
call ScratchStartPayout3D call ScratchStartPayout3D
call SaveProgress3D call SaveProgress3D
scratch_finish_done: scratch_finish_done: