2350 lines
60 KiB
Python
2350 lines
60 KiB
Python
# -*- coding: utf-8 -*-
|
||
# Generator for casino3d.inc (CP1251)
|
||
import sys
|
||
|
||
content = r'''
|
||
; ==============================================================================
|
||
; CASINO 2.5D ENGINE - MASM32 SOFTWARE RAYCASTER (CP1251)
|
||
; Unified with Full Console Casino Games via RunConsoleGameFrom3D
|
||
; ==============================================================================
|
||
|
||
includelib gdi32.lib
|
||
includelib winmm.lib
|
||
|
||
CreateWindowExA PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
|
||
RegisterClassExA PROTO :DWORD
|
||
DefWindowProcA PROTO :DWORD,:DWORD,:DWORD,:DWORD
|
||
ShowWindow PROTO :DWORD,:DWORD
|
||
UpdateWindow PROTO :DWORD
|
||
GetDC PROTO :DWORD
|
||
ReleaseDC PROTO :DWORD,:DWORD
|
||
StretchDIBits PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
|
||
PeekMessageA PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
|
||
TranslateMessage PROTO :DWORD
|
||
DispatchMessageA PROTO :DWORD
|
||
PostQuitMessage PROTO :DWORD
|
||
DestroyWindow PROTO :DWORD
|
||
SetWindowTextA PROTO :DWORD,:DWORD
|
||
SetForegroundWindow PROTO :DWORD
|
||
GetConsoleWindow PROTO
|
||
GetSystemMetrics PROTO :DWORD
|
||
CreateFileA PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
|
||
ReadFile PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
|
||
CloseHandle PROTO :DWORD
|
||
GetAsyncKeyState PROTO :DWORD
|
||
PlaySoundA PROTO :DWORD,:DWORD,:DWORD
|
||
GetModuleFileNameA PROTO :DWORD,:DWORD,:DWORD
|
||
Sleep PROTO :DWORD
|
||
|
||
C3D_POINT STRUCT
|
||
x dd ?
|
||
y dd ?
|
||
C3D_POINT ENDS
|
||
|
||
C3D_MSG STRUCT
|
||
hwnd dd ?
|
||
message dd ?
|
||
wParam dd ?
|
||
lParam dd ?
|
||
time dd ?
|
||
pt C3D_POINT <>
|
||
C3D_MSG ENDS
|
||
|
||
C3D_WNDCLASSEX STRUCT
|
||
cbSize dd ?
|
||
style dd ?
|
||
lpfnWndProc dd ?
|
||
cbClsExtra dd ?
|
||
cbWndExtra dd ?
|
||
hInstance dd ?
|
||
hIcon dd ?
|
||
hCursor dd ?
|
||
hbrBackground dd ?
|
||
lpszMenuName dd ?
|
||
lpszClassName dd ?
|
||
hIconSm dd ?
|
||
C3D_WNDCLASSEX ENDS
|
||
|
||
C3D_BITMAPINFOHEADER STRUCT
|
||
biSize dd ?
|
||
biWidth dd ?
|
||
biHeight dd ?
|
||
biPlanes dw ?
|
||
biBitCount dw ?
|
||
biCompression dd ?
|
||
biSizeImage dd ?
|
||
biXPelsPerMeter dd ?
|
||
biYPelsPerMeter dd ?
|
||
biClrUsed dd ?
|
||
biClrImportant dd ?
|
||
C3D_BITMAPINFOHEADER ENDS
|
||
|
||
C3D_BITMAPINFO STRUCT
|
||
bmiHeader C3D_BITMAPINFOHEADER <>
|
||
bmiColors dd ?
|
||
C3D_BITMAPINFO ENDS
|
||
|
||
SpriteObject STRUCT
|
||
posX dd ?
|
||
posY dd ?
|
||
baseTexId dd ?
|
||
frameCount dd ?
|
||
curFrame dd ?
|
||
animTimer dd ?
|
||
animSpeed dd ?
|
||
interactId dd ?
|
||
promptPtr dd ?
|
||
distSq dd ?
|
||
SpriteObject ENDS
|
||
|
||
SCREEN_W equ 640
|
||
SCREEN_H equ 480
|
||
HALF_W equ 320
|
||
HALF_H equ 240
|
||
SCREEN_SIZE equ (SCREEN_W * SCREEN_H)
|
||
WIN_SCALE equ 1
|
||
WINDOW_W equ (SCREEN_W * WIN_SCALE)
|
||
WINDOW_H equ (SCREEN_H * WIN_SCALE)
|
||
|
||
FP_SHIFT equ 16
|
||
FP_1 equ 65536
|
||
FP_HALF equ 32768
|
||
|
||
MODE_WALK equ 0
|
||
|
||
NUM_SPRITES equ 28
|
||
|
||
CS_HREDRAW equ 2
|
||
CS_VREDRAW equ 1
|
||
PM_REMOVE equ 1
|
||
WM_QUIT equ 12h
|
||
WM_CLOSE equ 10h
|
||
WM_DESTROY equ 2
|
||
WS_OVERLAPPEDWINDOW equ 00CF0000h
|
||
WS_VISIBLE equ 10000000h
|
||
DIB_RGB_COLORS equ 0
|
||
SRCCOPY equ 00CC0020h
|
||
GENERIC_READ equ 80000000h
|
||
FILE_ATTRIBUTE_NORMAL equ 80h
|
||
OPEN_EXISTING equ 3
|
||
INVALID_FILE_HANDLE equ -1
|
||
|
||
include casino3d_data.inc
|
||
include font8x8.inc
|
||
include src_graphics\platform_data.inc
|
||
|
||
.data
|
||
ALIGN 4
|
||
h3DInst dd 0
|
||
h3DWnd dd 0
|
||
h3DDC dd 0
|
||
|
||
engineMode dd MODE_WALK
|
||
rngSeed3D dd 12345678h
|
||
bmi3D C3D_BITMAPINFO <>
|
||
msg3D C3D_MSG <>
|
||
wc3D C3D_WNDCLASSEX <>
|
||
|
||
sz3DClassName db "Casino3DRetroClass",0
|
||
sz3DWindowTitle db "Assembler Casino - 2.5D Lobby",0
|
||
szTexturesRelPath db "assets\textures\casino3d-hd.bin",0
|
||
szTexturesFullPath db 260 dup(0)
|
||
|
||
soundCoin db "assets\audio\b05e1ac8be34248.wav",0
|
||
soundJackpot db "assets\audio\hakari_dance.wav",0
|
||
soundClick db "assets\audio\toy-gun-revolver-close-chamber-spin_f1ruc5nd.wav",0
|
||
|
||
playerX dd (16 * FP_1 + FP_HALF)
|
||
playerY dd (16 * FP_1 + FP_HALF)
|
||
playerAngle dd 384
|
||
playerDirX dd 0
|
||
playerDirY dd 0
|
||
playerPlaneX dd 0
|
||
playerPlaneY dd 0
|
||
|
||
casinoSprites SpriteObject NUM_SPRITES dup(<>)
|
||
sortedSprites dd NUM_SPRITES dup(0)
|
||
|
||
interactTargetId dd 0
|
||
interactPromptPtr dd 0
|
||
dancerLuckBuff dd 0
|
||
flashTimer dd 0
|
||
flashMessage db 128 dup(0)
|
||
|
||
; Russian CP1251 Interaction Prompts
|
||
promptDancer1 db "[E] Кабаре: Чаевые $100 (+Бафф удачи)",0
|
||
promptDancer2 db "[E] Главная сцена: Чаевые $100 (+Удача)",0
|
||
promptDancer3 db "[E] VIP-Кабаре: Чаевые $100 (+Бафф удачи)",0
|
||
promptBlackjack db "[E] Стол: 21 / Блэкджек",0
|
||
promptPoker db "[E] Стол: Покер (Техасский Холдем)",0
|
||
promptCasinoRoul db "[E] Стол: Казино-Рулетка (Европейская)",0
|
||
promptRoulette db "[E] Стол: Классическая Рулетка",0
|
||
promptSlot777 db "[E] Автомат: Слоты 777 (Классика)",0
|
||
promptSlotClover db "[E] Автомат: CloverPit (Слоты 5х3)",0
|
||
promptSlotClassic db "[E] Автомат: Джекпот 777",0
|
||
promptUmamusume db "[E] Аркада: Скачки Umamusume Derby",0
|
||
promptSkillCheck db "[E] Аркада: DBD Skill Check (Крюк)",0
|
||
promptATM db "[E] Кассир / Банкомат (Смена профиля)",0
|
||
promptShop db "[E] VIP-Бутик: Рубашки карт и талисманы",0
|
||
promptOnline db "[E] Терминал: Онлайн Казино (Radmin VPN)",0
|
||
promptAchieve db "[E] Зал Славы: Достижения и награды",0
|
||
promptStats db "[E] Табло: Статистика по всем играм",0
|
||
promptDurak db "[E] Подпольный стол: Игра в Дурака",0
|
||
promptBuckshot db "[E] Подпольный стол: Buckshot Roulette",0
|
||
promptRussRoul db "[E] Подпольный стол: Русская Рулетка",0
|
||
promptDice db "[E] Стол: Кости (Craps)",0
|
||
promptSkulls db "[E] Стол: Черепа и Шарик",0
|
||
promptCoin db "[E] Стол: Монетка (Орел / Решка)",0
|
||
promptTraining db "[E] Стол: Режим тренировки",0
|
||
promptObserver db "[E] Стол: Наблюдатель (ИИ против ИИ)",0
|
||
promptDaily db "[E] Доска: Ежедневные задания",0
|
||
promptSettings db "[E] Терминал: Настройки игры",0
|
||
promptHell db "[E] Портал: Адская Башня (Этаж 666)",0
|
||
|
||
msgDancerTipped db "Вы дали $100 чаевых! Удача казино на вашей стороне!",0
|
||
msgNeedMoney db "Недостаточно фишек в банке!",0
|
||
msgGameReturned db "Вы вернулись в зал казино. Баланс сохранен!",0
|
||
|
||
; HUD and Pause Texts (CP1251)
|
||
textBankHUD db "БАНК: $",0
|
||
textPlayerHUD db "ИГРОК: ",0
|
||
textControlsHUD db "W/S: ВПЕРЕД/НАЗАД A/D: ПОВОРОТ E: ДЕЙСТВИЕ",0
|
||
textWindowKeysHUD db "F11: ЭКРАН ESC: МЕНЮ",0
|
||
|
||
textPauseTitle db "=== КАЗИНО НА ПАУЗЕ ===",0
|
||
textPauseResume db "ESC - ПРОДОЛЖИТЬ ИГРУ",0
|
||
textPauseMenu db "M - ГЛАВНОЕ МЕНЮ (КОНСОЛЬ)",0
|
||
textPauseQuit db "Q - СОХРАНИТЬ И ВЫЙТИ",0
|
||
|
||
ALIGN 4
|
||
screenBuffer dd SCREEN_SIZE dup(?)
|
||
ALIGN 4
|
||
zBuffer dd SCREEN_W dup(?)
|
||
ALIGN 4
|
||
texturesBuffer dd (48 * 128 * 128) dup(?)
|
||
|
||
hudNumBuffer db 32 dup(?)
|
||
|
||
.code
|
||
|
||
; --- 3D Window Procedure ---
|
||
Casino3DWndProc PROC hwnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
|
||
invoke WindowEvents3D, hwnd, uMsg, wParam, lParam
|
||
ret
|
||
Casino3DWndProc ENDP
|
||
|
||
; --- PRNG ---
|
||
RandomRange3D PROC maxVal:DWORD
|
||
push edx
|
||
push ecx
|
||
mov eax, rngSeed3D
|
||
imul eax, 1103515245
|
||
add eax, 12345
|
||
mov rngSeed3D, eax
|
||
shr eax, 16
|
||
and eax, 7FFFh
|
||
xor edx, edx
|
||
mov ecx, maxVal
|
||
test ecx, ecx
|
||
jz rr3d_zero
|
||
div ecx
|
||
mov eax, edx
|
||
rr3d_zero:
|
||
pop ecx
|
||
pop edx
|
||
ret
|
||
RandomRange3D ENDP
|
||
|
||
; --- Helper: Copy String ---
|
||
CopyString3D PROC src:DWORD, dst:DWORD
|
||
push esi
|
||
push edi
|
||
mov esi, src
|
||
mov edi, dst
|
||
cs3d_loop:
|
||
mov al, [esi]
|
||
mov [edi], al
|
||
test al, al
|
||
jz cs3d_done
|
||
inc esi
|
||
inc edi
|
||
jmp cs3d_loop
|
||
cs3d_done:
|
||
pop edi
|
||
pop esi
|
||
ret
|
||
CopyString3D ENDP
|
||
|
||
; --- Format Unsigned Integer to String ---
|
||
FormatNumber PROC num:DWORD, buf:DWORD
|
||
push ebx
|
||
push ecx
|
||
push edx
|
||
push edi
|
||
mov eax, num
|
||
mov edi, buf
|
||
test eax, eax
|
||
jnz fn_start
|
||
mov BYTE PTR [edi], '0'
|
||
mov BYTE PTR [edi+1], 0
|
||
pop edi
|
||
pop edx
|
||
pop ecx
|
||
pop ebx
|
||
ret
|
||
fn_start:
|
||
xor ecx, ecx
|
||
fn_div_loop:
|
||
test eax, eax
|
||
jz fn_write_loop
|
||
xor edx, edx
|
||
mov ebx, 10
|
||
div ebx
|
||
add dl, '0'
|
||
push edx
|
||
inc ecx
|
||
jmp fn_div_loop
|
||
fn_write_loop:
|
||
test ecx, ecx
|
||
jz fn_done
|
||
pop edx
|
||
mov [edi], dl
|
||
inc edi
|
||
dec ecx
|
||
jmp fn_write_loop
|
||
fn_done:
|
||
mov BYTE PTR [edi], 0
|
||
pop edi
|
||
pop edx
|
||
pop ecx
|
||
pop ebx
|
||
ret
|
||
FormatNumber ENDP
|
||
|
||
; --- Fast 2D Drawing Primitives (Scaled 2x to 640x480) ---
|
||
DrawBox PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
|
||
|
||
DrawPixel PROC x:DWORD, y:DWORD, color:DWORD
|
||
invoke DrawBox, x, y, 1, 1, color
|
||
ret
|
||
DrawPixel ENDP
|
||
|
||
DrawBox PROC x:DWORD, y:DWORD, w:DWORD, h:DWORD, color:DWORD
|
||
shl x, 1
|
||
shl y, 1
|
||
shl w, 1
|
||
shl h, 1
|
||
push ebx
|
||
push esi
|
||
push edi
|
||
|
||
mov eax, x
|
||
cmp eax, SCREEN_W
|
||
jge box_done
|
||
mov ecx, y
|
||
cmp ecx, SCREEN_H
|
||
jge box_done
|
||
|
||
mov esi, w
|
||
mov edi, h
|
||
|
||
mov eax, x
|
||
add eax, esi
|
||
cmp eax, SCREEN_W
|
||
jle @F
|
||
mov eax, SCREEN_W
|
||
sub eax, x
|
||
mov esi, eax
|
||
@@:
|
||
mov eax, y
|
||
add eax, edi
|
||
cmp eax, SCREEN_H
|
||
jle @F
|
||
mov eax, SCREEN_H
|
||
sub eax, y
|
||
mov edi, eax
|
||
@@:
|
||
test esi, esi
|
||
jle box_done
|
||
test edi, edi
|
||
jle box_done
|
||
|
||
mov edx, color
|
||
mov ecx, y
|
||
box_y_loop:
|
||
mov ebx, ecx
|
||
imul ebx, SCREEN_W
|
||
add ebx, x
|
||
push ecx
|
||
push edi
|
||
mov ecx, esi
|
||
lea edi, [screenBuffer + ebx*4]
|
||
mov eax, edx
|
||
rep stosd
|
||
pop edi
|
||
pop ecx
|
||
inc ecx
|
||
dec edi
|
||
jnz box_y_loop
|
||
|
||
box_done:
|
||
pop edi
|
||
pop esi
|
||
pop ebx
|
||
ret
|
||
DrawBox ENDP
|
||
|
||
DrawBoxBorder PROC uses ebx x:DWORD, y:DWORD, w:DWORD, h:DWORD, fillColor:DWORD, borderColor:DWORD, bWidth:DWORD
|
||
invoke DrawBox, x, y, w, h, borderColor
|
||
mov eax, x
|
||
add eax, bWidth
|
||
mov ecx, y
|
||
add ecx, bWidth
|
||
mov edx, w
|
||
mov ebx, bWidth
|
||
shl ebx, 1
|
||
sub edx, ebx
|
||
mov ebx, h
|
||
sub ebx, bWidth
|
||
sub ebx, bWidth
|
||
invoke DrawBox, eax, ecx, edx, ebx, fillColor
|
||
ret
|
||
DrawBoxBorder ENDP
|
||
|
||
DrawCircle PROC cxVal:DWORD, cyVal:DWORD, radius:DWORD, color:DWORD
|
||
local x:DWORD
|
||
local y:DWORD
|
||
local r2:DWORD
|
||
local dist2:DWORD
|
||
push ebx
|
||
push esi
|
||
push edi
|
||
|
||
mov eax, radius
|
||
imul eax, eax
|
||
mov r2, eax
|
||
|
||
mov eax, radius
|
||
neg eax
|
||
mov y, eax
|
||
circ_y:
|
||
mov eax, y
|
||
cmp eax, radius
|
||
jg circ_done
|
||
|
||
mov eax, radius
|
||
neg eax
|
||
mov x, eax
|
||
circ_x:
|
||
mov eax, x
|
||
cmp eax, radius
|
||
jg circ_next_y
|
||
|
||
mov eax, x
|
||
imul eax, eax
|
||
mov ebx, y
|
||
imul ebx, ebx
|
||
add eax, ebx
|
||
cmp eax, r2
|
||
jg circ_next_x
|
||
|
||
mov eax, cxVal
|
||
add eax, x
|
||
mov ecx, cyVal
|
||
add ecx, y
|
||
invoke DrawPixel, eax, ecx, color
|
||
|
||
circ_next_x:
|
||
inc x
|
||
jmp circ_x
|
||
|
||
circ_next_y:
|
||
inc y
|
||
jmp circ_y
|
||
|
||
circ_done:
|
||
pop edi
|
||
pop esi
|
||
pop ebx
|
||
ret
|
||
DrawCircle ENDP
|
||
|
||
DrawChar8x8 PROC uses ebx esi edi x:DWORD, y:DWORD, chVal:DWORD, color:DWORD
|
||
local column:DWORD
|
||
mov eax, chVal
|
||
and eax, 255
|
||
lea esi, [font8x8 + eax*8]
|
||
xor edi, edi
|
||
glyph_row:
|
||
movzx ebx, BYTE PTR [esi+edi]
|
||
mov column, 0
|
||
glyph_col:
|
||
test ebx, 80h
|
||
jz glyph_next
|
||
mov eax, x
|
||
add eax, column
|
||
mov edx, y
|
||
add edx, edi
|
||
invoke DrawPixel, eax, edx, color
|
||
glyph_next:
|
||
shl ebx, 1
|
||
inc column
|
||
cmp column, 8
|
||
jl glyph_col
|
||
inc edi
|
||
cmp edi, 8
|
||
jl glyph_row
|
||
ret
|
||
DrawChar8x8 ENDP
|
||
|
||
DrawString8x8 PROC x:DWORD, y:DWORD, strPtr:DWORD, color:DWORD
|
||
push ebx
|
||
push esi
|
||
mov esi, strPtr
|
||
mov ebx, x
|
||
str_loop:
|
||
movzx eax, BYTE PTR [esi]
|
||
test al, al
|
||
jz str_done
|
||
invoke DrawChar8x8, ebx, y, eax, color
|
||
add ebx, 8
|
||
inc esi
|
||
jmp str_loop
|
||
str_done:
|
||
pop esi
|
||
pop ebx
|
||
ret
|
||
DrawString8x8 ENDP
|
||
|
||
; --- Render 3D Ceiling and Floor ---
|
||
RenderCeilingAndFloor PROC uses ebx esi edi
|
||
local floorRow:DWORD
|
||
local pDist:DWORD
|
||
local fStepX:DWORD
|
||
local fStepY:DWORD
|
||
local fX:DWORD
|
||
local fY:DWORD
|
||
local shade:DWORD
|
||
local cShade:DWORD
|
||
|
||
mov edi, HALF_H
|
||
floor_scanlines:
|
||
cmp edi, SCREEN_H
|
||
jge floor_done
|
||
mov floorRow, edi
|
||
|
||
mov eax, edi
|
||
sub eax, HALF_H
|
||
inc eax
|
||
mov ecx, eax
|
||
mov eax, HALF_H * FP_1
|
||
cdq
|
||
idiv ecx
|
||
mov pDist, eax
|
||
|
||
mov edx, pDist
|
||
shr edx, 13
|
||
mov eax, 255
|
||
sub eax, edx
|
||
cmp eax, 35
|
||
jge @F
|
||
mov eax, 35
|
||
@@:
|
||
mov shade, eax
|
||
mov edx, eax
|
||
sub edx, 25
|
||
cmp edx, 20
|
||
jge @F
|
||
mov edx, 20
|
||
@@:
|
||
mov cShade, edx
|
||
|
||
mov eax, playerPlaneX
|
||
shl eax, 1
|
||
imul pDist
|
||
shrd eax, edx, 16
|
||
cdq
|
||
mov ecx, SCREEN_W
|
||
idiv ecx
|
||
mov fStepX, eax
|
||
|
||
mov eax, playerPlaneY
|
||
shl eax, 1
|
||
imul pDist
|
||
shrd eax, edx, 16
|
||
cdq
|
||
mov ecx, SCREEN_W
|
||
idiv ecx
|
||
mov fStepY, eax
|
||
|
||
mov eax, playerDirX
|
||
sub eax, playerPlaneX
|
||
imul pDist
|
||
shrd eax, edx, 16
|
||
add eax, playerX
|
||
mov fX, eax
|
||
|
||
mov eax, playerDirY
|
||
sub eax, playerPlaneY
|
||
imul pDist
|
||
shrd eax, edx, 16
|
||
add eax, playerY
|
||
mov fY, eax
|
||
|
||
xor esi, esi
|
||
col_floor_loop:
|
||
cmp esi, SCREEN_W
|
||
jge next_floor_row
|
||
|
||
; Floor Texture: Carpet (Slot 0 in casino3d-hd.bin)
|
||
mov eax, fX
|
||
shr eax, 9
|
||
and eax, 127
|
||
mov edx, fY
|
||
shr edx, 9
|
||
and edx, 127
|
||
shl edx, 7
|
||
add edx, eax
|
||
|
||
mov eax, [texturesBuffer + (0 * 128 * 128 * 4) + edx*4]
|
||
|
||
; Shade Floor RGB
|
||
mov ebx, shade
|
||
movzx ecx, al
|
||
imul ecx, ebx
|
||
shr ecx, 8
|
||
push ecx
|
||
|
||
movzx ecx, ah
|
||
imul ecx, ebx
|
||
shr ecx, 8
|
||
shl ecx, 8
|
||
|
||
shr eax, 16
|
||
movzx eax, al
|
||
imul eax, ebx
|
||
shr eax, 8
|
||
shl eax, 16
|
||
or eax, ecx
|
||
pop ecx
|
||
or eax, ecx
|
||
|
||
mov ecx, floorRow
|
||
imul ecx, SCREEN_W
|
||
add ecx, esi
|
||
mov [screenBuffer + ecx*4], eax
|
||
|
||
; Ceiling Texture: Recessed Lights (Slot 5)
|
||
mov eax, fX
|
||
shr eax, 10
|
||
and eax, 127
|
||
mov edx, fY
|
||
shr edx, 10
|
||
and edx, 127
|
||
shl edx, 7
|
||
add edx, eax
|
||
|
||
mov eax, [texturesBuffer + (5 * 128 * 128 * 4) + edx*4]
|
||
|
||
mov ebx, cShade
|
||
movzx ecx, al
|
||
imul ecx, ebx
|
||
shr ecx, 8
|
||
push ecx
|
||
|
||
movzx ecx, ah
|
||
imul ecx, ebx
|
||
shr ecx, 8
|
||
shl ecx, 8
|
||
|
||
shr eax, 16
|
||
movzx eax, al
|
||
imul eax, ebx
|
||
shr eax, 8
|
||
shl eax, 16
|
||
or eax, ecx
|
||
pop ecx
|
||
or eax, ecx
|
||
|
||
mov ecx, SCREEN_H - 1
|
||
sub ecx, floorRow
|
||
imul ecx, SCREEN_W
|
||
add ecx, esi
|
||
mov [screenBuffer + ecx*4], eax
|
||
|
||
mov eax, fStepX
|
||
add fX, eax
|
||
mov eax, fStepY
|
||
add fY, eax
|
||
|
||
inc esi
|
||
jmp col_floor_loop
|
||
|
||
next_floor_row:
|
||
inc edi
|
||
jmp floor_scanlines
|
||
|
||
floor_done:
|
||
ret
|
||
RenderCeilingAndFloor ENDP
|
||
|
||
; --- Render 3D Walls ---
|
||
RenderWalls PROC
|
||
local col:DWORD
|
||
local camX:DWORD
|
||
local rayDirX:DWORD
|
||
local rayDirY:DWORD
|
||
local mapX:DWORD
|
||
local mapY:DWORD
|
||
local deltaDistX:DWORD
|
||
local deltaDistY:DWORD
|
||
local stepX:DWORD
|
||
local stepY:DWORD
|
||
local sideDistX:DWORD
|
||
local sideDistY:DWORD
|
||
local side:DWORD
|
||
local perpWallDist:DWORD
|
||
local lineH:DWORD
|
||
local drawStart:DWORD
|
||
local drawEnd:DWORD
|
||
local wallHit:DWORD
|
||
local texX:DWORD
|
||
local texId:DWORD
|
||
local shade:DWORD
|
||
|
||
push ebx
|
||
push esi
|
||
push edi
|
||
|
||
mov eax, playerAngle
|
||
and eax, 511
|
||
mov ebx, [tableCos + eax*4]
|
||
mov playerDirX, ebx
|
||
mov ebx, [tableSin + eax*4]
|
||
mov playerDirY, ebx
|
||
|
||
mov eax, ebx
|
||
imul eax, -66
|
||
cdq
|
||
mov ecx, 100
|
||
idiv ecx
|
||
mov playerPlaneX, eax
|
||
|
||
mov eax, playerDirX
|
||
imul eax, 66
|
||
cdq
|
||
idiv ecx
|
||
mov playerPlaneY, eax
|
||
|
||
mov col, 0
|
||
col_loop:
|
||
cmp col, SCREEN_W
|
||
jge walls_done
|
||
|
||
mov eax, col
|
||
shl eax, 1
|
||
sub eax, SCREEN_W
|
||
imul eax, FP_1
|
||
cdq
|
||
mov ecx, SCREEN_W
|
||
idiv ecx
|
||
mov camX, eax
|
||
|
||
mov eax, playerPlaneX
|
||
imul camX
|
||
shrd eax, edx, 16
|
||
add eax, playerDirX
|
||
mov rayDirX, eax
|
||
|
||
mov eax, playerPlaneY
|
||
imul camX
|
||
shrd eax, edx, 16
|
||
add eax, playerDirY
|
||
mov rayDirY, eax
|
||
|
||
mov eax, playerX
|
||
sar eax, 16
|
||
mov mapX, eax
|
||
mov eax, playerY
|
||
sar eax, 16
|
||
mov mapY, eax
|
||
|
||
mov eax, rayDirX
|
||
test eax, eax
|
||
jnz calc_delta_x
|
||
mov deltaDistX, 7FFFFFFFh
|
||
jmp calc_delta_y
|
||
calc_delta_x:
|
||
test eax, eax
|
||
jns @F
|
||
neg eax
|
||
@@:
|
||
mov ebx, eax
|
||
xor eax, eax
|
||
mov edx, 1
|
||
idiv ebx
|
||
mov deltaDistX, eax
|
||
|
||
calc_delta_y:
|
||
mov eax, rayDirY
|
||
test eax, eax
|
||
jnz calc_delta_y_act
|
||
mov deltaDistY, 7FFFFFFFh
|
||
jmp calc_steps
|
||
calc_delta_y_act:
|
||
test eax, eax
|
||
jns @F
|
||
neg eax
|
||
@@:
|
||
mov ebx, eax
|
||
xor eax, eax
|
||
mov edx, 1
|
||
idiv ebx
|
||
mov deltaDistY, eax
|
||
|
||
calc_steps:
|
||
cmp rayDirX, 0
|
||
jge step_x_pos
|
||
mov stepX, -1
|
||
mov eax, playerX
|
||
mov edx, mapX
|
||
shl edx, 16
|
||
sub eax, edx
|
||
imul deltaDistX
|
||
shrd eax, edx, 16
|
||
mov sideDistX, eax
|
||
jmp check_step_y
|
||
step_x_pos:
|
||
mov stepX, 1
|
||
mov eax, mapX
|
||
inc eax
|
||
shl eax, 16
|
||
sub eax, playerX
|
||
imul deltaDistX
|
||
shrd eax, edx, 16
|
||
mov sideDistX, eax
|
||
|
||
check_step_y:
|
||
cmp rayDirY, 0
|
||
jge step_y_pos
|
||
mov stepY, -1
|
||
mov eax, playerY
|
||
mov edx, mapY
|
||
shl edx, 16
|
||
sub eax, edx
|
||
imul deltaDistY
|
||
shrd eax, edx, 16
|
||
mov sideDistY, eax
|
||
jmp dda_start
|
||
step_y_pos:
|
||
mov stepY, 1
|
||
mov eax, mapY
|
||
inc eax
|
||
shl eax, 16
|
||
sub eax, playerY
|
||
imul deltaDistY
|
||
shrd eax, edx, 16
|
||
mov sideDistY, eax
|
||
|
||
dda_start:
|
||
xor ecx, ecx
|
||
dda_step_loop:
|
||
inc ecx
|
||
cmp ecx, 64
|
||
jge hit_wall
|
||
|
||
mov eax, sideDistX
|
||
cmp eax, sideDistY
|
||
jge step_in_y
|
||
|
||
mov eax, deltaDistX
|
||
add sideDistX, eax
|
||
mov eax, stepX
|
||
add mapX, eax
|
||
mov side, 0
|
||
jmp check_tile
|
||
|
||
step_in_y:
|
||
mov eax, deltaDistY
|
||
add sideDistY, eax
|
||
mov eax, stepY
|
||
add mapY, eax
|
||
mov side, 1
|
||
|
||
check_tile:
|
||
cmp mapX, 0
|
||
jl hit_wall
|
||
cmp mapX, MAP_WIDTH
|
||
jge hit_wall
|
||
cmp mapY, 0
|
||
jl hit_wall
|
||
cmp mapY, MAP_HEIGHT
|
||
jge hit_wall
|
||
|
||
mov eax, mapY
|
||
shl eax, 5
|
||
add eax, mapX
|
||
movzx eax, BYTE PTR [casinoMap + eax]
|
||
test eax, eax
|
||
jnz hit_wall
|
||
jmp dda_step_loop
|
||
|
||
hit_wall:
|
||
cmp side, 0
|
||
jne perp_y
|
||
mov eax, sideDistX
|
||
sub eax, deltaDistX
|
||
mov perpWallDist, eax
|
||
jmp perp_done
|
||
perp_y:
|
||
mov eax, sideDistY
|
||
sub eax, deltaDistY
|
||
mov perpWallDist, eax
|
||
|
||
perp_done:
|
||
cmp perpWallDist, 2048
|
||
jge @F
|
||
mov perpWallDist, 2048
|
||
@@:
|
||
mov eax, col
|
||
mov edx, perpWallDist
|
||
mov [zBuffer + eax*4], edx
|
||
|
||
mov eax, SCREEN_H
|
||
imul eax, FP_1
|
||
cdq
|
||
idiv perpWallDist
|
||
mov lineH, eax
|
||
|
||
mov eax, lineH
|
||
shr eax, 1
|
||
mov ecx, HALF_H
|
||
sub ecx, eax
|
||
mov drawStart, ecx
|
||
|
||
mov eax, lineH
|
||
shr eax, 1
|
||
mov ecx, HALF_H
|
||
add ecx, eax
|
||
mov drawEnd, ecx
|
||
|
||
cmp side, 0
|
||
jne hit_side_y
|
||
mov eax, perpWallDist
|
||
imul rayDirY
|
||
shrd eax, edx, 16
|
||
add eax, playerY
|
||
mov wallHit, eax
|
||
jmp calc_tex_x
|
||
hit_side_y:
|
||
mov eax, perpWallDist
|
||
imul rayDirX
|
||
shrd eax, edx, 16
|
||
add eax, playerX
|
||
mov wallHit, eax
|
||
|
||
calc_tex_x:
|
||
mov eax, wallHit
|
||
and eax, 0FFFFh
|
||
imul eax, 128
|
||
shr eax, 16
|
||
mov texX, eax
|
||
|
||
cmp side, 0
|
||
jne check_flip_y
|
||
cmp rayDirX, 0
|
||
jle get_tex_id
|
||
mov eax, 127
|
||
sub eax, texX
|
||
mov texX, eax
|
||
jmp get_tex_id
|
||
check_flip_y:
|
||
cmp rayDirY, 0
|
||
jge get_tex_id
|
||
mov eax, 127
|
||
sub eax, texX
|
||
mov texX, eax
|
||
|
||
get_tex_id:
|
||
mov eax, mapY
|
||
shl eax, 5
|
||
add eax, mapX
|
||
movzx eax, BYTE PTR [casinoMap + eax]
|
||
test eax, eax
|
||
jnz @F
|
||
mov eax, 1
|
||
@@:
|
||
mov texId, eax
|
||
|
||
mov edx, perpWallDist
|
||
shr edx, 12
|
||
mov eax, 255
|
||
sub eax, edx
|
||
cmp eax, 40
|
||
jge @F
|
||
mov eax, 40
|
||
@@:
|
||
cmp side, 1
|
||
jne @F
|
||
imul eax, 180
|
||
shr eax, 8
|
||
@@:
|
||
mov shade, eax
|
||
|
||
cmp drawStart, 0
|
||
jge @F
|
||
mov drawStart, 0
|
||
@@:
|
||
cmp drawEnd, SCREEN_H
|
||
jl @F
|
||
mov drawEnd, SCREEN_H - 1
|
||
@@:
|
||
|
||
mov edi, drawStart
|
||
mov esi, lineH
|
||
test esi, esi
|
||
jnz render_wall_pixels
|
||
mov esi, 1
|
||
|
||
render_wall_pixels:
|
||
cmp edi, drawEnd
|
||
jge next_wall_col
|
||
|
||
mov eax, edi
|
||
shl eax, 1
|
||
sub eax, SCREEN_H
|
||
add eax, lineH
|
||
imul eax, 128
|
||
cdq
|
||
mov ecx, lineH
|
||
shl ecx, 1
|
||
idiv ecx
|
||
and eax, 127
|
||
|
||
mov edx, eax
|
||
shl edx, 7
|
||
add edx, texX
|
||
|
||
mov eax, texId
|
||
imul eax, (128 * 128 * 4)
|
||
add eax, OFFSET texturesBuffer
|
||
mov eax, [eax + edx*4]
|
||
|
||
mov ebx, shade
|
||
movzx ecx, al
|
||
imul ecx, ebx
|
||
shr ecx, 8
|
||
push ecx
|
||
|
||
movzx ecx, ah
|
||
imul ecx, ebx
|
||
shr ecx, 8
|
||
shl ecx, 8
|
||
|
||
shr eax, 16
|
||
movzx eax, al
|
||
imul eax, ebx
|
||
shr eax, 8
|
||
shl eax, 16
|
||
or eax, ecx
|
||
pop ecx
|
||
or eax, ecx
|
||
|
||
mov ecx, edi
|
||
imul ecx, SCREEN_W
|
||
add ecx, col
|
||
mov [screenBuffer + ecx*4], eax
|
||
|
||
inc edi
|
||
jmp render_wall_pixels
|
||
|
||
next_wall_col:
|
||
inc col
|
||
jmp col_loop
|
||
|
||
walls_done:
|
||
pop edi
|
||
pop esi
|
||
pop ebx
|
||
ret
|
||
RenderWalls ENDP
|
||
|
||
; --- Render 3D Sprites with Depth Sorting ---
|
||
RenderSprites PROC
|
||
local sprIdx:DWORD
|
||
local relX:DWORD
|
||
local relY:DWORD
|
||
local invDet:DWORD
|
||
local transX:DWORD
|
||
local transY:DWORD
|
||
local sprScreenX:DWORD
|
||
local sprH:DWORD
|
||
local sprW:DWORD
|
||
local drawStartY:DWORD
|
||
local drawEndY:DWORD
|
||
local drawStartX:DWORD
|
||
local drawEndX:DWORD
|
||
local stripe:DWORD
|
||
local texX:DWORD
|
||
local texY:DWORD
|
||
local shade:DWORD
|
||
local texSlot:DWORD
|
||
|
||
push ebx
|
||
push esi
|
||
push edi
|
||
|
||
xor esi, esi
|
||
calc_dist_loop:
|
||
cmp esi, NUM_SPRITES
|
||
jge sort_sprites
|
||
mov eax, esi
|
||
imul eax, SIZEOF SpriteObject
|
||
|
||
mov edx, [casinoSprites + eax].posX
|
||
sub edx, playerX
|
||
sar edx, 8
|
||
imul edx, edx
|
||
mov ebx, edx
|
||
|
||
mov edx, [casinoSprites + eax].posY
|
||
sub edx, playerY
|
||
sar edx, 8
|
||
imul edx, edx
|
||
add ebx, edx
|
||
|
||
mov [casinoSprites + eax].distSq, ebx
|
||
mov [sortedSprites + esi*4], esi
|
||
inc esi
|
||
jmp calc_dist_loop
|
||
|
||
sort_sprites:
|
||
xor esi, esi
|
||
sort_outer:
|
||
cmp esi, NUM_SPRITES - 1
|
||
jge draw_sorted_sprites
|
||
mov edi, esi
|
||
inc edi
|
||
sort_inner:
|
||
cmp edi, NUM_SPRITES
|
||
jge sort_next_outer
|
||
|
||
mov eax, [sortedSprites + esi*4]
|
||
imul eax, SIZEOF SpriteObject
|
||
mov eax, [casinoSprites + eax].distSq
|
||
|
||
mov ebx, [sortedSprites + edi*4]
|
||
imul ebx, SIZEOF SpriteObject
|
||
mov ebx, [casinoSprites + ebx].distSq
|
||
|
||
cmp eax, ebx
|
||
jge sort_no_swap
|
||
|
||
mov eax, [sortedSprites + esi*4]
|
||
mov edx, [sortedSprites + edi*4]
|
||
mov [sortedSprites + esi*4], edx
|
||
mov [sortedSprites + edi*4], eax
|
||
|
||
sort_no_swap:
|
||
inc edi
|
||
jmp sort_inner
|
||
sort_next_outer:
|
||
inc esi
|
||
jmp sort_outer
|
||
|
||
draw_sorted_sprites:
|
||
xor esi, esi
|
||
spr_draw_loop:
|
||
cmp esi, NUM_SPRITES
|
||
jge sprites_done
|
||
mov sprIdx, esi
|
||
|
||
mov eax, [sortedSprites + esi*4]
|
||
imul eax, SIZEOF SpriteObject
|
||
mov edi, eax
|
||
|
||
mov eax, [casinoSprites + edi].posX
|
||
sub eax, playerX
|
||
mov relX, eax
|
||
|
||
mov eax, [casinoSprites + edi].posY
|
||
sub eax, playerY
|
||
mov relY, eax
|
||
|
||
mov eax, playerPlaneX
|
||
imul playerDirY
|
||
shrd eax, edx, 16
|
||
mov ebx, eax
|
||
|
||
mov eax, playerPlaneY
|
||
imul playerDirX
|
||
shrd eax, edx, 16
|
||
sub ebx, eax
|
||
test ebx, ebx
|
||
jnz @F
|
||
mov ebx, 1
|
||
@@:
|
||
mov invDet, ebx
|
||
|
||
mov eax, playerDirY
|
||
imul relX
|
||
shrd eax, edx, 16
|
||
mov ebx, eax
|
||
mov eax, playerDirX
|
||
imul relY
|
||
shrd eax, edx, 16
|
||
sub ebx, eax
|
||
mov eax, ebx
|
||
shl eax, 16
|
||
cdq
|
||
idiv invDet
|
||
mov transX, eax
|
||
|
||
mov eax, playerPlaneX
|
||
neg eax
|
||
imul relY
|
||
shrd eax, edx, 16
|
||
mov ebx, eax
|
||
mov eax, playerPlaneY
|
||
imul relX
|
||
shrd eax, edx, 16
|
||
add ebx, eax
|
||
mov eax, ebx
|
||
shl eax, 16
|
||
cdq
|
||
idiv invDet
|
||
mov transY, eax
|
||
|
||
cmp transY, 2048
|
||
jle next_sprite_iter
|
||
|
||
mov eax, HALF_W
|
||
mov edx, transX
|
||
shl edx, 8
|
||
cdq
|
||
idiv transY
|
||
add eax, HALF_W
|
||
mov sprScreenX, eax
|
||
|
||
mov eax, SCREEN_H
|
||
imul eax, FP_1
|
||
cdq
|
||
idiv transY
|
||
mov sprH, eax
|
||
|
||
mov drawStartY, HALF_H
|
||
mov eax, sprH
|
||
shr eax, 1
|
||
sub drawStartY, eax
|
||
cmp drawStartY, 0
|
||
jge @F
|
||
mov drawStartY, 0
|
||
@@:
|
||
mov drawEndY, HALF_H
|
||
mov eax, sprH
|
||
shr eax, 1
|
||
add drawEndY, eax
|
||
cmp drawEndY, SCREEN_H
|
||
jl @F
|
||
mov drawEndY, SCREEN_H - 1
|
||
@@:
|
||
|
||
mov eax, sprH
|
||
mov sprW, eax
|
||
|
||
mov eax, sprScreenX
|
||
mov drawStartX, eax
|
||
mov eax, sprW
|
||
shr eax, 1
|
||
sub drawStartX, eax
|
||
cmp drawStartX, 0
|
||
jge @F
|
||
mov drawStartX, 0
|
||
@@:
|
||
mov eax, sprScreenX
|
||
mov drawEndX, eax
|
||
mov eax, sprW
|
||
shr eax, 1
|
||
add drawEndX, eax
|
||
cmp drawEndX, SCREEN_W
|
||
jl @F
|
||
mov drawEndX, SCREEN_W - 1
|
||
@@:
|
||
|
||
mov edx, transY
|
||
shr edx, 12
|
||
mov eax, 255
|
||
sub eax, edx
|
||
cmp eax, 40
|
||
jge @F
|
||
mov eax, 40
|
||
@@:
|
||
mov shade, eax
|
||
|
||
mov eax, [casinoSprites + edi].baseTexId
|
||
add eax, [casinoSprites + edi].curFrame
|
||
mov texSlot, eax
|
||
|
||
mov eax, [casinoSprites + edi].frameCount
|
||
cmp eax, 1
|
||
jle skip_anim
|
||
mov eax, [casinoSprites + edi].animTimer
|
||
inc eax
|
||
mov [casinoSprites + edi].animTimer, eax
|
||
cmp eax, [casinoSprites + edi].animSpeed
|
||
jl skip_anim
|
||
mov [casinoSprites + edi].animTimer, 0
|
||
mov eax, [casinoSprites + edi].curFrame
|
||
inc eax
|
||
cmp eax, [casinoSprites + edi].frameCount
|
||
jl @F
|
||
xor eax, eax
|
||
@@:
|
||
mov [casinoSprites + edi].curFrame, eax
|
||
skip_anim:
|
||
|
||
mov ecx, drawStartX
|
||
mov stripe, ecx
|
||
stripe_loop:
|
||
mov ecx, stripe
|
||
cmp ecx, drawEndX
|
||
jge next_sprite_iter
|
||
|
||
mov eax, ecx
|
||
shl eax, 1
|
||
sub eax, sprScreenX
|
||
shl eax, 1
|
||
add eax, sprW
|
||
imul eax, 128
|
||
cdq
|
||
mov ebx, sprW
|
||
shl ebx, 1
|
||
test ebx, ebx
|
||
jnz @F
|
||
mov ebx, 1
|
||
@@:
|
||
idiv ebx
|
||
mov texX, eax
|
||
and texX, 127
|
||
|
||
cmp transY, 0
|
||
jle next_stripe
|
||
mov eax, stripe
|
||
cmp eax, 0
|
||
jl next_stripe
|
||
cmp eax, SCREEN_W
|
||
jge next_stripe
|
||
mov edx, [zBuffer + eax*4]
|
||
cmp transY, edx
|
||
jge next_stripe
|
||
|
||
mov edi, drawStartY
|
||
spr_pixel_loop:
|
||
cmp edi, drawEndY
|
||
jge next_stripe
|
||
|
||
mov eax, edi
|
||
shl eax, 1
|
||
sub eax, SCREEN_H
|
||
add eax, sprH
|
||
imul eax, 128
|
||
cdq
|
||
mov ebx, sprH
|
||
shl ebx, 1
|
||
test ebx, ebx
|
||
jnz @F
|
||
mov ebx, 1
|
||
@@:
|
||
idiv ebx
|
||
mov texY, eax
|
||
and texY, 127
|
||
|
||
mov edx, texY
|
||
shl edx, 7
|
||
add edx, texX
|
||
|
||
mov eax, texSlot
|
||
imul eax, (128 * 128 * 4)
|
||
add eax, OFFSET texturesBuffer
|
||
mov eax, [eax + edx*4]
|
||
|
||
; Alpha/Chroma Key Check (Magenta 0x00FF00FF and transparent black)
|
||
cmp eax, 00FF00FFh
|
||
je next_spr_y
|
||
test eax, eax
|
||
jz next_spr_y
|
||
|
||
mov ebx, shade
|
||
movzx ecx, al
|
||
imul ecx, ebx
|
||
shr ecx, 8
|
||
push ecx
|
||
|
||
movzx ecx, ah
|
||
imul ecx, ebx
|
||
shr ecx, 8
|
||
shl ecx, 8
|
||
|
||
shr eax, 16
|
||
movzx eax, al
|
||
imul eax, ebx
|
||
shr eax, 8
|
||
shl eax, 16
|
||
or eax, ecx
|
||
pop ecx
|
||
or eax, ecx
|
||
|
||
mov ecx, edi
|
||
imul ecx, SCREEN_W
|
||
add ecx, stripe
|
||
mov [screenBuffer + ecx*4], eax
|
||
|
||
next_spr_y:
|
||
inc edi
|
||
jmp spr_pixel_loop
|
||
|
||
next_stripe:
|
||
inc stripe
|
||
jmp stripe_loop
|
||
|
||
next_sprite_iter:
|
||
mov esi, sprIdx
|
||
inc esi
|
||
jmp spr_draw_loop
|
||
|
||
sprites_done:
|
||
pop edi
|
||
pop esi
|
||
pop ebx
|
||
ret
|
||
RenderSprites ENDP
|
||
|
||
; --- Render HUD (Russian CP1251) ---
|
||
RenderHUD PROC uses ebx esi edi
|
||
; Top Bar
|
||
invoke DrawBox, 0, 0, 320, 16, 0014191Dh
|
||
invoke DrawString8x8, 8, 4, OFFSET textBankHUD, 00D8BC6Ah
|
||
invoke FormatNumber, bankroll, OFFSET hudNumBuffer
|
||
invoke DrawString8x8, 56, 4, OFFSET hudNumBuffer, 00FFFFFFh
|
||
|
||
; Player Name
|
||
invoke DrawString8x8, 128, 4, OFFSET textPlayerHUD, 00D8BC6Ah
|
||
invoke DrawString8x8, 172, 4, OFFSET saveFileName, 0000D7FFh
|
||
|
||
; Screen Keys
|
||
invoke DrawString8x8, 252, 4, OFFSET textWindowKeysHUD, 00A8B6BBh
|
||
|
||
; Bottom Control Bar
|
||
invoke DrawBox, 0, 226, 320, 14, 0014191Dh
|
||
invoke DrawString8x8, 8, 230, OFFSET textControlsHUD, 00A8B6BBh
|
||
|
||
; Center Crosshair Dot
|
||
invoke DrawBox, 159, 118, 2, 5, 00E7DFC8h
|
||
invoke DrawBox, 157, 120, 6, 1, 00E7DFC8h
|
||
|
||
; Target Interaction Prompt (when close to a table/machine)
|
||
cmp interactPromptPtr, 0
|
||
je @F
|
||
invoke DrawBoxBorder, 4, 196, 312, 22, 0014191Dh, 00D8BC6Ah, 1
|
||
invoke DrawString8x8, 10, 203, interactPromptPtr, 00F5E2B0h
|
||
@@:
|
||
; Flash Notification Message
|
||
cmp flashTimer, 0
|
||
je hud_finished
|
||
dec flashTimer
|
||
invoke DrawBox, 4, 22, 312, 16, 0014191Dh
|
||
invoke DrawString8x8, 10, 26, OFFSET flashMessage, 00FFFFFFh
|
||
hud_finished:
|
||
ret
|
||
RenderHUD ENDP
|
||
|
||
; --- Render Radar Minimap ---
|
||
RenderMinimap PROC uses ebx esi edi
|
||
local radarX:DWORD
|
||
local radarY:DWORD
|
||
local radarSize:DWORD
|
||
|
||
mov radarX, 320 - 52
|
||
mov radarY, 20
|
||
mov radarSize, 48
|
||
|
||
invoke DrawBoxBorder, radarX, radarY, radarSize, radarSize, 00101510h, 0000D7FFh, 1
|
||
|
||
; Draw all 28 Sprites on radar
|
||
xor esi, esi
|
||
radar_spr_loop:
|
||
cmp esi, NUM_SPRITES
|
||
jge draw_player_radar
|
||
mov eax, esi
|
||
imul eax, SIZEOF SpriteObject
|
||
mov eax, [casinoSprites + eax].posX
|
||
sar eax, 16
|
||
imul eax, radarSize
|
||
shr eax, 5
|
||
add eax, radarX
|
||
mov ebx, eax
|
||
|
||
mov eax, esi
|
||
imul eax, SIZEOF SpriteObject
|
||
mov eax, [casinoSprites + eax].posY
|
||
sar eax, 16
|
||
imul eax, radarSize
|
||
shr eax, 5
|
||
add eax, radarY
|
||
|
||
invoke DrawPixel, ebx, eax, 00FFAA00h
|
||
inc esi
|
||
jmp radar_spr_loop
|
||
|
||
draw_player_radar:
|
||
mov eax, playerX
|
||
sar eax, 16
|
||
imul eax, radarSize
|
||
shr eax, 5
|
||
add eax, radarX
|
||
mov ebx, eax
|
||
|
||
mov eax, playerY
|
||
sar eax, 16
|
||
imul eax, radarSize
|
||
shr eax, 5
|
||
add eax, radarY
|
||
|
||
invoke DrawPixel, ebx, eax, 0000FF00h
|
||
ret
|
||
RenderMinimap ENDP
|
||
|
||
; --- Player Movement & Input ---
|
||
HandlePlayerInput PROC uses ebx esi edi
|
||
local nextX:DWORD
|
||
local nextY:DWORD
|
||
local speed:DWORD
|
||
|
||
mov speed, 131072
|
||
mov eax, deltaTime3D
|
||
imul eax, speed
|
||
mov ecx, 16
|
||
cdq
|
||
idiv ecx
|
||
mov speed, eax
|
||
|
||
; Turning A / D
|
||
xor eax, eax
|
||
cmp keys3D[41h], 0 ; A
|
||
jne @F
|
||
cmp keys3D[25h], 0 ; Left Arrow
|
||
je check_turn_right
|
||
@@:
|
||
mov eax, 6
|
||
sub playerAngle, eax
|
||
and playerAngle, 511
|
||
jmp input_forward
|
||
|
||
check_turn_right:
|
||
cmp keys3D[44h], 0 ; D
|
||
jne @F
|
||
cmp keys3D[27h], 0 ; Right Arrow
|
||
je input_forward
|
||
@@:
|
||
mov eax, 6
|
||
add playerAngle, eax
|
||
and playerAngle, 511
|
||
|
||
input_forward:
|
||
call UpdateCamera3D
|
||
xor edi, edi
|
||
cmp keys3D[57h], 0 ; W
|
||
jne input_go_forward
|
||
cmp keys3D[26h], 0 ; Up Arrow
|
||
je input_back
|
||
input_go_forward:
|
||
inc edi
|
||
input_back:
|
||
cmp keys3D[53h], 0 ; S
|
||
jne input_go_back
|
||
cmp keys3D[28h], 0 ; Down Arrow
|
||
je input_move
|
||
input_go_back:
|
||
dec edi
|
||
input_move:
|
||
test edi, edi
|
||
jz input_action
|
||
imul edi, speed
|
||
mov eax, playerDirX
|
||
imul edi
|
||
shrd eax, edx, 16
|
||
add eax, playerX
|
||
mov nextX, eax
|
||
mov eax, playerDirY
|
||
imul edi
|
||
shrd eax, edx, 16
|
||
add eax, playerY
|
||
mov nextY, eax
|
||
|
||
invoke CanWalk3D, nextX, playerY
|
||
test eax, eax
|
||
jz @F
|
||
mov eax, nextX
|
||
mov playerX, eax
|
||
@@:
|
||
invoke CanWalk3D, playerX, nextY
|
||
test eax, eax
|
||
jz input_action
|
||
mov eax, nextY
|
||
mov playerY, eax
|
||
|
||
input_action:
|
||
; Key E (0x45) or Space (0x20)
|
||
invoke Pressed3D, 45h
|
||
test eax, eax
|
||
jnz do_action
|
||
invoke Pressed3D, 20h
|
||
test eax, eax
|
||
jz @F
|
||
do_action:
|
||
call Trigger3DInteraction
|
||
@@:
|
||
ret
|
||
HandlePlayerInput ENDP
|
||
|
||
; --- Check Nearest Interactive Object ---
|
||
CheckInteractions PROC uses ebx esi edi
|
||
local nearest:DWORD
|
||
mov nearest, 360000 ; Detection radius squared (~2.4 tiles)
|
||
mov interactTargetId, 0
|
||
mov interactPromptPtr, 0
|
||
xor esi, esi
|
||
interaction_scan:
|
||
cmp esi, NUM_SPRITES
|
||
jge interaction_done
|
||
mov eax, esi
|
||
imul eax, SIZEOF SpriteObject
|
||
mov edi, eax
|
||
|
||
cmp [casinoSprites+edi].interactId, 0
|
||
je interaction_next
|
||
mov eax, [casinoSprites+edi].posX
|
||
sub eax, playerX
|
||
sar eax, 8
|
||
mov ebx, eax
|
||
imul ebx, ebx
|
||
|
||
mov eax, [casinoSprites+edi].posY
|
||
sub eax, playerY
|
||
sar eax, 8
|
||
imul eax, eax
|
||
add ebx, eax
|
||
|
||
cmp ebx, nearest
|
||
jae interaction_next
|
||
mov nearest, ebx
|
||
mov eax, [casinoSprites+edi].interactId
|
||
mov interactTargetId, eax
|
||
mov eax, [casinoSprites+edi].promptPtr
|
||
mov interactPromptPtr, eax
|
||
interaction_next:
|
||
inc esi
|
||
jmp interaction_scan
|
||
interaction_done:
|
||
ret
|
||
CheckInteractions ENDP
|
||
|
||
; --- Seamless Bridge: Launch Console Game from 3D ---
|
||
RunConsoleGameFrom3D PROC uses ebx esi edi gameProc:DWORD, gameId:DWORD
|
||
mov eax, gameId
|
||
mov currentGameId, eax
|
||
|
||
; Hide 3D window
|
||
cmp h3DWnd, 0
|
||
je @F
|
||
invoke ShowWindow, h3DWnd, SW_HIDE
|
||
@@:
|
||
|
||
; Show and maximize console window
|
||
cmp hCasinoConsole, 0
|
||
je run_call_target
|
||
invoke ShowWindow, hCasinoConsole, SW_MAXIMIZE
|
||
invoke SetForegroundWindow, hCasinoConsole
|
||
|
||
run_call_target:
|
||
; Run the target game procedure
|
||
mov eax, gameProc
|
||
call eax
|
||
|
||
; Save progress
|
||
call SaveGame
|
||
|
||
; Hide console window again
|
||
cmp hCasinoConsole, 0
|
||
je restore_3d_view
|
||
invoke ShowWindow, hCasinoConsole, SW_HIDE
|
||
|
||
restore_3d_view:
|
||
; Restore 3D window
|
||
cmp h3DWnd, 0
|
||
je flush_input_keys
|
||
invoke ShowWindow, h3DWnd, SW_SHOW
|
||
invoke SetForegroundWindow, h3DWnd
|
||
|
||
flush_input_keys:
|
||
lea edi, keys3D
|
||
xor eax, eax
|
||
mov ecx, 64
|
||
rep stosd
|
||
|
||
lea edi, pressedKeys3D
|
||
xor eax, eax
|
||
mov ecx, 64
|
||
rep stosd
|
||
|
||
invoke CopyString3D, OFFSET msgGameReturned, OFFSET flashMessage
|
||
mov flashTimer, 120
|
||
ret
|
||
RunConsoleGameFrom3D ENDP
|
||
|
||
; --- Trigger Interaction based on Target ID ---
|
||
Trigger3DInteraction PROC uses ebx esi edi
|
||
mov eax, interactTargetId
|
||
test eax, eax
|
||
jz trigger_exit
|
||
|
||
; 1: Blackjack / 21
|
||
cmp eax, 1
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET Game21, 1
|
||
ret
|
||
@@:
|
||
; 2: Poker (Texas Hold'em)
|
||
cmp eax, 2
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GamePoker, 2
|
||
ret
|
||
@@:
|
||
; 3: Slots 777 (Classic)
|
||
cmp eax, 3
|
||
jne @F
|
||
call PlaySlotIntroSound
|
||
invoke RunConsoleGameFrom3D, OFFSET GameClassicSlot, 9
|
||
ret
|
||
@@:
|
||
; 4: Slots CloverPit (5x3)
|
||
cmp eax, 4
|
||
jne @F
|
||
call PlaySlotIntroSound
|
||
invoke RunConsoleGameFrom3D, OFFSET GameSlot, 3
|
||
ret
|
||
@@:
|
||
; 5: Casino European Roulette
|
||
cmp eax, 5
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameCasinoRoulette, 8
|
||
ret
|
||
@@:
|
||
; 6: Classic Roulette
|
||
cmp eax, 6
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameRoulette, 4
|
||
ret
|
||
@@:
|
||
; 7: Durak (Дурак)
|
||
cmp eax, 7
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameDurak, 10
|
||
ret
|
||
@@:
|
||
; 8: Buckshot Roulette
|
||
cmp eax, 8
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameBuckshot, 0
|
||
ret
|
||
@@:
|
||
; 9: Russian Roulette (Подпольная)
|
||
cmp eax, 9
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameRoulette, 4
|
||
ret
|
||
@@:
|
||
; 10: Skulls and Cups (Черепа)
|
||
cmp eax, 10
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameSkulls, 5
|
||
ret
|
||
@@:
|
||
; 11: Dice (Кости)
|
||
cmp eax, 11
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameDice, 7
|
||
ret
|
||
@@:
|
||
; 12: Coin (Монетка)
|
||
cmp eax, 12
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameCoin, 6
|
||
ret
|
||
@@:
|
||
; 13: DBD Skill Check (Крюк)
|
||
cmp eax, 13
|
||
jne @F
|
||
mov tournamentMode, 0
|
||
invoke RunConsoleGameFrom3D, OFFSET GameSkillCheck, 11
|
||
ret
|
||
@@:
|
||
; 14: Umamusume Derby (Скачки)
|
||
cmp eax, 14
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameUmamusume, 0
|
||
ret
|
||
@@:
|
||
; 15: Hell Tower / Floor 666 (Адская Башня)
|
||
cmp eax, 15
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameTournament, 0
|
||
ret
|
||
@@:
|
||
; 16: Online Casino (Radmin VPN)
|
||
cmp eax, 16
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameOnlineCasino, 0
|
||
ret
|
||
@@:
|
||
; 17: VIP Boutique / Shop (Магазин рубашек и талисманов)
|
||
cmp eax, 17
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameShop, 0
|
||
ret
|
||
@@:
|
||
; 18: ATM / Cashier (Кассир / Банкомат)
|
||
cmp eax, 18
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET AccountMenu, 0
|
||
ret
|
||
@@:
|
||
; 19: Hall of Fame / Achievements (Достижения)
|
||
cmp eax, 19
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameAchievements, 0
|
||
ret
|
||
@@:
|
||
; 20: Stats Board (Табло статистики)
|
||
cmp eax, 20
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameStatsByGame, 0
|
||
ret
|
||
@@:
|
||
; 21: Daily Tasks (Ежедневные задания)
|
||
cmp eax, 21
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameDailyTasks, 0
|
||
ret
|
||
@@:
|
||
; 22: Settings (Настройки)
|
||
cmp eax, 22
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameSettings, 0
|
||
ret
|
||
@@:
|
||
; 23: Training Mode (Тренировка)
|
||
cmp eax, 23
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameTraining, 0
|
||
ret
|
||
@@:
|
||
; 24: Observer Mode (Наблюдатель ИИ)
|
||
cmp eax, 24
|
||
jne @F
|
||
invoke RunConsoleGameFrom3D, OFFSET GameObserver, 0
|
||
ret
|
||
@@:
|
||
; 25: Cabaret Dancers (Чаевые $100)
|
||
cmp eax, 25
|
||
jne trigger_exit
|
||
cmp bankroll, 100
|
||
jl dancer_no_cash
|
||
sub bankroll, 100
|
||
inc dancerLuckBuff
|
||
invoke CopyString3D, OFFSET msgDancerTipped, OFFSET flashMessage
|
||
mov flashTimer, 120
|
||
invoke PlaySoundA, OFFSET soundJackpot, 0, 1
|
||
call SaveGame
|
||
ret
|
||
dancer_no_cash:
|
||
invoke CopyString3D, OFFSET msgNeedMoney, OFFSET flashMessage
|
||
mov flashTimer, 60
|
||
ret
|
||
|
||
trigger_exit:
|
||
ret
|
||
Trigger3DInteraction ENDP
|
||
|
||
; --- Initialize 3D Engine & All 28 Sprites ---
|
||
Init3DEngine PROC
|
||
push ebx
|
||
push esi
|
||
push edi
|
||
|
||
call Create3DWindow
|
||
test eax, eax
|
||
jz init_failed
|
||
call LoadTextures3D
|
||
test eax, eax
|
||
jz init_failed
|
||
|
||
; --- 0: VIP Dancer 1 (Stage Left) ---
|
||
mov casinoSprites[0*SIZEOF SpriteObject].posX, (13 * FP_1 + FP_HALF)
|
||
mov casinoSprites[0*SIZEOF SpriteObject].posY, (4 * FP_1)
|
||
mov casinoSprites[0*SIZEOF SpriteObject].baseTexId, 10
|
||
mov casinoSprites[0*SIZEOF SpriteObject].frameCount, 12
|
||
mov casinoSprites[0*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[0*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[0*SIZEOF SpriteObject].animSpeed, 5
|
||
mov casinoSprites[0*SIZEOF SpriteObject].interactId, 25
|
||
mov casinoSprites[0*SIZEOF SpriteObject].promptPtr, OFFSET promptDancer1
|
||
|
||
; --- 1: VIP Dancer 2 (Center Stage) ---
|
||
mov casinoSprites[1*SIZEOF SpriteObject].posX, (16 * FP_1 + FP_HALF)
|
||
mov casinoSprites[1*SIZEOF SpriteObject].posY, (3 * FP_1 + FP_HALF)
|
||
mov casinoSprites[1*SIZEOF SpriteObject].baseTexId, 10
|
||
mov casinoSprites[1*SIZEOF SpriteObject].frameCount, 12
|
||
mov casinoSprites[1*SIZEOF SpriteObject].curFrame, 2
|
||
mov casinoSprites[1*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[1*SIZEOF SpriteObject].animSpeed, 5
|
||
mov casinoSprites[1*SIZEOF SpriteObject].interactId, 25
|
||
mov casinoSprites[1*SIZEOF SpriteObject].promptPtr, OFFSET promptDancer2
|
||
|
||
; --- 2: VIP Dancer 3 (Stage Right) ---
|
||
mov casinoSprites[2*SIZEOF SpriteObject].posX, (19 * FP_1 + FP_HALF)
|
||
mov casinoSprites[2*SIZEOF SpriteObject].posY, (4 * FP_1)
|
||
mov casinoSprites[2*SIZEOF SpriteObject].baseTexId, 10
|
||
mov casinoSprites[2*SIZEOF SpriteObject].frameCount, 12
|
||
mov casinoSprites[2*SIZEOF SpriteObject].curFrame, 1
|
||
mov casinoSprites[2*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[2*SIZEOF SpriteObject].animSpeed, 5
|
||
mov casinoSprites[2*SIZEOF SpriteObject].interactId, 25
|
||
mov casinoSprites[2*SIZEOF SpriteObject].promptPtr, OFFSET promptDancer3
|
||
|
||
; --- 3: Blackjack / 21 ---
|
||
mov casinoSprites[3*SIZEOF SpriteObject].posX, (12 * FP_1 + FP_HALF)
|
||
mov casinoSprites[3*SIZEOF SpriteObject].posY, (9 * FP_1)
|
||
mov casinoSprites[3*SIZEOF SpriteObject].baseTexId, 31
|
||
mov casinoSprites[3*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[3*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[3*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[3*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[3*SIZEOF SpriteObject].interactId, 1
|
||
mov casinoSprites[3*SIZEOF SpriteObject].promptPtr, OFFSET promptBlackjack
|
||
|
||
; --- 4: Poker (Texas Hold'em) ---
|
||
mov casinoSprites[4*SIZEOF SpriteObject].posX, (19 * FP_1 + FP_HALF)
|
||
mov casinoSprites[4*SIZEOF SpriteObject].posY, (9 * FP_1)
|
||
mov casinoSprites[4*SIZEOF SpriteObject].baseTexId, 35
|
||
mov casinoSprites[4*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[4*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[4*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[4*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[4*SIZEOF SpriteObject].interactId, 2
|
||
mov casinoSprites[4*SIZEOF SpriteObject].promptPtr, OFFSET promptPoker
|
||
|
||
; --- 5: Casino European Roulette ---
|
||
mov casinoSprites[5*SIZEOF SpriteObject].posX, (16 * FP_1 + FP_HALF)
|
||
mov casinoSprites[5*SIZEOF SpriteObject].posY, (9 * FP_1)
|
||
mov casinoSprites[5*SIZEOF SpriteObject].baseTexId, 32
|
||
mov casinoSprites[5*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[5*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[5*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[5*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[5*SIZEOF SpriteObject].interactId, 5
|
||
mov casinoSprites[5*SIZEOF SpriteObject].promptPtr, OFFSET promptCasinoRoul
|
||
|
||
; --- 6: Classic Roulette ---
|
||
mov casinoSprites[6*SIZEOF SpriteObject].posX, (16 * FP_1 + FP_HALF)
|
||
mov casinoSprites[6*SIZEOF SpriteObject].posY, (12 * FP_1)
|
||
mov casinoSprites[6*SIZEOF SpriteObject].baseTexId, 32
|
||
mov casinoSprites[6*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[6*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[6*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[6*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[6*SIZEOF SpriteObject].interactId, 6
|
||
mov casinoSprites[6*SIZEOF SpriteObject].promptPtr, OFFSET promptRoulette
|
||
|
||
; --- 7: Slots 777 (West Arcade) ---
|
||
mov casinoSprites[7*SIZEOF SpriteObject].posX, (5 * FP_1)
|
||
mov casinoSprites[7*SIZEOF SpriteObject].posY, (7 * FP_1)
|
||
mov casinoSprites[7*SIZEOF SpriteObject].baseTexId, 24
|
||
mov casinoSprites[7*SIZEOF SpriteObject].frameCount, 3
|
||
mov casinoSprites[7*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[7*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[7*SIZEOF SpriteObject].animSpeed, 6
|
||
mov casinoSprites[7*SIZEOF SpriteObject].interactId, 3
|
||
mov casinoSprites[7*SIZEOF SpriteObject].promptPtr, OFFSET promptSlot777
|
||
|
||
; --- 8: Slots CloverPit (5x3) ---
|
||
mov casinoSprites[8*SIZEOF SpriteObject].posX, (5 * FP_1)
|
||
mov casinoSprites[8*SIZEOF SpriteObject].posY, (10 * FP_1)
|
||
mov casinoSprites[8*SIZEOF SpriteObject].baseTexId, 24
|
||
mov casinoSprites[8*SIZEOF SpriteObject].frameCount, 3
|
||
mov casinoSprites[8*SIZEOF SpriteObject].curFrame, 1
|
||
mov casinoSprites[8*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[8*SIZEOF SpriteObject].animSpeed, 6
|
||
mov casinoSprites[8*SIZEOF SpriteObject].interactId, 4
|
||
mov casinoSprites[8*SIZEOF SpriteObject].promptPtr, OFFSET promptSlotClover
|
||
|
||
; --- 9: Classic Jackpot Slot ---
|
||
mov casinoSprites[9*SIZEOF SpriteObject].posX, (5 * FP_1)
|
||
mov casinoSprites[9*SIZEOF SpriteObject].posY, (13 * FP_1)
|
||
mov casinoSprites[9*SIZEOF SpriteObject].baseTexId, 24
|
||
mov casinoSprites[9*SIZEOF SpriteObject].frameCount, 3
|
||
mov casinoSprites[9*SIZEOF SpriteObject].curFrame, 2
|
||
mov casinoSprites[9*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[9*SIZEOF SpriteObject].animSpeed, 6
|
||
mov casinoSprites[9*SIZEOF SpriteObject].interactId, 3
|
||
mov casinoSprites[9*SIZEOF SpriteObject].promptPtr, OFFSET promptSlotClassic
|
||
|
||
; --- 10: Umamusume Derby Arcade ---
|
||
mov casinoSprites[10*SIZEOF SpriteObject].posX, (5 * FP_1)
|
||
mov casinoSprites[10*SIZEOF SpriteObject].posY, (16 * FP_1)
|
||
mov casinoSprites[10*SIZEOF SpriteObject].baseTexId, 36
|
||
mov casinoSprites[10*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[10*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[10*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[10*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[10*SIZEOF SpriteObject].interactId, 14
|
||
mov casinoSprites[10*SIZEOF SpriteObject].promptPtr, OFFSET promptUmamusume
|
||
|
||
; --- 11: DBD Skillcheck Arcade ---
|
||
mov casinoSprites[11*SIZEOF SpriteObject].posX, (5 * FP_1)
|
||
mov casinoSprites[11*SIZEOF SpriteObject].posY, (19 * FP_1)
|
||
mov casinoSprites[11*SIZEOF SpriteObject].baseTexId, 36
|
||
mov casinoSprites[11*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[11*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[11*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[11*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[11*SIZEOF SpriteObject].interactId, 13
|
||
mov casinoSprites[11*SIZEOF SpriteObject].promptPtr, OFFSET promptSkillCheck
|
||
|
||
; --- 12: Cashier / ATM (East Wing) ---
|
||
mov casinoSprites[12*SIZEOF SpriteObject].posX, (27 * FP_1)
|
||
mov casinoSprites[12*SIZEOF SpriteObject].posY, (7 * FP_1)
|
||
mov casinoSprites[12*SIZEOF SpriteObject].baseTexId, 33
|
||
mov casinoSprites[12*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[12*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[12*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[12*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[12*SIZEOF SpriteObject].interactId, 18
|
||
mov casinoSprites[12*SIZEOF SpriteObject].promptPtr, OFFSET promptATM
|
||
|
||
; --- 13: VIP Boutique / Bar Counter ---
|
||
mov casinoSprites[13*SIZEOF SpriteObject].posX, (27 * FP_1)
|
||
mov casinoSprites[13*SIZEOF SpriteObject].posY, (10 * FP_1)
|
||
mov casinoSprites[13*SIZEOF SpriteObject].baseTexId, 30
|
||
mov casinoSprites[13*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[13*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[13*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[13*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[13*SIZEOF SpriteObject].interactId, 17
|
||
mov casinoSprites[13*SIZEOF SpriteObject].promptPtr, OFFSET promptShop
|
||
|
||
; --- 14: Online Casino Terminal ---
|
||
mov casinoSprites[14*SIZEOF SpriteObject].posX, (27 * FP_1)
|
||
mov casinoSprites[14*SIZEOF SpriteObject].posY, (13 * FP_1)
|
||
mov casinoSprites[14*SIZEOF SpriteObject].baseTexId, 36
|
||
mov casinoSprites[14*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[14*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[14*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[14*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[14*SIZEOF SpriteObject].interactId, 16
|
||
mov casinoSprites[14*SIZEOF SpriteObject].promptPtr, OFFSET promptOnline
|
||
|
||
; --- 15: Hall of Fame / Achievements ---
|
||
mov casinoSprites[15*SIZEOF SpriteObject].posX, (27 * FP_1)
|
||
mov casinoSprites[15*SIZEOF SpriteObject].posY, (16 * FP_1)
|
||
mov casinoSprites[15*SIZEOF SpriteObject].baseTexId, 36
|
||
mov casinoSprites[15*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[15*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[15*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[15*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[15*SIZEOF SpriteObject].interactId, 19
|
||
mov casinoSprites[15*SIZEOF SpriteObject].promptPtr, OFFSET promptAchieve
|
||
|
||
; --- 16: Stats Board ---
|
||
mov casinoSprites[16*SIZEOF SpriteObject].posX, (27 * FP_1)
|
||
mov casinoSprites[16*SIZEOF SpriteObject].posY, (19 * FP_1)
|
||
mov casinoSprites[16*SIZEOF SpriteObject].baseTexId, 36
|
||
mov casinoSprites[16*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[16*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[16*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[16*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[16*SIZEOF SpriteObject].interactId, 20
|
||
mov casinoSprites[16*SIZEOF SpriteObject].promptPtr, OFFSET promptStats
|
||
|
||
; --- 17: Durak Card Table (South Backroom) ---
|
||
mov casinoSprites[17*SIZEOF SpriteObject].posX, (12 * FP_1)
|
||
mov casinoSprites[17*SIZEOF SpriteObject].posY, (23 * FP_1)
|
||
mov casinoSprites[17*SIZEOF SpriteObject].baseTexId, 37
|
||
mov casinoSprites[17*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[17*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[17*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[17*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[17*SIZEOF SpriteObject].interactId, 7
|
||
mov casinoSprites[17*SIZEOF SpriteObject].promptPtr, OFFSET promptDurak
|
||
|
||
; --- 18: Buckshot Roulette Table ---
|
||
mov casinoSprites[18*SIZEOF SpriteObject].posX, (16 * FP_1)
|
||
mov casinoSprites[18*SIZEOF SpriteObject].posY, (23 * FP_1)
|
||
mov casinoSprites[18*SIZEOF SpriteObject].baseTexId, 34
|
||
mov casinoSprites[18*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[18*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[18*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[18*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[18*SIZEOF SpriteObject].interactId, 8
|
||
mov casinoSprites[18*SIZEOF SpriteObject].promptPtr, OFFSET promptBuckshot
|
||
|
||
; --- 19: Russian Roulette Table ---
|
||
mov casinoSprites[19*SIZEOF SpriteObject].posX, (20 * FP_1)
|
||
mov casinoSprites[19*SIZEOF SpriteObject].posY, (23 * FP_1)
|
||
mov casinoSprites[19*SIZEOF SpriteObject].baseTexId, 34
|
||
mov casinoSprites[19*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[19*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[19*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[19*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[19*SIZEOF SpriteObject].interactId, 9
|
||
mov casinoSprites[19*SIZEOF SpriteObject].promptPtr, OFFSET promptRussRoul
|
||
|
||
; --- 20: Craps / Dice Table ---
|
||
mov casinoSprites[20*SIZEOF SpriteObject].posX, (12 * FP_1)
|
||
mov casinoSprites[20*SIZEOF SpriteObject].posY, (26 * FP_1)
|
||
mov casinoSprites[20*SIZEOF SpriteObject].baseTexId, 38
|
||
mov casinoSprites[20*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[20*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[20*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[20*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[20*SIZEOF SpriteObject].interactId, 11
|
||
mov casinoSprites[20*SIZEOF SpriteObject].promptPtr, OFFSET promptDice
|
||
|
||
; --- 21: Skulls and Cups Table ---
|
||
mov casinoSprites[21*SIZEOF SpriteObject].posX, (16 * FP_1)
|
||
mov casinoSprites[21*SIZEOF SpriteObject].posY, (26 * FP_1)
|
||
mov casinoSprites[21*SIZEOF SpriteObject].baseTexId, 38
|
||
mov casinoSprites[21*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[21*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[21*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[21*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[21*SIZEOF SpriteObject].interactId, 10
|
||
mov casinoSprites[21*SIZEOF SpriteObject].promptPtr, OFFSET promptSkulls
|
||
|
||
; --- 22: Coin Flip Table ---
|
||
mov casinoSprites[22*SIZEOF SpriteObject].posX, (20 * FP_1)
|
||
mov casinoSprites[22*SIZEOF SpriteObject].posY, (26 * FP_1)
|
||
mov casinoSprites[22*SIZEOF SpriteObject].baseTexId, 38
|
||
mov casinoSprites[22*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[22*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[22*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[22*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[22*SIZEOF SpriteObject].interactId, 12
|
||
mov casinoSprites[22*SIZEOF SpriteObject].promptPtr, OFFSET promptCoin
|
||
|
||
; --- 23: Training Table ---
|
||
mov casinoSprites[23*SIZEOF SpriteObject].posX, (10 * FP_1)
|
||
mov casinoSprites[23*SIZEOF SpriteObject].posY, (14 * FP_1)
|
||
mov casinoSprites[23*SIZEOF SpriteObject].baseTexId, 37
|
||
mov casinoSprites[23*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[23*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[23*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[23*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[23*SIZEOF SpriteObject].interactId, 23
|
||
mov casinoSprites[23*SIZEOF SpriteObject].promptPtr, OFFSET promptTraining
|
||
|
||
; --- 24: Observer Mode AI vs AI ---
|
||
mov casinoSprites[24*SIZEOF SpriteObject].posX, (22 * FP_1)
|
||
mov casinoSprites[24*SIZEOF SpriteObject].posY, (14 * FP_1)
|
||
mov casinoSprites[24*SIZEOF SpriteObject].baseTexId, 37
|
||
mov casinoSprites[24*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[24*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[24*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[24*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[24*SIZEOF SpriteObject].interactId, 24
|
||
mov casinoSprites[24*SIZEOF SpriteObject].promptPtr, OFFSET promptObserver
|
||
|
||
; --- 25: Daily Tasks Board ---
|
||
mov casinoSprites[25*SIZEOF SpriteObject].posX, (27 * FP_1)
|
||
mov casinoSprites[25*SIZEOF SpriteObject].posY, (22 * FP_1)
|
||
mov casinoSprites[25*SIZEOF SpriteObject].baseTexId, 36
|
||
mov casinoSprites[25*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[25*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[25*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[25*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[25*SIZEOF SpriteObject].interactId, 21
|
||
mov casinoSprites[25*SIZEOF SpriteObject].promptPtr, OFFSET promptDaily
|
||
|
||
; --- 26: Settings Terminal ---
|
||
mov casinoSprites[26*SIZEOF SpriteObject].posX, (27 * FP_1)
|
||
mov casinoSprites[26*SIZEOF SpriteObject].posY, (25 * FP_1)
|
||
mov casinoSprites[26*SIZEOF SpriteObject].baseTexId, 36
|
||
mov casinoSprites[26*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[26*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[26*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[26*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[26*SIZEOF SpriteObject].interactId, 22
|
||
mov casinoSprites[26*SIZEOF SpriteObject].promptPtr, OFFSET promptSettings
|
||
|
||
; --- 27: Demon Portal: Hell Tower Floor 666 ---
|
||
mov casinoSprites[27*SIZEOF SpriteObject].posX, (16 * FP_1)
|
||
mov casinoSprites[27*SIZEOF SpriteObject].posY, (29 * FP_1)
|
||
mov casinoSprites[27*SIZEOF SpriteObject].baseTexId, 39
|
||
mov casinoSprites[27*SIZEOF SpriteObject].frameCount, 1
|
||
mov casinoSprites[27*SIZEOF SpriteObject].curFrame, 0
|
||
mov casinoSprites[27*SIZEOF SpriteObject].animTimer, 0
|
||
mov casinoSprites[27*SIZEOF SpriteObject].animSpeed, 0
|
||
mov casinoSprites[27*SIZEOF SpriteObject].interactId, 15
|
||
mov casinoSprites[27*SIZEOF SpriteObject].promptPtr, OFFSET promptHell
|
||
|
||
mov eax, 1
|
||
jmp init_return
|
||
|
||
init_failed:
|
||
xor eax, eax
|
||
|
||
init_return:
|
||
pop edi
|
||
pop esi
|
||
pop ebx
|
||
ret
|
||
Init3DEngine ENDP
|
||
|
||
; --- Main 3D Engine Loop ---
|
||
StartCasino3D PROC uses ebx esi edi
|
||
call Init3DEngine
|
||
test eax, eax
|
||
jz engine_shutdown
|
||
|
||
invoke GetTickCount
|
||
mov rngSeed3D, eax
|
||
mov previousTick3D, eax
|
||
|
||
engine_loop:
|
||
invoke PeekMessageA, OFFSET msg3D, 0, 0, 0, PM_REMOVE
|
||
test eax, eax
|
||
jz dispatch_frame
|
||
cmp msg3D.message, WM_QUIT
|
||
je engine_shutdown
|
||
invoke TranslateMessage, OFFSET msg3D
|
||
invoke DispatchMessageA, OFFSET msg3D
|
||
jmp engine_loop
|
||
|
||
dispatch_frame:
|
||
invoke GetTickCount
|
||
mov frameStart3D, eax
|
||
sub eax, previousTick3D
|
||
cmp eax, 50
|
||
jbe @F
|
||
mov eax, 50
|
||
@@:
|
||
mov deltaTime3D, eax
|
||
mov eax, frameStart3D
|
||
mov previousTick3D, eax
|
||
|
||
invoke GetForegroundWindow
|
||
cmp eax, h3DWnd
|
||
jne engine_idle
|
||
invoke IsIconic, h3DWnd
|
||
test eax, eax
|
||
jnz engine_idle
|
||
|
||
; F11: Fullscreen Toggle
|
||
invoke Pressed3D, 7Ah
|
||
test eax, eax
|
||
jz @F
|
||
call ToggleFullscreen3D
|
||
@@:
|
||
; ESC: Pause Menu Toggle
|
||
invoke Pressed3D, 1Bh
|
||
test eax, eax
|
||
jz engine_tick
|
||
xor paused3D, 1
|
||
|
||
engine_tick:
|
||
cmp paused3D, 0
|
||
jne draw_pause
|
||
|
||
mov eax, deltaTime3D
|
||
add animationClock3D, eax
|
||
|
||
call UpdateCamera3D
|
||
call CheckInteractions
|
||
call HandlePlayerInput
|
||
call UpdateCamera3D
|
||
call RenderCeilingAndFloor
|
||
call RenderWalls
|
||
call RenderSprites
|
||
call RenderHUD
|
||
call RenderMinimap
|
||
jmp present_frame
|
||
|
||
draw_pause:
|
||
; Dim overlay behind pause box
|
||
invoke DrawBoxBorder, 40, 50, 240, 140, 00151C21h, 00D8BC6Ah, 2
|
||
invoke DrawString8x8, 64, 70, OFFSET textPauseTitle, 00FFFFFFh
|
||
invoke DrawString8x8, 56, 100, OFFSET textPauseResume, 00D8BC6Ah
|
||
invoke DrawString8x8, 56, 125, OFFSET textPauseMenu, 0000D7FFh
|
||
invoke DrawString8x8, 56, 150, OFFSET textPauseQuit, 00BBBBBBh
|
||
|
||
; Key M: Classic Console Menu
|
||
invoke Pressed3D, 4Dh
|
||
test eax, eax
|
||
jz check_quit_key
|
||
mov paused3D, 0
|
||
invoke RunConsoleGameFrom3D, OFFSET MainMenu, 0
|
||
jmp present_frame
|
||
|
||
check_quit_key:
|
||
; Key Q: Save and Quit
|
||
invoke Pressed3D, 51h
|
||
test eax, eax
|
||
jnz engine_shutdown
|
||
|
||
present_frame:
|
||
call Present3D
|
||
lea edi, pressedKeys3D
|
||
xor eax, eax
|
||
mov ecx, 64
|
||
rep stosd
|
||
|
||
invoke GetTickCount
|
||
sub eax, frameStart3D
|
||
cmp eax, 16
|
||
jae engine_loop
|
||
mov ecx, 16
|
||
sub ecx, eax
|
||
invoke Sleep, ecx
|
||
jmp engine_loop
|
||
|
||
engine_idle:
|
||
invoke Sleep, 50
|
||
jmp engine_loop
|
||
|
||
engine_shutdown:
|
||
call SaveGame
|
||
cmp h3DDC, 0
|
||
je @F
|
||
invoke ReleaseDC, h3DWnd, h3DDC
|
||
mov h3DDC, 0
|
||
@@:
|
||
cmp h3DWnd, 0
|
||
je @F
|
||
invoke DestroyWindow, h3DWnd
|
||
mov h3DWnd, 0
|
||
@@:
|
||
cmp hCasinoConsole, 0
|
||
je @F
|
||
invoke ShowWindow, hCasinoConsole, SW_SHOW
|
||
invoke SetForegroundWindow, hCasinoConsole
|
||
@@:
|
||
ret
|
||
StartCasino3D ENDP
|
||
|
||
include src_graphics\platform_code.inc
|
||
'''
|
||
|
||
with open('d:/покер/casino3d.inc', 'wb') as f:
|
||
f.write(content.strip().encode('cp1251'))
|
||
|
||
print('Successfully generated unified casino3d.inc in CP1251!')
|