KAZIK/src_graphics/terminal.inc
Artvasil09 797ee366dc feat: implement upper lounge, manual stairs, cabaret, and casino terminals
- Native player-controlled stairs, upper lounge bar, and Hell Tower infernal portal
- Cabaret stage with musical acts, audience seating, and interaction
- Dedicated cash/trophy wall terminals with native balance and achievement screens
- Projecting 3D wall lanterns with ray/plane intersection
- Six roaming guests with seated poses and card rank rendering updates
- Synchronized launcher hash and updated binaries
2026-10-18 21:36:12 +03:00

378 lines
9.8 KiB
PHP

LoadTerminalArt3D PROC
invoke LoadAnimPack3D,OFFSET terminalWorldArt3D,OFFSET terminalWorldPath3D
invoke ValidateCityPack3D,OFFSET terminalWorldArt3D,256,512,4
invoke LoadAnimPack3D,OFFSET terminalScreenArt3D,OFFSET terminalScreenPath3D
invoke ValidateCityPack3D,OFFSET terminalScreenArt3D,640,480,1
ret
LoadTerminalArt3D ENDP
FreeTerminalArt3D PROC
invoke FreeAnimPack3D,OFFSET terminalWorldArt3D
invoke FreeAnimPack3D,OFFSET terminalScreenArt3D
ret
FreeTerminalArt3D ENDP
ResolveTerminalSurface3D PROC material:DWORD
mov eax,material
sub eax,118
cmp eax,4
jae terminal_surface_missing
cmp terminalWorldArt3D.pixels,0
je terminal_surface_missing
shl eax,19
add eax,terminalWorldArt3D.pixels
mov ecx,256
mov edx,512
ret
terminal_surface_missing:
xor eax,eax
ret
ResolveTerminalSurface3D ENDP
PositionTerminalStations3D PROC
mov casinoSprites[15*SIZEOF SpriteObject].SpriteObject.posX,TERMINAL_CASH_X
mov casinoSprites[15*SIZEOF SpriteObject].SpriteObject.posY,TERMINAL_CENTER_Y
mov casinoSprites[16*SIZEOF SpriteObject].SpriteObject.posX,TERMINAL_TROPHY_X
mov casinoSprites[16*SIZEOF SpriteObject].SpriteObject.posY,TERMINAL_CENTER_Y
mov casinoWaypoints3D[14*SIZEOF NpcWaypoint].NpcWaypoint.posX,TERMINAL_CASH_X
mov casinoWaypoints3D[14*SIZEOF NpcWaypoint].NpcWaypoint.posY,FP_1*29/2
ret
PositionTerminalStations3D ENDP
DrawTerminalCabinet3D PROC uses ebx esi edi wx:DWORD,wy:DWORD,material:DWORD
local x0:DWORD,x1:DWORD,y0:DWORD,y1:DWORD
mov eax,wx
sub eax,FP_1*7/20
mov x0,eax
add eax,FP_1*7/10
mov x1,eax
mov eax,wy
sub eax,FP_1/5
mov y0,eax
add eax,FP_1*2/5
mov y1,eax
invoke DrawCityBoxSides3D,x0,x1,y0,y1,0,FP_1*8/5,121
invoke DrawCityHorizontal3D,x0,x1,y0,y1,FP_1*8/5,110
mov eax,y1
add eax,FP_1/500
invoke DrawCityVertical3D,1,eax,x0,x1,0,FP_1*8/5,material
ret
DrawTerminalCabinet3D ENDP
RenderTerminalCabinets3D PROC
invoke DrawTerminalCabinet3D,TERMINAL_CASH_X,TERMINAL_CENTER_Y,118
invoke DrawTerminalCabinet3D,TERMINAL_TROPHY_X,TERMINAL_CENTER_Y,119
ret
RenderTerminalCabinets3D ENDP
TerminalCanWalk3D PROC uses esi px:DWORD,py:DWORD
mov eax,py
sub eax,TERMINAL_CENTER_Y
test eax,eax
jns @F
neg eax
@@:
cmp eax,FP_1*7/20
ja terminal_walk_clear
mov esi,TERMINAL_CASH_X
terminal_walk_station:
mov eax,px
sub eax,esi
test eax,eax
jns @F
neg eax
@@:
cmp eax,FP_HALF
jbe terminal_walk_blocked
add esi,FP_1*3/2
cmp esi,TERMINAL_TROPHY_X
jbe terminal_walk_station
terminal_walk_clear:
mov eax,1
ret
terminal_walk_blocked:
xor eax,eax
ret
TerminalCanWalk3D ENDP
; A projecting solid bracket supports a glass body, not a plane on the wall.
DrawHallLantern3D PROC uses ebx esi edi wallX:DWORD,wy:DWORD,direction:DWORD
local x0:DWORD,x1:DWORD,y0:DWORD,y1:DWORD,bodyX:DWORD
mov eax,wallX
mov ebx,direction
imul ebx,FP_1*3/10
add eax,ebx
mov bodyX,eax
mov eax,wy
sub eax,FP_1*13/100
mov y0,eax
add eax,FP_1*26/100
mov y1,eax
mov eax,bodyX
sub eax,FP_1*3/25
mov x0,eax
add eax,FP_1*6/25
mov x1,eax
invoke DrawCityBoxSides3D,x0,x1,y0,y1,FP_1*7/5,FP_1*19/10,120
invoke DrawCityHorizontal3D,x0,x1,y0,y1,FP_1*19/10,110
invoke DrawCityHorizontal3D,x0,x1,y0,y1,FP_1*7/5,110
; A short horizontal arm and wall plate remain visible at grazing angles.
mov eax,wallX
mov edx,bodyX
cmp eax,edx
jle @F
xchg eax,edx
@@:
mov x0,eax
mov x1,edx
mov eax,wy
sub eax,FP_1/30
mov y0,eax
add eax,FP_1/15
mov y1,eax
invoke DrawCityBoxSides3D,x0,x1,y0,y1,FP_1*31/20,FP_1*8/5,110
invoke DrawCityHorizontal3D,x0,x1,y0,y1,FP_1*8/5,110
mov eax,wallX
sub eax,FP_1/100
mov x0,eax
add eax,FP_1/50
mov x1,eax
mov eax,wy
sub eax,FP_1/12
mov y0,eax
add eax,FP_1/6
mov y1,eax
invoke DrawCityBoxSides3D,x0,x1,y0,y1,FP_1*29/20,FP_1*7/4,110
ret
DrawHallLantern3D ENDP
TerminalCountBits3D PROC value:DWORD
mov ecx,value
xor eax,eax
terminal_count_bit:
test ecx,ecx
jz terminal_count_done
lea edx,[ecx-1]
and ecx,edx
inc eax
jmp terminal_count_bit
terminal_count_done:
ret
TerminalCountBits3D ENDP
TerminalProgress3D PROC index:DWORD
cmp index,4
jae terminal_progress_collection
mov eax,bankroll
ret
terminal_progress_collection:
cmp index,6
jae terminal_progress_quests
mov eax,ownedBacks3D
and eax,1FFEh
invoke TerminalCountBits3D,eax
ret
terminal_progress_quests:
mov eax,npcClaimed3D
and eax,0FFFh
invoke TerminalCountBits3D,eax
ret
TerminalProgress3D ENDP
; Existing saved achievement bits are preserved; the merchant still owns bit 4.
RefreshTerminalAchievements3D PROC uses esi
xor esi,esi
terminal_refresh_next:
invoke TerminalProgress3D,esi
cmp eax,terminalGoals3D[esi*4]
jb @F
mov ecx,terminalBits3D[esi*4]
bts achievements,ecx
@@:
inc esi
cmp esi,8
jb terminal_refresh_next
ret
RefreshTerminalAchievements3D ENDP
BeginTerminal3D PROC kind:DWORD
mov eax,kind
and eax,1
mov terminalTab3D,eax
mov terminalPage3D,0
call NpcEnsureJournal3D
call RefreshTerminalAchievements3D
call SaveProgress3D
mov engineMode,MODE_ATM
call ClearKeys3D
mov mouseClick3D,0
ret
BeginTerminal3D ENDP
HandleTerminal3D PROC
cmp mouseClick3D,0
je terminal_handle_keys
cmp mouseY3D,8
jb terminal_handle_keys
cmp mouseY3D,25
ja terminal_handle_bottom
cmp mouseX3D,248
jae terminal_close
terminal_handle_bottom:
cmp mouseY3D,203
jb terminal_handle_keys
cmp mouseX3D,48
jb terminal_previous
cmp mouseX3D,272
ja terminal_next
terminal_handle_keys:
invoke Pressed3D,45h
test eax,eax
jnz terminal_close
invoke Pressed3D,25h
test eax,eax
jnz terminal_previous
invoke Pressed3D,27h
test eax,eax
jnz terminal_next
jmp terminal_handled
terminal_previous:
cmp terminalTab3D,0
je terminal_previous_from_cash
cmp terminalPage3D,0
je terminal_show_cash
dec terminalPage3D
jmp terminal_handled
terminal_previous_from_cash:
mov terminalTab3D,1
mov terminalPage3D,2
jmp terminal_handled
terminal_next:
cmp terminalTab3D,0
je terminal_next_from_cash
cmp terminalPage3D,2
jae terminal_show_cash
inc terminalPage3D
jmp terminal_handled
terminal_next_from_cash:
mov terminalTab3D,1
mov terminalPage3D,0
jmp terminal_handled
terminal_show_cash:
mov terminalTab3D,0
mov terminalPage3D,0
jmp terminal_handled
terminal_close:
mov engineMode,MODE_WALK
call ClearKeys3D
terminal_handled:
mov mouseClick3D,0
ret
HandleTerminal3D ENDP
RenderTerminal3D PROC uses ebx esi edi
local rowY:DWORD,opened:DWORD,progress:DWORD
invoke DrawBox,0,0,320,240,000B1815h
cmp terminalScreenArt3D.pixels,0
je @F
invoke DrawAnimSprite3D,OFFSET terminalScreenArt3D,0,0,0,640,480
@@:
mov edx,OFFSET termCash
cmp terminalTab3D,0
je @F
mov edx,OFFSET termTrophy
@@:
invoke DrawString8x8,64,12,edx,002D2116h
invoke DrawBoxBorder,248,8,56,17,001A2522h,00C8AD75h,1
invoke DrawString8x8,256,12,OFFSET termClose,00F2E6C6h
mov opened,0
xor esi,esi
terminal_count_unlocked:
mov ecx,terminalBits3D[esi*4]
bt achievements,ecx
jnc @F
inc opened
@@:
inc esi
cmp esi,8
jb terminal_count_unlocked
cmp terminalTab3D,1
je terminal_render_achievements
invoke DrawString8x8,24,45,OFFSET termAccount,00DDC99Dh
invoke DrawString8x8,24,69,OFFSET termBalance,0090B19Fh
invoke DrawNumber,24,87,bankroll,00F0E6C3h
invoke DrawBox,24,110,272,1,00495B4Ah
invoke DrawString8x8,24,128,OFFSET termCollection,0090B19Fh
mov eax,ownedBacks3D
and eax,1FFFh
invoke TerminalCountBits3D,eax
invoke DrawNumber,216,128,eax,00F0E6C3h
invoke DrawString8x8,232,128,OFFSET termSlash,0090B19Fh
invoke DrawNumber,248,128,13,00F0E6C3h
invoke DrawString8x8,24,156,OFFSET termTrophy,0090B19Fh
invoke DrawNumber,216,156,opened,00F0E6C3h
invoke DrawString8x8,232,156,OFFSET termSlash,0090B19Fh
invoke DrawNumber,248,156,8,00F0E6C3h
jmp terminal_render_footer
terminal_render_achievements:
invoke DrawString8x8,24,40,OFFSET termOpened,0090B19Fh
invoke DrawNumber,232,40,opened,00F0E6C3h
invoke DrawString8x8,248,40,OFFSET termSlash,0090B19Fh
invoke DrawNumber,264,40,8,00F0E6C3h
imul esi,terminalPage3D,3
mov rowY,62
mov edi,3
terminal_render_row:
cmp esi,8
jae terminal_render_footer
mov ebx,0090B19Fh
mov ecx,terminalBits3D[esi*4]
bt achievements,ecx
jnc @F
mov ebx,00E7C479h
invoke DrawString8x8,256,rowY,OFFSET termEarned,008CD8AFh
@@:
invoke DrawString8x8,24,rowY,terminalNames3D[esi*4],ebx
mov eax,rowY
add eax,12
invoke DrawString8x8,24,eax,terminalConditions3D[esi*4],0090B19Fh
invoke TerminalProgress3D,esi
mov ecx,terminalGoals3D[esi*4]
cmp eax,ecx
jbe @F
mov eax,ecx
@@:
mov edx,terminalBits3D[esi*4]
bt achievements,edx
jnc @F
mov eax,ecx
@@:
mov progress,eax
mov eax,rowY
add eax,24
invoke DrawNumber,24,eax,progress,00D2DCCEh
mov eax,rowY
add eax,24
invoke DrawString8x8,112,eax,OFFSET termSlash,0090B19Fh
mov eax,rowY
add eax,24
invoke DrawNumber,128,eax,terminalGoals3D[esi*4],00D2DCCEh
mov eax,rowY
add eax,35
invoke DrawBox,24,eax,272,1,00314538h
add rowY,44
inc esi
dec edi
jnz terminal_render_row
terminal_render_footer:
mov eax,terminalPage3D
add eax,2
cmp terminalTab3D,0
jne @F
mov eax,1
@@:
invoke DrawNumber,140,216,eax,00E3CCA0h
invoke DrawString8x8,156,216,OFFSET termSlash,00C1A982h
invoke DrawNumber,172,216,4,00E3CCA0h
ret
RenderTerminal3D ENDP