218 lines
5.8 KiB
PHP
218 lines
5.8 KiB
PHP
; ==============================================================================
|
|
; SECURITY, HEAT & PIT BOSS INTERROGATION SCENE (CP1251)
|
|
; ==============================================================================
|
|
|
|
InitSecurity3D PROC
|
|
invoke LoadAnimPack3D, OFFSET secPortraitsPack, OFFSET secPortraitsPath
|
|
ret
|
|
InitSecurity3D ENDP
|
|
|
|
FreeSecurity3D PROC
|
|
invoke FreeAnimPack3D, OFFSET secPortraitsPack
|
|
ret
|
|
FreeSecurity3D ENDP
|
|
|
|
AddSecurityHeat PROC amount:DWORD
|
|
mov eax, amount
|
|
add securityHeat, eax
|
|
cmp securityHeat, 100
|
|
jb sec_heat_ok
|
|
mov securityHeat, 100
|
|
mov uwSecurityPending,1
|
|
sec_heat_ok:
|
|
ret
|
|
AddSecurityHeat ENDP
|
|
|
|
DecaySecurityHeat PROC amount:DWORD
|
|
mov eax, amount
|
|
cmp securityHeat, eax
|
|
jbe sec_decay_zero
|
|
sub securityHeat, eax
|
|
ret
|
|
sec_decay_zero:
|
|
mov securityHeat, 0
|
|
ret
|
|
DecaySecurityHeat ENDP
|
|
|
|
TriggerInterrogation3D PROC
|
|
mov eax, bankroll
|
|
mov ecx, 40
|
|
mul ecx
|
|
mov ecx, 100
|
|
div ecx
|
|
mov securityBribeAmount, eax
|
|
mov securitySubmode, 0
|
|
mov securitySkillNeedle, 10
|
|
mov securitySkillDir, 1
|
|
mov uwSecurityAccumulator,0
|
|
mov engineMode, MODE_SECURITY
|
|
call ClearKeys3D
|
|
ret
|
|
TriggerInterrogation3D ENDP
|
|
|
|
HandleSecurity3D PROC
|
|
cmp securitySubmode, 0
|
|
jne sec_check_sub1
|
|
|
|
; Submode 0: Menu choices (1: Bribe, 2: Bluff, 3: Escape)
|
|
invoke Pressed3D, 31h ; '1'
|
|
test eax, eax
|
|
jz @F
|
|
; Bribe
|
|
mov eax, securityBribeAmount
|
|
cmp bankroll, eax
|
|
jb sec_bribe_fail
|
|
sub bankroll, eax
|
|
invoke PlayCasinoSound3D, OFFSET soundCoin, 0, 1
|
|
mov securityResultMsg, OFFSET szSecResultBribe
|
|
mov securitySubmode, 2
|
|
call SaveProgress3D
|
|
ret
|
|
sec_bribe_fail:
|
|
invoke PlayCasinoSound3D, OFFSET soundRoundLose, 0, 1
|
|
mov securityResultMsg, OFFSET szSecResultBust
|
|
mov bankroll, 0
|
|
mov securitySubmode, 2
|
|
call SaveProgress3D
|
|
ret
|
|
@@:
|
|
invoke Pressed3D, 32h ; '2'
|
|
test eax, eax
|
|
jz @F
|
|
; Bluff: 50% chance or check if high roller
|
|
invoke RandomRange3D, 2
|
|
test eax, eax
|
|
jz sec_bluff_fail
|
|
invoke PlayCasinoSound3D, OFFSET soundRoundWin, 0, 1
|
|
mov securityResultMsg, OFFSET szSecResultBluff
|
|
mov securitySubmode, 2
|
|
ret
|
|
sec_bluff_fail:
|
|
mov eax, bankroll
|
|
shr eax, 1
|
|
mov bankroll, eax
|
|
invoke PlayCasinoSound3D, OFFSET soundRoundLose, 0, 1
|
|
mov securityResultMsg, OFFSET szSecResultBust
|
|
mov securitySubmode, 2
|
|
call SaveProgress3D
|
|
ret
|
|
@@:
|
|
invoke Pressed3D, 33h ; '3'
|
|
test eax, eax
|
|
jz sec_handle_done
|
|
; Start escape skill-check
|
|
mov securitySubmode, 1
|
|
mov securitySkillNeedle, 10
|
|
mov securitySkillDir, 1
|
|
ret
|
|
|
|
sec_check_sub1:
|
|
cmp securitySubmode, 1
|
|
jne sec_check_sub2
|
|
|
|
; Submode 1: Skill check oscillation
|
|
mov eax,deltaTime3D
|
|
add eax,uwSecurityAccumulator
|
|
xor edx,edx
|
|
mov ecx,16
|
|
div ecx
|
|
mov uwSecurityAccumulator,edx
|
|
imul eax,securitySkillSpeed
|
|
cmp securitySkillDir, 1
|
|
jne sec_needle_left
|
|
add securitySkillNeedle, eax
|
|
cmp securitySkillNeedle, 90
|
|
jbe @F
|
|
mov securitySkillNeedle, 90
|
|
mov securitySkillDir, -1
|
|
jmp @F
|
|
sec_needle_left:
|
|
sub securitySkillNeedle, eax
|
|
cmp securitySkillNeedle, 10
|
|
jae @F
|
|
mov securitySkillNeedle, 10
|
|
mov securitySkillDir, 1
|
|
@@:
|
|
; Check Space pressed
|
|
invoke Pressed3D, 20h ; Space
|
|
test eax, eax
|
|
jz sec_handle_done
|
|
|
|
; Needle in green zone (38..62)?
|
|
cmp securitySkillNeedle, 38
|
|
jb sec_escape_busted
|
|
cmp securitySkillNeedle, 62
|
|
ja sec_escape_busted
|
|
; Escaped!
|
|
invoke PlayCasinoSound3D, OFFSET soundRoundWin, 0, 1
|
|
mov securityResultMsg, OFFSET szSecResultEscape
|
|
mov securityHeat, 0
|
|
mov securitySubmode, 2
|
|
ret
|
|
sec_escape_busted:
|
|
mov eax, bankroll
|
|
shr eax, 1
|
|
mov bankroll, eax
|
|
invoke PlayCasinoSound3D, OFFSET soundRoundLose, 0, 1
|
|
mov securityResultMsg, OFFSET szSecResultBust
|
|
mov securityHeat, 0
|
|
mov securitySubmode, 2
|
|
call SaveProgress3D
|
|
ret
|
|
|
|
sec_check_sub2:
|
|
; Submode 2: Result display, wait for Enter/Space
|
|
invoke Pressed3D, 0Dh ; Enter
|
|
test eax, eax
|
|
jnz sec_exit_to_walk
|
|
invoke Pressed3D, 20h ; Space
|
|
test eax, eax
|
|
jnz sec_exit_to_walk
|
|
invoke Pressed3D, 1Bh ; Esc
|
|
test eax, eax
|
|
jz sec_handle_done
|
|
sec_exit_to_walk:
|
|
mov uwSecurityPending,0
|
|
mov securityHeat, 0
|
|
call SaveProgress3D
|
|
mov engineMode, MODE_WALK
|
|
call ClearKeys3D
|
|
|
|
sec_handle_done:
|
|
ret
|
|
HandleSecurity3D ENDP
|
|
|
|
RenderSecurity3D PROC
|
|
invoke DrawBox,0,0,320,240,00101418h
|
|
invoke DrawBoxBorder,6,6,308,228,00161C22h,00836D42h,1
|
|
invoke DrawString8x8,16,16,OFFSET uwSecurity,00E7CA88h
|
|
invoke DrawUnderworldSprite3D,OFFSET secPortraitsPack,2,12,44,94,110
|
|
cmp securitySubmode,0
|
|
jne uw_sec_skill
|
|
invoke DrawString8x8,116,54,OFFSET uwBribe,00E4D9BDh
|
|
invoke DrawNumber,204,54,securityBribeAmount,00A8DDB9h
|
|
invoke DrawUnderworldText3D,116,96,OFFSET uwBluff,23,00E4D9BDh
|
|
invoke DrawUnderworldText3D,116,140,OFFSET uwEscape,23,00E7CA88h
|
|
jmp uw_sec_footer
|
|
uw_sec_skill:
|
|
cmp securitySubmode,1
|
|
jne uw_sec_result
|
|
invoke DrawUnderworldText3D,116,54,OFFSET uwSkill,23,00E7CA88h
|
|
invoke DrawBox,120,112,176,12,00222222h
|
|
invoke DrawBox,187,112,42,12,00228822h
|
|
mov eax,securitySkillNeedle
|
|
imul eax,176
|
|
xor edx,edx
|
|
mov ecx,100
|
|
div ecx
|
|
add eax,120
|
|
invoke DrawBox,eax,108,2,20,0055FFFFh
|
|
jmp uw_sec_footer
|
|
uw_sec_result:
|
|
invoke DrawUnderworldText3D,116,52,securityResultMsg,23,00E7CA88h
|
|
invoke DrawString8x8,16,202,OFFSET uwContinue,00A8DDB9h
|
|
uw_sec_footer:
|
|
invoke DrawString8x8,16,220,OFFSET uwBank,00A8B6BBh
|
|
invoke DrawNumber,72,220,bankroll,00E5D6B0h
|
|
ret
|
|
RenderSecurity3D ENDP
|