📄 gui.asm
字号:
jmp .skipkeyrel
.noE0
mov byte[GUIskipnextkey42],0
mov bl,al
xor bh,bh
test bl,80h ; check if bit 7 is on (key released)
jnz .keyrel
cmp byte[pressed+ebx],0
jne .skipa
mov byte[pressed+ebx],1 ; if not, set key to pressed
.skipa
jmp .skipkeyrel
.keyrel
and bl,7Fh
mov byte[pressed+ebx],0 ; if not, set key to pressed
.skipkeyrel
mov byte[pressed],0
pushf
call far [GUIoldhand9o]
mov al,20h
out 20h,al
pop ebx
pop eax
pop ds
sti
iretd
%macro loadmenuopen 1
mov al,[GUIcmenupos]
mov [GUIpmenupos],al
mov byte[GUIcmenupos],0
cmp byte[GUIwinactiv+%1],1
je %%menuontop
xor eax,eax
mov al,[GUIwinptr]
inc byte[GUIwinptr]
mov byte[GUIwinorder+eax],%1
mov byte[GUIwinactiv+%1],1
cmp byte[resetposn],1
jne %%nomenuitem
mov eax,[GUIwinposxo+%1*4]
mov [GUIwinposx+%1*4],eax
mov eax,[GUIwinposyo+%1*4]
mov [GUIwinposy+%1*4],eax
jmp %%nomenuitem
%%menuontop
xor eax,eax
; look for match
%%notfoundyet
mov bl,byte[GUIwinorder+eax]
cmp bl,%1
je %%nextfind
inc eax
jmp %%notfoundyet
%%nextfind
inc eax
cmp al,[GUIwinptr]
je %%foundend
mov cl,[GUIwinorder+eax]
mov [GUIwinorder+eax-1],cl
jmp %%nextfind
%%foundend
mov byte[GUIpclicked],0
mov [GUIwinorder+eax-1],bl
%%nomenuitem
%endmacro
loadnetopen:
loadmenuopen 8
ret
MouseInitOkay db 0
LoadDetermine:
mov byte[GUIGameMenuData+14],1
mov byte[GUIGameMenuData+14*2],1
mov byte[GUIGameMenuData+14*4],1
mov byte[GUIGameMenuData+14*5],1
mov byte[GUIGameMenuData+14*6],1
mov byte[GUICheatMenuData],1
mov byte[GUICheatMenuData+14],1
mov byte[GUICheatMenuData+14*2],1
mov byte[GUIMiscMenuData+14*2],1
cmp byte[CheatBDoor],1
je .nomodem
cmp byte[CNetType],21
je .modem
cmp byte[CNetType],22
je .modem
cmp byte[CNetType],20
jne .nomodem
.modem
mov byte[GUICheatMenuData],2
mov byte[GUICheatMenuData+14],2
mov byte[GUICheatMenuData+14*2],2
.nomodem
cmp byte[romloadskip],0
je .noromloaded2
mov byte[GUIGameMenuData+14],2
mov byte[GUIGameMenuData+14*2],2
mov byte[GUIGameMenuData+14*4],2
mov byte[GUIGameMenuData+14*5],2
mov byte[GUIGameMenuData+14*6],2
mov byte[GUICheatMenuData],2
mov byte[GUICheatMenuData+14],2
mov byte[GUICheatMenuData+14*2],2
mov byte[GUIMiscMenuData+14*2],2
.noromloaded2
.noromloaded
ret
SECTION .data
SantaData:
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0
db 1,0,0,1,0,0,1,0,0,0,1,1,1,0,1,1
db 1,1,0,1,1,0,1,1,0,1,0,1,1,1,1,1
db 1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1
db 1,1,0,1,1,0,1,1,0,0,1,1,1,1,1,1
SantaPos dd 272
SantaNextT dd 36*15
NumSnow dd 0
NEWSYM SnowTimer, dd 36*30
MsgGiftLeft dd 0
SECTION .text
DrawSnow:
cmp byte[OkaySC],0
je near .nosanta
cmp dword[MsgGiftLeft],0
je .nodec
mov edx,20
mov ebx,210
mov byte[GUItextcolor],228
GUIOuttextwin .giftmsg
.nodec
mov esi,[vidbuffer]
add esi,[SantaPos]
add esi,60*288
mov edx,SantaData
mov ebx,8
.sloop2
mov ecx,16
.sloop
cmp byte[edx],0
je .transp
mov byte[esi],0
.transp
inc esi
inc edx
loop .sloop
add esi,272
dec ebx
jnz .sloop2
.nosanta
mov esi,[vidbuffer]
mov ecx,200
xor edx,edx
.loop
xor eax,eax
mov al,[SnowData+edx*4+3]
mov ebx,eax
shl eax,8
shl ebx,5
add eax,ebx
xor ebx,ebx
mov bl,[SnowData+edx*4+1]
add eax,ebx
add eax,16
mov bl,[SnowVelDist+edx*2]
and bl,03h
add bl,228
test byte[SnowVelDist+edx*2],8
jz .nosnow
mov byte[esi+eax],bl
.nosnow
inc edx
loop .loop
; Change Snow Displacement Values
.next
cmp dword[SnowMover],0
je .nomore
call ProcessSnowVelocity
dec dword[SnowMover]
jmp .next
.nomore
ret
.giftmsg db 'A GIFT TO YOU IN THE OPTIONS!',0
ProcessSnowVelocity:
cmp dword[MsgGiftLeft],0
je .nodec
dec dword[MsgGiftLeft]
.nodec
cmp dword[NumSnow],200
jne .snowincr
cmp dword[SantaNextT],0
je .skip
dec dword[SantaNextT]
jmp .notsreset
.skip
dec dword[SantaPos]
cmp dword[SantaPos],0
jne .notsreset
mov dword[SantaPos],272
mov dword[SantaNextT],36*60
jmp .notsreset
.snowincr
dec dword[SnowTimer]
jnz .notsreset
inc dword[NumSnow]
mov dword[SnowTimer],18
.notsreset
mov ecx,[NumSnow]
cmp ecx,0
jne .okay
ret
.okay
xor edx,edx
.loop
xor eax,eax
mov al,[SnowVelDist+edx*2]
mov ebx,100
sub bl,[MusicRelVol]
add bx,bx
add ax,bx
add ax,bx
add word[SnowData+edx*4],ax
xor eax,eax
mov al,[SnowVelDist+edx*2+1]
add ax,256
add word[SnowData+edx*4+2],ax
cmp word[SnowData+edx*4+2],200h
ja .nosdata
or byte[SnowVelDist+edx*2],8
.nosdata
inc edx
loop .loop
ret
OkaySC db 0
cstempfname db 'tmpchtsr.___',0
NEWSYM SaveSramData
; save sram
cmp byte[sramsavedis],1
je .nosram
cmp dword[ramsize],0
je .nosram
clim
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov edx,fnames+1
call Create_File
jc .failed
mov bx,ax
mov ecx,[ramsize]
mov edx,[sram]
call Write_File
call Close_File
.failed
stim
.nosram
call SaveCombFile
ret
NEWSYM ProcRewind
mov eax,KeyRewind
add eax,4
mov ebx,8
.loop
cmp byte[eax],'a'
jb .b
cmp byte[eax],'z'
ja .b
sub byte[eax],'a'-'A'
.b
inc eax
dec ebx
jnz .loop
sub eax,8
; 90,83,75,78,73,71
mov dword[.temp],44*65536*256+24*65536+72*256+40
mov word[.temp+4],41*256+50
add dword[.temp],34*65536*256+51*65536+11*256+50
add word[.temp+4],30*256+23
call .c
; 95,68,69,77,79,95
mov dword[.temp],25*65536*256+29*65536+31*256+62
mov word[.temp+4],43*256+18
add dword[.temp],52*65536*256+40*65536+37*256+33
add word[.temp+4],52*256+61
call .c
; 80,72,65,82,79,83
mov dword[.temp],11*65536*256+33*65536+24*256+35
mov word[.temp+4],52*256+30
add dword[.temp],71*65536*256+32*65536+48*256+45
add word[.temp+4],31*256+49
call .c
ret
.c
mov ebx,[.temp]
cmp [eax],ebx
jne .noteq
mov bx,[.temp+4]
cmp [eax+4],bx
jne .noteq
mov dword[eax],0
mov dword[eax+4],0
mov dword[eax+8],0
.noteq
ret
.temp dd 0,0
%macro ProcessOneDigit 1
cmp dl,9
jbe %%notover
add dl,65-48-10
%%notover
add dl,48
mov byte[.message+%1],dl
xor edx,edx
div ebx
%endmacro
NEWSYM TestSent
mov eax,[NetSent]
xor edx,edx
mov ebx,16
div ebx
ProcessOneDigit 3
ProcessOneDigit 2
ProcessOneDigit 1
ProcessOneDigit 0
mov eax,[valuea]
xor edx,edx
mov ebx,16
div ebx
ProcessOneDigit 8
ProcessOneDigit 7
ProcessOneDigit 6
ProcessOneDigit 5
mov dword[GUICMessage],.message
mov dword[GUICTimer],100000
ret
.message db 0,0,0,0,' ',0,0,0,0,0,0,0
NEWSYM StartGUI
; cmp byte[OSPort],1
; jbe .dosport
%ifndef __MSDOS__
mov byte[sampratenext+3],0
%endif
%ifdef __WIN32__
cmp byte[PrevFSMode],5
jne .notvm5
mov byte[PrevFSMode],7
.notvm5
%endif
cmp byte[TripBufAvail],0
jne .notexttb
mov byte[Triplebufen],0
.notexttb
cmp byte[FPUCopy],2
jne .2xSaIdis
cmp byte[newgfx16b],0
je .2xSaIdis
jmp .no2xSaIdis
.2xSaIdis
mov byte[En2xSaI],0
.no2xSaIdis
cmp byte[En2xSaI],0
je .no2xsaidis
mov byte[Triplebufen],0
.no2xsaidis
cmp byte[En2xSaI],0
je .no2xsaien
mov byte[scanlines],0
mov byte[antienab],0
.no2xsaien
;.dosport
mov ecx,64
mov eax,SpecialLine
.slloop
mov dword[eax],0
add eax,4
loop .slloop
; Change GUI to suit the Win32 port
; cmp byte[OSPort],3
; jne .nowinport
%ifndef __MSDOS__
; mov dword[GUIGUIOptnsText8+12],' GUI'
; mov byte[GUIGUIOptnsText8+16],0
%endif
;.nowinport
cmp byte[OldWinPos],0
jne .okayow
xor esi,esi
mov ecx,17
.nextow
mov eax,[GUIwinposx2+esi*4]
mov [GUIwinposx+esi*4],eax
mov eax,[GUIwinposy2+esi*4]
mov [GUIwinposy+esi*4],eax
inc esi
loop .nextow
mov byte[OldWinPos],1
mov eax,[pl1p209b]
mov [pl1p209],eax
.okayow
; mov al,[OSPort]
; mov [GOSPort],al
; cmp byte[GOSPort],3
; jne .notwinport
%ifndef __MSDOS__
mov dword[GUINetPlayMenuData+1],'INTE'
mov dword[GUINetPlayMenuData+5],'RNET'
mov dword[GUINetPlayMenuData+1+14],'----'
mov dword[GUINetPlayMenuData+5+14],'----'
mov byte[MenuDat5],0
mov byte[MenuDat5+1],2
%endif
;.notwinport
; copy old quickfilename to new quickfilename
cmp byte[prevloadl],0
jne .noconvertlfqm
mov byte[prevloadl],1
mov ecx,10
xor edx,edx
.convlfnlp
mov eax,ecx
dec eax
mov edx,eax
shl eax,9
shl edx,4
mov bl,16
.convlfnlp2
mov bh,[prevloadfname+edx]
mov [prevloadfnamel+eax],bh
inc edx
inc eax
dec bl
jnz .convlfnlp2
mov eax,ecx
dec eax
mov edx,eax
shl eax,9
shl edx,7
mov bl,128
.convlfnlp2b
mov bh,[prevloaddname+edx]
mov [prevloaddnamel+eax],bh
inc edx
inc eax
dec bl
jnz .convlfnlp2b
loop .convlfnlp
.noconvertlfqm
mov byte[GUIOn],1
mov byte[GUIOn2],1
mov eax,[NumComboLocl]
cmp byte[GUIComboGameSpec],0
jne .local
mov eax,[NumComboGlob]
.local
mov [NumCombo],eax
call ResetTripleBuf
cmp dword[GUIwinposx+16*4],0
jne .notzero
mov dword[GUIwinposx+16*4],3
mov dword[GUIwinposy+16*4],22
.notzero
xor ecx,ecx
.joysloop
cmp dword[pl1ULk+ecx*4],80h
jbe .nojoystick
mov dword[pl1ULk+ecx*4],0
.nojoystick
inc ecx
cmp ecx,16
jne .joysloop
mov dword[GUICTimer],0
cmp byte[OldVolume],1
jne .notold
mov byte[OldVolume],0
mov byte[MusicRelVol],100
mov byte[cfgvolume],100
; Initialize volume
xor eax,eax
xor edx,edx
mov al,[MusicRelVol]
shl eax,7
mov ebx,100
div ebx
cmp al,127
jb .noofb
mov al,127
.noofb
mov [MusicVol],al
.notold
mov byte[CheatSearchStatus],0
cmp byte[newgfx16b],0
je .nong
mov ecx,255*144
mov eax,[vidbufferofsb]
.loop
mov dword[eax],0
add eax,4
loop .loop
.nong
mov byte[ShowTimer],1
call Get_Date
cmp dh,12
jne .noxmas
cmp dl,25
jne .noxmas
mov byte[OkaySC],1
.noxmas
mov byte[lastmouseholded],1
mov eax,[welcome+8]
mov [GUIGUIAboutText1+8],eax
mov al,[welcome+12]
mov [GUIGUIAboutText1+12],al
mov al,[welcome+7]
mov [GUIGUIAboutText1+7],al
cmp dword[GUIwinposx+15*4],0
jne .nomoviemenufix
mov dword[GUIwinposx+15*4],50
mov dword[GUIwinposy+15*4],50
.nomoviemenufix
mov ax,[resolutn]
mov [PrevResoln],ax
mov word[resolutn],224
mov byte[GUIPalConv],0
mov byte[GUIGUIAboutText1],'Z'-86
add byte[GUIGUIAboutText1],86
mov byte[GUIGUIAboutText1+3],'E'-89
add byte[GUIGUIAboutText1+3],89
mov byte[MousePRClick],1
pushad
cmp byte[MouseInitOkay],1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -