?login_element?
?pathlinks? – Rev 583
Rev 766 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| Download
| RSS feed
tkeyangle=$-5
;LRDU
;DB -1 ;0000
;DB 128;0001
;DB 0 ;0010
;DB -1 ;0011
;DB 64 ;0100
DB 96 ;0101
DB 32 ;0110
DB 64 ;0111
DB 192;1000
DB 160;1001
DB 224;1010
DB 192;1011
DB -1 ;1100
DB 128;1101
DB 0 ;1110
DB -1 ;1111
tkeyangleend
CONTROL
IF kempston
LD C,#FF
IN A,(#1F)
LD B,A
AND #E0
jr NZ,nKEMPSTON
LD A,B
RRA
jr NC,$+4
RES 1,C
RRA
jr NC,$+4
RES 0,C
RRA
jr NC,$+4
RES 3,C
RRA
jr NC,$+4
RES 2,C
RRA
jr NC,$+4
RES 6,C
nKEMPSTON
;C=%1f11durl
ENDIF
IF autostrafe
BIT 3,C ;down
jr NZ,nAUTOSTRAFE
LD A,C
BIT 1,A
jr NZ,$+6
AND %01101111 ;strafe + rotate flag
OR %00001011 ;block down & rotate
BIT 0,A
jr NZ,$+6
AND %01011111 ;strafe + rotate flag
OR %00001011 ;block down & rotate
LD C,A
nAUTOSTRAFE
ENDIF
LD B,#FF
LD A,#7D
IN A,(#FE)
RRA
RL B ;space (fire)
LD A,#FD
IN A,(#FE)
RRA
RL B ;A
RRA
RRA
RL B ;D
RLA
RL B ;S (down)
LD A,#FB
IN A,(#FE)
RRA
RRA
RL B ;W (up)
LD A,#DF
IN A,(#FE)
RRA
RL B ;P (right)
RRA
LD A,B
RLA ;O (left)
IF kempston
AND C
ENDIF
;A=%1fADdurl
IF demoplay
demoplayoff=$
OR A
jr C,demoplayQ
BIT 4,A ;"D"
jr NZ,demoplaynOFF
LD A,#37 ;scf
LD (demoplayoff),A
LD A,#91 ;sub c
LD (mouseon),A
LD A,#FF
demoplaynOFF
democursor=$+1
LD HL,demobegin
demokey=$+1
LD A,%00111111
demokeytime=$+1
LD C,1
DEC C
jr NZ,CnNEWKEY
LD A,(HL)
LD (demokey),A
INC HL
LD C,(HL)
INC HL
LD (democursor),HL
CnNEWKEY
LD HL,demokeytime
LD (HL),C
demoplayQ
ELSE
IF demorec
democursor=$+1
LD HL,demobegin
demokeytime=$+1
LD C,0
INC C
jr Z,CNEWKEY
CP (HL)
jr Z,CnNEWKEY
CNEWKEY
INC HL
LD (HL),C
LD C,0
INC HL
CnNEWKEY
LD (HL),A
LD (democursor),HL
LD HL,demokeytime
LD (HL),C
ENDIF
ENDIF
PUSH AF
IMavision=$+1
LD HL,32*256
IMdavision=$+1
LD DE,100
AND %10110011
CP 0
LD ($-1),A
jr Z,$+4
LD E,50 ;key just pressed/released
IF autostrafe
BIT 7,A
jr NZ,nAUTOROTATE
BIT 4,A
jr NZ,$+3
ADD HL,DE
BIT 5,A
jr NZ,$+4
SBC HL,DE
nAUTOROTATE
ENDIF
IF doublerotate
RRA
jr C,$+4
ADD HL,DE
ADD HL,DE
RRA
jr C,$+6
SBC HL,DE
SBC HL,DE
ELSE
RRA
jr C,$+3
ADD HL,DE
RRA
jr C,$+4
SBC HL,DE
ENDIF
LD A,E
ADD A,12;10
jr C,$+3
LD E,A ;key held: increase rotspd
LD (IMdavision),DE
IF mouse
LD BC,#FBDF
IN A,(C)
mouseoldx=$+1
LD C,0
LD ($-1),A
mouseon=$
IF demoplay
XOR A
ELSE
SUB C
ENDIF
NEG
LD E,A
RLA
SBC A,A
LD D,A
EXD
DUP 6
ADD HL,HL
EDUP
ADD HL,DE
ENDIF
LD (IMavision),HL
;делим вектор на коэфф замедления
IMcurDX=$+1
LD HL,0
LD B,H
ld A,L
SRA B
RRA
IF doublespeed
SRA B
RRA
ENDIF
LD C,A
CP B
jr NZ,$+3
LD C,L
SBC HL,BC
LD B,H
ld C,L
CSLOWXQ
IMcurDY=$+1
LD HL,0
LD D,H
ld A,L
SRA D
RRA
IF doublespeed
SRA D
RRA
ENDIF
LD E,A
CP D
jr NZ,$+3
LD E,L
SBC HL,DE
LD D,H
ld E,L
CSLOWYQ
POP AF ;%00ADSWPO
RRCA
RRCA
AND 15
LD HL,tkeyangle
ADD A,L
LD L,A
IF (tkeyangle^tkeyangleend)&256
ADC A,H
SUB L
LD H,A
ENDIF
LD A,(HL)
;прибавляем вектор направления
;sin и cos (IMavision+32*N), где N=0..7 в зав. от клавиш
;0=forth
;64=left
CP -1
JP Z,CTRLnspeed
LD HL,IMavision+1
ADD A,(HL)
LD L,A
LD H,tcos/256 ;-pi/4..+pi/4
LD A,(HL)
ADD A,C
LD C,A
BIT 7,(HL)
jr NZ,$+3
INC B
jr C,$+3
DEC B
LD A,64
SUB L
LD L,A
LD A,(HL)
ADD A,E
LD E,A
BIT 7,(HL)
jr NZ,$+3
INC D
jr C,$+3
DEC D
CTRLnspeed
LD (IMcurDX),BC
LD (IMcurDY),DE
DUP 2
SRA D
RR E
SRA B
RR C
EDUP
LD HL,(IMcurXx)
ADD HL,BC
BIT 7,B
PUSH DE,HL
LD HL,(IMcurXx)
LD DE,256-mindist ;dx>0
jr Z,$+4
LD E,mindist ;dx<0
ADD HL,DE
LD A,H
LD HL,(IMcurYy)
LD E,mindist
SBC HL,DE
LD B,H
ADD HL,DE
ADD HL,DE
LD L,A
SET mapdifbit,L
LD A,(HL)
LD H,B
OR (HL)
POP HL,DE
RLA
jr C,CTRLnX
LD (IMcurXx),HL
CTRLnX
LD HL,(IMcurYy)
ADD HL,DE
BIT 7,D
PUSH HL
LD HL,(IMcurYy)
LD DE,256-mindist ;dx>0
jr Z,$+4
LD E,mindist ;dx<0
ADD HL,DE
LD A,H
LD HL,(IMcurXx)
LD E,mindist
SBC HL,DE
LD B,H
ADD HL,DE
ADD HL,DE
LD L,H
LD H,A
LD A,(HL)
LD L,B
OR (HL)
POP HL
RLA
RET C
LD (IMcurYy),HL ;H!=0
RET