KAZIK/src_graphics/hell_tower.inc
Игорь Федосеев 2024aacd31 feat(tower): implement 3D Hell Tower mode and clean legacy console code
- Add 3D Hell Tower mode with 10 boss floors, briefings, and outcome tracking across games
- Refactor poker.asm by removing >10,600 lines of dead legacy console games and menus
- Rebuild poker.exe with clean binary output and update .gitignore
2026-10-15 19:49:50 +03:00

364 lines
9.2 KiB
PHP

; --- hell_tower.inc: Implementation of Hell Tower (10-floor Boss Rush) ---
.code
InitHellTower3D PROC
mov tournamentMode, 1
mov towerStage, 1
mov towerFloorState, TOWER_STATE_BRIEFING
mov towerAnimClock, 0
call PlayTowerRandomMusic
mov engineMode, MODE_HELL_TOWER
call ClearKeys3D
ret
InitHellTower3D ENDP
TowerExitToHall PROC
call StopTowerMusic
mov tournamentMode, 0
mov engineMode, MODE_WALK
call ClearKeys3D
ret
TowerExitToHall ENDP
TowerLaunchCurrentFloor PROC uses ebx esi edi
mov eax, towerStage
dec eax
cmp eax, 10
jae @F
jmp launch_valid
@@:
xor eax, eax
launch_valid:
mov edx, towerFloorModes[eax*4]
mov towerCurrentGame, edx
mov towerFloorState, TOWER_STATE_IN_GAME
; Launch corresponding game
cmp edx, MODE_COIN
jne @F
call InitCoinGame
mov engineMode, MODE_COIN
jmp launch_done
@@:
cmp edx, MODE_DICE
jne @F
call InitDiceGame
mov engineMode, MODE_DICE
jmp launch_done
@@:
cmp edx, MODE_SKULLS
jne @F
call InitSkullsGame
mov engineMode, MODE_SKULLS
jmp launch_done
@@:
cmp edx, MODE_BLACKJACK
jne @F
call InitNativeBlackjack3D
mov engineMode, MODE_BLACKJACK
jmp launch_done
@@:
cmp edx, MODE_POKER
jne @F
call InitNativePoker3D
mov engineMode, MODE_POKER
jmp launch_done
@@:
cmp edx, MODE_RUSSIAN
jne @F
call InitRussianGame3D
mov engineMode, MODE_RUSSIAN
jmp launch_done
@@:
cmp edx, MODE_ROULETTE
jne @F
call InitNativeWheel3D
mov engineMode, MODE_ROULETTE
jmp launch_done
@@:
cmp edx, MODE_DURAK
jne @F
call InitNativeDurak3D
mov engineMode, MODE_DURAK
jmp launch_done
@@:
cmp edx, MODE_SKILL
jne @F
call InitSkillGame
mov engineMode, MODE_SKILL
jmp launch_done
@@:
cmp edx, MODE_BUCKSHOT
jne launch_done
call InitBuckshot3D
mov engineMode, MODE_BUCKSHOT
launch_done:
call ClearKeys3D
ret
TowerLaunchCurrentFloor ENDP
TowerReportRoundOutcome PROC uses eax outcome:DWORD
cmp tournamentMode, 1
jne report_exit
mov eax, outcome
cmp eax, 1
jne report_loss
; --- Victory ---
cmp towerStage, 10
jae report_champion
mov towerFloorState, TOWER_STATE_CLEAR
invoke PlayCasinoSound3D, OFFSET soundRoundWin, 0, 1
mov engineMode, MODE_HELL_TOWER
call ClearKeys3D
ret
report_champion:
mov towerFloorState, TOWER_STATE_CHAMPION
mov eax, towerPrizeAmount
add bankroll, eax
invoke PlayCasinoSound3D, OFFSET soundRoundWin, 0, 1
call SaveProgress3D
mov engineMode, MODE_HELL_TOWER
call ClearKeys3D
ret
report_loss:
mov towerFloorState, TOWER_STATE_DEFEAT
call StopTowerMusic
invoke PlayCasinoSound3D, OFFSET soundRoundLose, 0, 1
mov engineMode, MODE_HELL_TOWER
call ClearKeys3D
ret
report_exit:
ret
TowerReportRoundOutcome ENDP
HandleHellTowerInput PROC
mov eax, towerFloorState
cmp eax, TOWER_STATE_BRIEFING
je input_briefing
cmp eax, TOWER_STATE_CLEAR
je input_clear
cmp eax, TOWER_STATE_DEFEAT
je input_defeat
cmp eax, TOWER_STATE_CHAMPION
je input_champion
ret
input_briefing:
invoke Pressed3D, 1Bh ; ESC
test eax, eax
jz @F
call TowerExitToHall
ret
@@:
invoke Pressed3D, 20h ; SPACE
test eax, eax
jnz start_stage
invoke Pressed3D, 0Dh ; ENTER
test eax, eax
jnz start_stage
ret
start_stage:
call TowerLaunchCurrentFloor
ret
input_clear:
invoke Pressed3D, 1Bh ; ESC
test eax, eax
jz @F
call TowerExitToHall
ret
@@:
invoke Pressed3D, 20h ; SPACE
test eax, eax
jnz advance_stage
invoke Pressed3D, 0Dh ; ENTER
test eax, eax
jnz advance_stage
ret
advance_stage:
inc towerStage
mov towerFloorState, TOWER_STATE_BRIEFING
call ClearKeys3D
ret
input_defeat:
invoke Pressed3D, 1Bh ; ESC
test eax, eax
jnz exit_to_hall
invoke Pressed3D, 20h ; SPACE
test eax, eax
jnz exit_to_hall
invoke Pressed3D, 0Dh ; ENTER
test eax, eax
jnz exit_to_hall
ret
input_champion:
invoke Pressed3D, 1Bh ; ESC
test eax, eax
jnz exit_to_hall
invoke Pressed3D, 20h ; SPACE
test eax, eax
jnz exit_to_hall
invoke Pressed3D, 0Dh ; ENTER
test eax, eax
jnz exit_to_hall
ret
exit_to_hall:
call TowerExitToHall
ret
HandleHellTowerInput ENDP
RenderHellTower3D PROC uses ebx esi edi
; 1. Clear background with deep infernal maroon
lea edi, screenBuffer
mov ecx, SCREEN_SIZE
mov eax, 00100202h
rep stosd
; 2. Outer and inner border
invoke DrawBoxBorder, 8, 8, 304, 224, 00120202h, 00CC2222h, 2
invoke DrawBoxBorder, 12, 12, 296, 216, 000C0202h, 00881111h, 1
; 3. Header Banner (Centered: 192px wide, (320 - 192)/2 = 64)
invoke DrawBoxBorder, 18, 16, 284, 20, 00220404h, 00FF4444h, 1
invoke DrawString8x8, 64, 22, OFFSET towerHeader, 00FFDD66h
; 4. Floor Header & Segment Progress Bar
invoke DrawString8x8, 26, 42, OFFSET towerFloorPrefix, 00FF6666h
invoke FormatNumber, towerStage, OFFSET hudNumBuffer
invoke DrawString8x8, 66, 42, OFFSET hudNumBuffer, 00FFFFFFh
invoke DrawString8x8, 74, 42, OFFSET towerOfTen, 00AAAAAAh
; Draw 10 stage pips across x = 26 .. 293
xor esi, esi
draw_pips_loop:
mov eax, esi
imul eax, 27
add eax, 26 ; x position
mov ebx, eax
; Color based on state
mov ecx, towerStage
dec ecx
cmp esi, ecx
jae pip_future
; Past stage (Cleared): Bright Gold
invoke DrawBoxBorder, ebx, 54, 24, 6, 00DDBB22h, 00FFEE44h, 1
jmp pip_next
pip_future:
je pip_current
; Future stage: Dark
invoke DrawBoxBorder, ebx, 54, 24, 6, 002A0808h, 00441111h, 1
jmp pip_next
pip_current:
; Current stage: Pulsing Fire Red/Orange
invoke DrawBoxBorder, ebx, 54, 24, 6, 00EE3311h, 00FFAA33h, 1
pip_next:
inc esi
cmp esi, 10
jb draw_pips_loop
; 5. Specific State Panels
mov eax, towerFloorState
cmp eax, TOWER_STATE_BRIEFING
je render_briefing
cmp eax, TOWER_STATE_CLEAR
je render_clear
cmp eax, TOWER_STATE_DEFEAT
je render_defeat
cmp eax, TOWER_STATE_CHAMPION
je render_champion
ret
render_briefing:
; Boss & Game Card
invoke DrawBoxBorder, 20, 66, 280, 58, 001E0404h, 00AA2222h, 1
invoke DrawString8x8, 28, 72, OFFSET towerEnemyLabel, 00FFAA55h
mov eax, towerStage
dec eax
mov edx, towerBossNames[eax*4]
invoke DrawString8x8, 76, 72, edx, 00FFFFFFh
invoke DrawString8x8, 28, 86, OFFSET towerGameLabel, 00FFAA55h
mov eax, towerStage
dec eax
mov edx, towerGameNames[eax*4]
invoke DrawString8x8, 76, 86, edx, 00FFDD66h
mov eax, towerStage
dec eax
mov edx, towerDescriptions[eax*4]
invoke DrawString8x8, 28, 104, edx, 00CCCCCCh
; Rules & Warning (fits cleanly inside 300px boundary)
invoke DrawString8x8, 24, 132, OFFSET towerRuleText, 00FFAA33h
invoke DrawString8x8, 24, 146, OFFSET towerLossWarning, 00EE4444h
; Bankroll Display
invoke DrawString8x8, 24, 164, OFFSET textBank3D, 00AAAAAAh
invoke FormatNumber, bankroll, OFFSET hudNumBuffer
invoke DrawString8x8, 76, 164, OFFSET hudNumBuffer, 0066FF66h
; Action Buttons (Centered text inside buttons)
invoke DrawBoxBorder, 22, 184, 132, 24, 003D0C0Ch, 00FF4444h, 1
invoke DrawString8x8, 32, 192, OFFSET towerStartBtn, 00FFFFFFh
invoke DrawBoxBorder, 164, 184, 132, 24, 00220606h, 00882222h, 1
invoke DrawString8x8, 178, 192, OFFSET towerEscBtn, 00AAAAAAh
ret
render_clear:
invoke DrawBoxBorder, 20, 76, 280, 74, 00082208h, 0033CC33h, 2
invoke DrawString8x8, 48, 90, OFFSET towerClearTitle, 0066FF66h
invoke DrawString8x8, 24, 112, OFFSET towerClearDesc, 00FFFFFFh
invoke DrawBoxBorder, 50, 174, 220, 26, 00114411h, 0044FF44h, 1
invoke DrawString8x8, 100, 183, OFFSET towerNextBtn, 00FFFFFFh
ret
render_defeat:
invoke DrawBoxBorder, 20, 76, 280, 74, 002A0404h, 00FF2222h, 2
invoke DrawString8x8, 60, 90, OFFSET towerDefeatTitle, 00FF4444h
invoke DrawString8x8, 36, 112, OFFSET towerDefeatDesc, 00FFFFFFh
invoke DrawBoxBorder, 32, 174, 256, 26, 00441010h, 00FF4444h, 1
invoke DrawString8x8, 48, 183, OFFSET towerReturnBtn, 00FFFFFFh
ret
render_champion:
invoke DrawBoxBorder, 18, 70, 284, 86, 00332200h, 00FFD700h, 2
invoke DrawString8x8, 40, 82, OFFSET towerChampTitle, 00FFE066h
invoke DrawString8x8, 56, 100, OFFSET towerChampSubtitle, 00FFFFFFh
invoke DrawString8x8, 36, 122, OFFSET towerPrizeText, 0066FF66h
invoke DrawBoxBorder, 32, 174, 256, 26, 00443300h, 00FFCC00h, 1
invoke DrawString8x8, 48, 183, OFFSET towerReturnBtn, 00FFFFFFh
ret
RenderHellTower3D ENDP
RenderTowerInGameBadge PROC
cmp tournamentMode, 1
jne badge_done
cmp engineMode, MODE_HELL_TOWER
je badge_done
cmp engineMode, MODE_WALK
je badge_done
invoke DrawBoxBorder, 4, 4, 96, 16, 00220404h, 00FF3333h, 1
invoke DrawString8x8, 8, 8, OFFSET towerHudBadge, 00FFAA55h
invoke FormatNumber, towerStage, OFFSET hudNumBuffer
invoke DrawString8x8, 64, 8, OFFSET hudNumBuffer, 00FFFFFFh
invoke DrawString8x8, 72, 8, OFFSET towerHudOfTen, 00AAAAAAh
badge_done:
ret
RenderTowerInGameBadge ENDP