GSP60 CALL GSP
AND #7F
CP #60
RET
ACTION LD A,(BZON)
CP 15
RET NC
LD HL,ACTT
CALL WT
JP (HL)
ACTT DEFW ACT_0,SELALI,SELGUN,N_FLR,LIFT,N_MAN,P_MAN
DEFW NX_MOV,P_FIRE,N_FIRE,MCENTR
DEFW BYE,C_SAVE,C_LOAD,X_MAN
LOOKS CALL LOOK ;осмотр местности
CALL LOOK_A ;поиск врагов
JP LA_OUT
MCENTR CALL CENTR
CALL LOOKS
JP ALLSPF
P_FIRE LD A,1 ;приц.стрельба
JR P_F0
N_FIRE XOR A ;норм.стрельба
P_F0 LD (FIRTYP),A
_BRE CALL MEM7
CALL BOFF
CALL PANELM
CALL BNEW
JP BOUT
N_FLR LD A,(FLR);смена этажа
CPL
AND 1
CALL FLOOR
JP ALLSPF
SELGUN ;выбор оружия
LD A,25
CALL HER_BA
LD A,(BX)
SUB 13
SRL A
SRL A
LD (HL),A
CALL E_I
JR _BRE
IND_LS PUSH BC;выв.инд.сохр.
CALL MEM7
POP BC
LD A,32
SUB B
CP 28
JR C,C_S1
LD A,27
C_S1 LD E,225
ADD A,E
LD E,A
LD A,D
LD D,+(ATR+512)/256
LD (DE),A
RET
C_SAVE LD A,(FLR)
LD (OLDFLR),A
LD HL,#E000 ;RAM-save
LD BC,#2000
C_S0 PUSH BC
CALL PT128
LD D,(HL)
CALL MEM7
LD (HL),D
POP BC
INC HL
DEC C
JR NZ,C_S0
LD D,#57
CALL IND_LS
DEC B
JR NZ,C_S0
LD HL,B_DAT
LD DE,#DB00
LD BC,#100
LDIR
LD HL,MAN
LD BC,#400
LDIR
L_Sr CALL MEM7
ATRs #1700,#1D01,#68
JP PT128
C_LOAD LD HL,#E000 ;RAM-load
LD BC,#2000
C_L0 PUSH BC
CALL MEM7
LD D,(HL)
CALL PT128
LD (HL),D
POP BC
INC HL
DEC C
JR NZ,C_L0
LD D,#4D
CALL IND_LS
DEC B
JR NZ,C_L0
CALL MEM7
LD DE,B_DAT
LD HL,#DB00
LD BC,B_LEN
LDIR
LD DE,MAN
LD HL,#DC00
LD BC,#400
LDIR
CALL PT128
LD A,(OLDFLR)
LD HL,(X0)
EXX
CALL FLOOR
EXX
LD (X0),HL
CALL ALLSPF
CALL PANELM
JR L_Sr
MUb DEFW #202,#4918
BYE ;эвакуация
LD IX,MUb
CALL S_BACK
CALL STD
CALL MENU
CALL S_COPY
CALL YES_NO
LD A,1
JP Z,BATRET
CALL ALLSPF
CALL VZLOM
CALL ATREST
JP OUTDSC
N_MAN LD HL,HER_N ;след.чел.
LD A,(HL)
INC A
CP 32
JR C,N_M1
XOR A
N_M1 CALL NEWHER
PUSH HL
POP IX
CALL HERLIV
JR Z,N_MAN
LD A,(IX+5)
OR A
JR Z,PN_M
JR N_MAN
P_MAN LD HL,HER_N ;пред.чел.
LD A,(HL)
OR A
JR NZ,P_M1
LD A,32
P_M1 DEC A
CALL NEWHER
PUSH HL
POP IX
CALL HERLIV
JR Z,P_MAN
LD A,(IX+5)
OR A
JR NZ,P_MAN
PN_M CALL CENTR
CALL LOOKS
CALL ALLSPF
JP _BRE
BEEP LD A,10
CALL SOUNDn
LD BC,#1708;ЗВУК
BEP1 LD A,C
XOR #18
LD C,A
OUT (254),A
LD D,2
BEP0 DEC DE
LD A,E
OR D
JR NZ,BEP0
DJNZ BEP1
RET
X_MAN ;Вдача парам. бойцов
LD IX,(HER_AD)
LD A,(IX+4)
OR (IX+5)
JR NZ,BEEP
LD A,(HER_N)
RLCA
RLCA
LD HL,AQNAVT
CALL DD
LD (SOLD_D),HL
LD A,H
LD (B_DRAW),A
CALL DRAW_P
XOR A
LD (B_DRAW),A
CALL CHNGRG
BYTs #1C,#410,#FF
LD A,#14
LD (Db),A
LD (HIGH),A
LD B,6
LD HL,#40A
LD IX,(HER_AD)
XDWP PUSH BC
PUSH HL
CHNs NOP_
LD (SX),HL
LD A,(IX+11)
CALL WB
LD A,(Db)
ADD A,16
LD (Db),A
LD D,A
LD E,#71
LD H,0
LD A,(IX+11)
INC IX
OR A
JR Z,XDR5
LD L,A
DEC L
ADD HL,DE
LD B,9
CHNs XOR_
XDR4 CALL LINE
INC H
INC D
DJNZ XDR4
XDR5 POP HL
INC H
INC H
POP BC
DJNZ XDWP
LD A,(IX+20);Freez
ADD A,#71
LD L,A
LD E,L
LD H,69
LD D,69+6
CALL LINE
XOR A
LD (HIGH),A
CALL XN_MAN
CALL COPYAT
XDR6 CALL CONTR
OR A
JR Z,XDR6
RRCA
JR C,XDnx
RRCA
JR C,XDpr
AND 4
JR Z,XDR6
CALL PANEL1
CALL CENTR
CALL LOOKS
CALL ALLSPF
CALL PANELM
JP BNEW
XDnx LD HL,HER_N
LD A,(HL)
INC A
CP 10
JR C,XDR7
XOR A
XDR7 CALL NEWHER
PUSH HL
POP IX
CALL HERLIV
JR Z,XDnx
LD A,(IX+4)
OR (IX+5)
JR NZ,XDnx
XDDR JP X_MAN
XDpr LD HL,HER_N
LD A,(HL)
OR A
JR NZ,XDR8
LD A,10
XDR8 DEC A
CALL NEWHER
PUSH HL
POP IX
CALL HERLIV
JR Z,XDpr
LD A,(IX+5)
OR (IX+4)
JR NZ,XDpr
JR XDDR
XN_MAN ;число активных акв
LD HL,#1600
LD (SX),HL
LD A,201
CALL NWRDM
LD IX,MAN
LD DE,32
LD BC,#A00
XNM1 CALL HERLIV
JR Z,XNM0
LD A,(IX+5)
OR (IX+4)
JR NZ,XNM0
INC C
XNM0 ADD IX,DE
DJNZ XNM1
LD A,C
JP WB
T_LIFT DEFB #FF
LIFTYP ;тип лифта в HL (0-oбычн, 1-по Х, 2-по Y, FF-нет)
LD (TX),HL
CALL ATSPM
AND %11100
CP %10000 ;lift
LD A,0
JR Z,LYret
LD A,(FLR)
OR A
JR Z,LY0
LD HL,TX
DEC (HL)
CALL ATSPM
AND %11100
CP %01000
LD A,1
JR Z,LYret
INC (HL)
INC HL
DEC (HL)
CALL ATSPM
AND %11100
CP %01100
LD A,#FF
JR NZ,LYret
LD A,2
LYret LD (T_LIFT),A
RET
LY0 INC A
CALL FLOOR
LD HL,TX
INC (HL)
CALL ATSPM
AND %11100
CP %01000
LD A,1
JR Z,LYret1
DEC (HL)
INC HL
INC (HL)
CALL ATSPM
AND %11100
CP %01100
LD A,#FF
JR NZ,LYret1
LD A,2
LYret1 PUSH AF
XOR A
CALL FLOOR
POP AF
JR LYret
LIFTd DEFB 0
CANDWN ;можно ли вниз/вверх? (NC-yes) HL-new coord LIFTd-dir
LD A,(FLR)
PUSH AF
LD IX,(HER_AD)
LD A,(IX+2)
CALL FLOOR
CALL GET_XY
PUSH HL
CALL LIFTYP
POP HL
CP 3
JR C,Cw1
CwBAD POP AF
CALL FLOOR
SCF
RET
Cw1 OR A
JR NZ,Cw2
CPL
CwOK LD (LIFTd),A
LD A,(FLR)
XOR 1
CALL FLOOR
LD (TX),HL
CALL GSP60
JR C,Cw5
PUSH HL
PUSH IX
SUB #60
CALL GET_IX
CALL HERLIV
POP IX
POP HL
JR NZ,CwBAD
Cw5 POP AF
CALL FLOOR
XOR A
RET
Cw2 CP 2
LD A,(FLR)
JR Z,Cw6
OR A
JR NZ,Cw3
INC L
INC L
XOR A
JR CwOK
Cw3 DEC L
DEC L
LD A,4
JR CwOK
Cw6 OR A
JR NZ,Cw4
INC H
INC H
LD A,6
JR CwOK
Cw4 DEC H
DEC H
LD A,2
JR CwOK
LIFT ;Лифт/Лестница
CALL CANDWN
JP C,BEEP
PUSH HL
LD DE,#800
CALL DECPAR
POP HL
RET C
PUSH HL
LD A,(IX+2)
PUSH AF
CALL FLOOR
CALL GET_XY
LD (TX),HL
LD A,(IX+7)
CALL PSP
POP AF
POP HL
LD (IX),L
LD (IX+1),H
XOR 1
LD (IX+2),A
CALL FLOOR
LD A,(LIFTd)
CP 8
JR NC,Li1
LD (IX+3),A
Li1 LD (TX),HL
CALL GSP60
JR C,Li11
SUB #60 ;если труп в лифте
CALL GET_AD
LD A,7
CALL BA
AND #7F
Li11 LD (IX+7),A
LD A,(HER_N)
ADD A,#60
CALL PSP
JP MCENTR
ACT_0 ;указание на поле (ходить или выбрать персонажа)
;jr $
LD HL,(PPX) ;координаты курсора
LD (TX),HL ;текущие координаты тайла
CALL GSP60 ;проверяем, что текущий тайл >=#60 (акванавт) - это выбор
JP NC,ACT_H
CALL ATSP_
BIT 5,A
JP Z,BEEP
CALL GET_DE
LD A,(FLR)
CP (HL)
JP NZ,BEEP
LD A,(HL)
LD (OLDFLR),A
PUSH DE
LD HL,(PPX)
CALL TRACE1
POP DE
JP C,BEEP
PUSH DE
CALL TRACE2
PUSH DE
AC_MV LD A,(DE)
CP 8
JR NC,AC_RET
AND 1
PUSH DE
PUSH AF
CALL OUTDSC
POP AF
LD DE,#402
JR Z,AC_MV4
LD DE,#603
AC_MV4 CALL DECPAR;====
JR NC,AC_MV6
POP DE
AC_RET XOR A
LD (isLOOK),A
CPL
LD (DE),A
CALL OUTDSC
POP BC ;tab
POP DE ;coord
AC_ML0 LD A,(BC)
CP 8
JR NC,AC_ML1
LD HL,NXtXY
CALL WT
LD (AC_NXT),HL
EX DE,HL
AC_NXT DEC L
DEC H
EX DE,HL
LD A,(OLDFLR)
OR A
LD A,(BC)
PUSH BC
PUSH DE
CALL LOOK_
POP DE
POP BC
DEC BC
JR AC_ML0
AC_ML1 LD A,(isLOOK)
LD HL,(isNEW)
OR L
CALL NZ,ALLSPF
JP LA_OUT
AC_MV2 CALL OUTDSC
CALL LA_OUT
AC_MV6 CALL PBU
POP DE
LD A,(DE)
PUSH DE
CALL HERMOV
JR C,AC_MV2
POP DE
DEC DE
BIT 7,(IX+7)
JR NZ,ACstop
PUSH DE
CALL LOOK_A
POP DE
JR Z,AC_MV
ACstop LD A,255
LD (DE),A
JR AC_MV
ACT_H SUB #60
LD C,A ;номер персонажа
CALL GET_IX
CALL HERLIV
JP Z,BEEP
LD A,(IX+5)
OR A
JP NZ,BEEP
LD A,C
CALL NEWHER
CALL BNEW
CALL PANELM
CALL LOOKS
LD A,(isLOOK)
OR A
CALL NZ,ALLSPF
JP OUTDSC
LOOKER LD BC,#FDFE ;осмотр ПО напр
IN A,(C)
AND 2 ;кл.S
JR Z,LOKOK
LD A,(CONTRB)
AND %1000000
RET Z
LOKOK CALL GETZON
LD A,(BZON)
OR A
RET NZ
LOKK LD IX,(HER_AD)
CALL GET_XY
CALL DIRF
CP #FE
RET Z
LD D,(IX+3)
SUB D
JP Z,ALLSPF
LD E,A
PUSH DE
LD DE,#100
CALL DECPAR
JR NC,LKK9
POP AF
LKKR JP ALLSPF
LKK9 POP DE
LD A,E
AND 7
CP 4
LD A,D
JR NC,LKK1
INC A
INC A
LKK1 DEC A
AND 7
LD (IX+3),A
LD A,(FLR)
PUSH AF
LD A,(IX+2)
CALL FLOOR
CALL LOOKS
CALL ALLSPF
CALL OUTDSC
POP AF
CALL FLOOR
LD A,(isNEW)
OR A
JR Z,LOKK
JR LKKR
DIR LD DE,(PPX)
DIR_ LD A,D ;направл HL->DE
CP #C0
JR C,LK2
XOR A
LK2 SUB H
EX AF,AF
LD A,E
CP #C0
JR C,LK3
XOR A
LK3 SUB L
JR Z,LK0
JR C,LK1
EX AF,AF
LD A,0
RET Z
LD A,1
RET C
LD A,7
RET
LK0 EX AF,AF
LD A,#FE
RET Z
LD A,2
RET C
LD A,6
RET
LK1 EX AF,AF
LD A,4
RET Z
LD A,3
RET C
LD A,5
RET
DIRF ;dir с равномерными секторами
CALL DIR
BIT 0,A
RET Z
PUSH AF
LD A,E
SUB L
JR NC,RF1
NEG
RF1 LD L,A
LD A,D
SUB H
JR NC,RF2
NEG
RF2 LD H,A
SLA A
CP L
JR C,RFM1
LD A,L
SLA A
CP H
JR C,RFM2
POP AF
RET
RFT1 DEFB 0,4,4,0
RFT2 DEFB 2,2,6,6
RFM1 LD HL,RFT1
JR RFM0
RFM2 LD HL,RFT2
RFM0 POP AF
SRA A
JP BA
ENDBAT LD HL,0 ;КОНЕЦ БОЯ?
LD B,32
LD IX,MAN
LD DE,32
EB1 CALL HERLIV
JR Z,EB0
LD A,(IX+5)
OR A
JR NZ,EB2
INC L
JR EB0
EB2 INC H
EB0 ADD IX,DE
DJNZ EB1
LD A,L
OR A
EB3 JP Z,BATRET
LD A,H
OR A
LD A,2
JR Z,EB3
RET
CURGUN LD A,25 ;N тек оруж (NC-нет)
CALL HER_BA
ADD A,17
CALL HER_BA
LD (G_TYPE),A
CP 200
RET
GUN_BT ;поле А текущ. оружия /0
PUSH HL
PUSH AF
LD A,(G_TYPE)
;CUR_g ;CALL CURGUN
CP 200
JR C,GUT1
POP AF
POP HL
XOR A
RET
GUT1 RLCA
RLCA
RLCA
LD L,A
POP AF
ADD A,L
LD HL,WEAPON
CALL BA
POP HL
RET
GUNTIM ;вычисл G_TIME
CALL CURGUN
LD A,(FIRTYP)
CALL GUN_BT
LD E,A
LD A,27
CALL HER_BA
LD L,A
CALL MULB
LD L,100
CALL DIVB2
LD A,E
LD (G_TIME),A
RET
GUNOUT ;выв. G_TIME
CALL GUNTIM
CALL WTRB
LD BC,FONT
LD HL,DCS+8
LD DE,#120D
LD A,2
JP PRINT
REPAR ;восст. парам текущ гер
LD A,27 ;TU=TUold
CALL HER_BA
PUSH HL
LD C,A
LD A,11
CALL HER_BA
LD B,(HL)
LD (HL),C
INC HL ;EN=EN+ENold/4+TUостаток/4
POP DE
INC DE
LD A,(DE)
SRL B
SRL A
ADD A,B
SRL A
ADD A,(HL)
LD (HL),A
LD A,(DE)
JR C,REPA4
CP (HL)
JR NC,REPA1
REPA4 LD (HL),A
REPA1 INC HL
LD A,(HL) ;HEALTH=HEALTH-WOUND
INC HL
SUB (HL)
JR NC,REPA2
XOR A
REPA2 DEC HL
LD (HL),A
OR A
JR Z,REPFW
INC HL
INC HL
LD A,(HL) ;MORAL (+6)
ADD A,6
LD (HL),A
INC DE
INC DE
INC DE
LD A,(DE)
CP (HL)
RET NC
LD (HL),A
RET
REPFW ;смерть от F.WOUND
LD A,4
CALL HER_BA
OR A
RET NZ
CALL CENTR4
CALL ALLSPF
CALL OUTDSC
LD A,8
CALL HER_BA
LD (MU68+4),A
LD IX,MU68
JR S_MENU
CENTR4 CALL CENTR ;центрир на 4 вниз
LD HL,X0
DEC (HL)
DEC (HL)
DEC (HL)
DEC (HL)
INC HL
DEC (HL)
DEC (HL)
DEC (HL)
DEC (HL)
RET
MU68 DEFW #203,#4416
DEFB 0
S_BACK CALL MEM7 ;экр в DSCR
CALL BACK
S_bc JP PT128
S_COPY CALL MEM7 ;DSCR в экр
CALL COPYAT
JR S_bc
ATREST CALL MEM7 ;восст атр экр
CALL STS
LD HL,#101
LD BC,#1C10
LD A,(COLOR)
CALL ATRBAR
JP PT128
S_MENU CALL S_BACK ;меню в бою
CALL STD
CALL MENU
CALL S_COPY
CALL TMOF
CALL ALLSPF
CALL ATREST
JP OUTDSC
DECGUN ;dec парам при выстреле
CALL CURGUN
CP 10
JR Z,DG1
INC HL
INC HL
INC HL
INC HL
LD A,(HL)
OR A
JR NZ,DG2
LD A,6
CALL GUN_BT
OR A
JR Z,DG30
CALL MANALI
JR NZ,DG9
CALL MEM7
LD B,3
DG7 PUSH BC ;нет патронов
LD A,#55
CALL DGB
LD A,#70
CALL DGB
POP BC
DJNZ DG7
CALL PT128
DG9 SCF
RET C
DGB LD HL,ATR+717
LD (HL),A
PUSH HL
POP DE
INC DE
LD BC,15
LDIR
LD B,5
DGB1 CALL E_I
DJNZ DGB1
RET
DG2 DEC (HL)
CALL DGGU
JR NC,DG3
INC (HL)
RET
DG30 CALL DGGU
RET C
DG3 CALL MANALI
RET NZ
CALL CURGUN
LD HL,WP_PRC
CALL WT
LD IX,DOLG
CALL INCR
OR A
RET
DGGU PUSH HL
CALL GUNTIM
LD D,A
LD E,0
CALL DECPAR
POP HL
RET
DG1 CALL DGGU
RET C
LD (HL),#FF ;граната
RET
MANALI LD A,5;наш/не наш - Z/NZ
CALL HER_BA
OR A
RET
GUN14 ;супервизор
CALL DECGUN
RET C
CALL STD
CALL OFFD
LD HL,(HER_AD)
LD A,(HL)
SUB 13
LD E,A
INC HL
LD A,(HL)
SUB 11
LD D,A
INC HL
LD A,(HL)
CALL FLOOR
EX DE,HL
LD DE,#2
PUSH DE
LD C,23
G140 LD B,27
PUSH HL
PUSH DE
G141 PUSH BC
PUSH HL
LD (TX),HL
CALL GSP
LD C,2
CP C
JR C,G14E
CP #80
JR C,G146
AND #7F
CP #60
JR C,G14E
LD C,11
JR NC,G14H
G146 CP #60
JR C,G143
LD C,1
G14H SUB #60
CALL GET_IX
CALL HERLIV
JR Z,G14E
DEC C
JR G14E
G143 CALL ATSPM
LD B,A
AND %11100
LD C,9
CP %00100 ;дверь
JR Z,G14E
DEC C
CP %10000 ;лифт
JR Z,G14E
DEC C
CP %01100 ;л1
JR Z,G14E
DEC C
CP %01000 ;л2
JR Z,G14E
DEC C
LD A,B
AND %10100000
CP %10100000 ;V&M
JR Z,G14E
DEC C
OR A ;~V&~M
JR Z,G14E
DEC C
G14E LD HL,SX
LD (HL),C
Ms 3
LD A,1
LD BC,xMAP
CALL PRINT
CALL PT128
POP HL
POP BC
INC L
DJNZ G141
POP DE
POP HL
INC D
INC H
DEC C
JR NZ,G140
POP HL
LD BC,#2018
LD A,#58
CALL ATRBAR
LD BC,#1B17
LD L,2
LD A,#69
CALL ATRBAR
LD A,#6A
LD (DATR+367),A
CHNs XOR_
LD HL,#02E9
LD DE,#B9E9
CALL LINE
DEC E
LD HL,#B912
CALL LINE
CALL S_COPY
CALL TMOF
CALL PANEL1
CALL PANELM
CALL CENTR
CALL ALLSPF
JP OUTDSC
FIR_T DEFW G_NORM,G_BOOM,G_BOOM,G_BOOM,G_NORM,G_TOCH,G_TOCH
DEFW G_BOOM,G_NORM,G_NORM,GRENAD,G_TOCH,GUN12,G_TOCH,GUN14
DEFW 0,G_TOCH
FIRER ;Cтрельба
LD BC,#FEFE
IN A,(C)
RRA
JR NC,FROK
LD A,(CONTRB)
AND %100000
RET Z
FROK LD HL,(X0)
LD (X0old),HL
CALL GET_DE
LD HL,(PPX)
AND A
SBC HL,DE
JP Z,BEEP
CALL CURGUN
JP NC,BEEP
LD HL,FIR_T
CALL WT
LD (FIR_C+1),HL
LD A,1
LD (afterE),A
CALL GETZON
LD A,(BZON)
OR A ;NZ-вне поля
FIR_C CALL FROK
CALL ENDBAT
CALL T_DEAD
JP _BRE
T_DEAD ;текущ герой умер?
LD IX,(HER_AD)
CALL HERLIV
RET NZ
CALL OUTDSC
JP HER1st
X0old DEFW 2
FLRold DEFB 1
afterE DEFB 1 ;не 0-выполнить afterF
afterF LD HL,afterE
LD A,(HL)
LD (HL),1
OR A
RET Z
PUSH IX
XOR A ;просмотр/центровка после выстрела
LD (isLOOK),A
LD A,(FLR)
PUSH AF
CALL LOOKS
POP AF
CALL FLOOR
LD HL,(X0old)
LD DE,(X0)
LD (X0),HL
XOR A
SBC HL,DE
JR Z,FIR_0
INC A
JR FIR_1
FIR_0 LD A,(isLOOK)
FIR_1 OR A
CALL NZ,ALLSPF
POP IX
RET
DECHER ;уменьш. парам при выстреле
;(A-F.WOUND,D-HEALTH,E-FREEZE)
EX AF,AF
LD A,(IX+10)
OR A
JR Z,DEH5
LD B,A ;защита ослабит удар
LD A,D
SRL D
SRL D
DEH6 SUB D
DJNZ DEH6
LD D,A
DEH5 EX AF,AF
ADD A,(IX+14)
LD (IX+14),A
LD A,(IX+13)
SUB D
JR NC,DEH1
XOR A
DEH1 LD (IX+13),A
LD A,(IX+26)
ADD A,E
CP 220
JR C,DEH2
LD A,220
DEH2 LD (IX+26),A
LD A,(IX+4)
OR A
RET NZ
CALL RND ;понижение морали для людей
AND %101010
RET NZ
CALL RND
AND 4
INC A
ADD A,(IX+13)
CP 20
JR NC,DEH8
LD (IX+13),A
DEH8 CALL RND
AND 31
ADD A,22
LD E,A
LD A,(IX+15)
SUB E
JR NC,DEH7
XOR A
DEH7 LD (IX+15),A
RET
FWOUND DEFB 0,0,3,1,0,0,1,2,1,2,1,0,0,0
G_HeFr ;dHEALTH->D;dFREEZE->E;dF_WOUND->A
LD A,4
CALL GUN_BT
LD D,A
LD A,5
CALL GUN_BT
LD E,A
CALL RND
AND %101 ;понижение D в 25%
JR NZ,G_H1
SRL D
CALL RND
AND %10000
JR NZ,G_H1
SRL D
G_H1 CALL RND
AND %100 ;0->FW в 50%
RET Z
LD A,(G_TYPE)
LD HL,FWOUND
CALL BA
RET
G_TOCH ;контактное оруж.
LD IX,(HER_AD)
LD A,(IX+2)
CALL FLOOR
CALL NEXTXY
LD (TX),HL
LD (FX2),HL
CALL GSP60
JR C,G_ERR1
SUB #60
CALL GET_IX
CALL HERLIV
JR Z,G_ERR1
PUSH IX
CALL DECGUN
POP IX
RET C
LD A,(G_TYPE)
CP 13
JR Z,GUN13
CP 16
JP Z,G_TENT
CALL afterF
CALL FLASHs
CALL FLASHs
CALL FLASHs
CALL FLASHs
CALL G_HeFr
CALL DECHER
JP ALLSPF
G_ERR1 LD IX,MU58
JP S_MENU
GUN13 LD A,(IX+14) ;релакс
OR A
JR Z,G130
DEC (IX+14)
G130 LD A,(IX+13)
ADD A,10
LD B,(IX+29)
CP B
JR C,G131
LD A,B
G131 LD (IX+13),A
CALL afterF
CALL FLASHs
JP FLASHs
MU58 DEFW #402,#3A18
PPXOUT ;курсор вне поля
LD HL,(PPX)
LD DE,(XMAX)
INC D
INC E
LD A,H
CP D
JR NC,PPXBAD
LD A,L
CP E
RET C
PPXBAD POP HL
POP BC
PPB JP BEEP
G_NORM JR NZ,G_BOOM
CALL PPXOUT
CALL DECGUN
RET C
CALL FIRE
JR Z,G_NO1
CALL FLAMER
LD A,(HER_N)
PUSH AF
LD A,(FIRTYP)
PUSH AF
CALL FX2TX
CALL GSP60
JR C,G_NO2
SUB #60
CALL NEWHER
LD IX,(HER_AD)
LD A,(IX+4)
CP 3
JR C,G_NO2
CP 6
JR NC,G_NO2
CALL HERLIV
CALL NZ,A_FIRE
G_NO2 POP AF
LD (FIRTYP),A
POP AF
CALL NEWHER
G_NO1 JP afterF
G_BOOM JR NZ,PPB
CALL PPXOUT
CALL DECGUN
RET C
CALL FIRE
CALL NZ,BOOMER
JP afterF
GRENAD JR NZ,G_BOOM
LD A,(CANF_B)
CP #68
JR NZ,PPB
CALL PPXOUT
CALL DECGUN
RET C
CALL FIRE_G
CALL GR_SET
JP afterF
SET_AD ;адрес DIMSET->HL (NC-исчерпан)
LD HL,SET_N
LD A,(HL)
CP SETLEN-1
JR NC,STA
INC (HL)
STA LD C,A
ADD A,A
ADD A,A
ADD A,C
LD E,A
LD D,0
INC HL
ADD HL,DE
RET
GR_SET ;зап поз гран
CALL SET_AD
LD DE,(FX2)
LD (HL),E
INC HL
LD (HL),D
INC HL
LD A,(FLR)
LD (HL),A
INC HL
LD (HL),0
RET
GUN12 ;МС-контроль
JR NZ,G_BOOM
CALL PPXOUT
CALL DECGUN
RET C
CALL FIRE
JR Z,G120
CALL FX2TX
CALL GSP60
RET C
SUB #60
CALL GET_IX
CALL HERLIV
RET Z
CALL FLASH
CALL FLASH
CALL FLASH
LD A,5
CALL HER_BA
CP (IX+5)
JR Z,G120 ;свой своего
LD (IX+5),A
OR A
LD A,(IX+4)
JR NZ,G12A
LD (IX+6),0
LD C,#41 ;под наш
ADD A,21
CP 21
JR NZ,G121
LD A,(IX+8)
INC C
JR G121
G12A LD C,#43 ;под их
ADD A,21
CP 21
JR NZ,G121
LD A,(IX+8)
LD C,#40
;сообщение о взятии под контроль
G121 LD (MU60n),A
LD IX,MU60x
LD (IX+3),C
CALL S_MENU
G120 JP afterF
MU60x DEFW #402,#6018
MU60n DEFB 55
FX EQU LIN_XY ;коорд.пули x2
FY EQU LIN_XY+1
FHIGH DEFB 0;высота 31..0
PF_HL DEFW 0,64,63,128
PF_REL DEFW 0,1,#100,#101
BULL EQU DATR+512
F_PUT XOR A ;вывод изобр. пули из BULL
LD HL,(FX)
SRL H
JR NC,PF_1
INC A
INC A
PF_1 SRL L
JR NC,PF2
INC A
PF2 LD C,A
LD (TX),HL
CALL INFR
RET NC
CALL XYHL
LD DE,DSCR+257
ADD HL,DE
EX DE,HL
LD A,C
LD HL,PF_HL
CALL WT
ADD HL,DE
LD A,C
PUSH AF
AND 3
LD A,0
JP PE,PF3
LD A,2
PF3 LD DE,BULL
CALL HERO
POP AF
LD HL,PF_REL
CALL WT
LD DE,(TX)
ADD HL,DE
LD (TX),HL
PUSH HL
CALL GSP60
CCF
JR C,PF7
LD HL,vSIZE
CALL BA
CP 21 ;высота видимости
PF7 POP HL
CALL C,RELA
INC H
CALL RELA
DEC H
INC L
JP RELA
F_IMG ;созд. изобр. в BULL
LD A,(G_TYPE)
F_IMG_ EX AF,AF
Ms 4
XOR A
LD HL,BULL
PUSH HL
LD DE,BULL+1
LD (HL),A
LD BC,95
LDIR
LD H,A
EX AF,AF
CP 11
JR C,FG1
LD A,11
FG1 RLCA
RLCA
LD L,A
ADD HL,HL
ADD HL,HL
ADD HL,HL
LD DE,xBULL
ADD HL,DE
EX DE,HL
LD A,(FHIGH)
AND #F
RLCA
RLCA
LD C,A
POP HL
ADD HL,BC
EX DE,HL
LD C,24
LDIR
PUSH HL
CALL PT128
CALL FX2TX
CALL GSP
POP HL
CP 2
JR C,FG0
Ms 4
LD BC,8
LD DE,BULL+84
LDIR
FG0 JP PT128
FIRini CALL GET_DE
LD A,(FLR)
PUSH AF
PUSH HL
CP (HL)
JR NZ,RI00
LD (TX),DE
CALL INFR
JR C,RI0
RI00 CALL CENTR
CALL ALLSPF
RI0 CALL GET_DE
LD (FX2),DE
SLA D
SLA E
LD (FX),DE
LD HL,(PPX)
LD A,(G_TYPE)
CP 10
CALL NZ,CORR_T;correct_target
SLA H
SLA L
CALL LINini
POP HL
POP AF
LD C,23
OR A
JR NZ,RI1
LD C,7
RI1 ;correct_high
CALL RND
AND 3
ADD A,C
CALL HI_10
LD C,A
LD A,(HL)
OR A
LD A,23
JR NZ,RI2
LD A,7
RI2 LD (FHIGH),A
SUB C
LD C,1 ;up
JR NC,RI3
DEC C ;dwn
NEG
RI3 LD L,A
SRL A
LD (DHIGH),A
LD A,(LIN_LN)
LD H,A
LD (PHIGH),HL
LD A,C
LD (F_SH),A
RET
HI_10 ;кон.выс. для гранаты
PUSH AF
LD A,(G_TYPE)
CP 10
JR Z,HIy10
POP AF
RET
HIy10 POP AF
OR #F
INC A
RET
gPARAB DEFB 0,-1,-1,-1,-1,-1,-1,-1,-0,-1,-0,-1,-0,-0,-1,-0
DEFB 0,0,1,0,0,1,0,1,0,1,1,1,1,1,1,1,2
G_STP DEFB 0 ;фаза полета
G_sTMP DEFB 0 ;-""- текущ
G_CORR ;коррекц.выс для гран
LD HL,G_STP
INC (HL)
LD L,(HL)
LD H,0
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL ;x32
EX DE,HL
LD HL,(LIN_LN)
CALL DIVB2
LD A,E
CP 32
JR NC,GC01
LD A,(FHIGH)
EX AF,AF
LD A,(G_sTMP)
PUSH AF
LD HL,gPARAB
CALL BA
POP AF
GC0 CP E
JR NC,GC2
EX AF,AF
ADD A,(HL)
INC HL
EX AF,AF
INC A
JR GC0
GC2 LD (G_sTMP),A
EX AF,AF
LD (FHIGH),A
RET
GC01 XOR A
LD (F_SH),A
LD A,32
LD (FHIGH),A
RET
FIRE_G ;полет гранаты;вых:Z/NZ-вылет/попал
LD HL,0
LD (G_STP),HL
CALL HERROT
CALL FIRini
FireG1 CALL F_IMG
CALL F_PUT
CALL OUTDSC
CALL PBU
CALL G_CORR
CALL FIRnxt
CP 1
JR C,FireG1
FireG2 LD A,31
LD (FHIGH),A
LD A,5
CALL F_IMG_
CALL F_PUT
CALL OUTDSC
JP PBU
FIRE_S ;звуки выстрела
DEFB 6,0,0,4,9,7,7,5,2,2,02,8,2,8,02,02,8
FSOUND LD A,(G_TYPE)
LD HL,FIRE_S
CALL BA
JP SOUNDn
FIRE ;вых:Z/NZ-вылет/попал
CALL HERROT
CALL FIRini
CALL FSOUND
Fire1 CALL F_IMG
CALL F_PUT
CALL OUTDSC
CALL PBU
CALL FIRnxt
CP 1
JR C,Fire1
RET NC
B_Fr DEFB 1
B_He DEFB 1
B_FWn DEFB 1
B_Pwr DEFB 1
EXPL ;разрушения от взрыва
CALL G_HeFr
LD (B_FWn),A
LD (B_Fr),DE
LD A,7
CALL GUN_BT
LD (B_Pwr),A
LD HL,DSCR
PUSH HL
LD DE,DSCR+2
LD (HL),1
INC HL
LD (HL),0
LD BC,200
LDIR
LD A,(G_TYPE)
LD HL,BOFL_T
CALL BA
POP HL
LD B,A
;LD C,0
BEX1 PUSH BC
PUSH HL
LD A,C
LD HL,cBOOM
CALL WT
PUSH HL
LD A,L
LD HL,DSCR
CALL BA
POP HL
OR A
JP Z,BE_NO
LD A,H
AND #F0
SRA A
SRA A
SRA A
SRA A
LD D,A
LD A,H
AND #F
CP 8
JR C,BEX3
OR #F0
BEX3 LD HL,(FXOLD)
ADD A,L
LD L,A
LD A,D
ADD A,H
LD H,A
LD (TX),HL ;шаг взр
LD A,7
CALL GUN_BT
PUSH AF
CALL GSP60
JR NC,BE_1
CALL ATSP
LD B,A
AND %11
LD C,A
INC C
POP AF
CP C
JR C,BE_YES
LD A,C ;для Pwr=2
CP 3
JR NZ,BE_5
CALL RND
AND 3
JR NZ,BE_YES
BE_5 LD A,B
AND %11100
CP %11100
JP Z,BATREE
CP %10100
PUSH AF
CALL Z,GROUP
POP AF
CALL NZ,CONV_
JR BE_YES
BE_1 ;в героя
SUB #60
CALL GET_IX
CALL HERLIV
JR NZ,BE_2
POP AF
OR A
JR Z,BE_YES
LD (IX+8),0
CALL GSP
AND #80
OR (IX+7)
CALL PSP
JR BE_YES
BE_2 POP AF
CALL G_HeFr
CALL DECHER
BE_YES CALL ATSPM
AND #40
JR Z,BE_NO
LD A,1
JR BEX2
BE_NO XOR A
BEX2 POP HL
LD (HL),A
INC HL
PUSH HL
LD HL,B_Fr ;уменьш воздей взр
LD A,(HL)
OR A
JR Z,BEX4
DEC (HL)
BEX4 INC HL
LD A,(HL)
OR A
JR Z,BEX5
DEC (HL)
BEX5 POP HL
POP BC
INC C
LD A,C
DEC A
CP B
JP C,BEX1
RET
GROUP ;групповой спр.
LD HL,(TX)
PUSH HL
LD IY,TX
EX3 DEC (IY+1)
CALL ATSPG
JR Z,EX2
INC (IY+1)
INC (IY+1)
CALL ATSPG
JR Z,EX2
DEC (IY+1)
INC (IY)
CALL ATSPG
JR Z,EX2
DEC (IY)
DEC (IY)
CALL ATSPG
JR NZ,EXr
EX2 CALL CONV_
JR EX3
EXr POP HL
LD (TX),HL
RET
ATSPG CALL ATSPM
AND %11100
CP %10100
RET
BOFL_T DEFB 0,36,120,56,0,1,1,20,3,3,56,1,2,2,0,36,3
bo_T DEFB 0,-2,-2,2,0,-2,0,1
BTX EQU G_STP ;коор.черепа
BOOME1 ;взрывающися предмет
LD HL,(FX2)
LD (FXOLD),HL
LD HL,G_TYPE
LD A,(HL)
PUSH AF
PUSH HL
LD (HL),15
CALL BOOMER
POP HL
POP AF
LD (HL),A
RET
BOOMER ;взрыв
LD A,1
CALL SOUNDn
LD HL,(FXOLD)
CALL BOOMXY
CALL OUTDSC
CALL EXPL
CALL ALLSPF
JP OUTDSC
BOOMXY ;черепа в [HL]
LD C,4
bo0 PUSH HL
LD A,C
DEC A
LD HL,bo_T
CALL WT
POP DE
LD A,L
ADD A,E
LD L,A
LD A,H
ADD A,D
LD H,A
PUSH HL
LLL LD (BTX),HL
LD B,4
LD DE,xBOOM
bo1 PUSH BC
PUSH DE
CALL bo_bo
EX DE,HL
LD BC,96
ADD HL,BC
EX DE,HL
DEC H
INC L
CALL bo_bo
LD HL,(BTX)
INC H
LD B,3
bo4 PUSH BC
CALL RELA
DEC H
INC L
POP BC
DJNZ bo4
CALL OUTDSC
LD A,3
CALL DELAY
LD HL,(BTX)
LD (TX),HL
CALL PXYF
CALL PBU
bo2 POP HL
LD BC,192
ADD HL,BC
EX DE,HL
POP BC
POP HL
PUSH HL
DJNZ bo1
POP HL
DEC C
JR NZ,bo0
RET
bo_bo PUSH HL
PUSH DE
LD (TX),HL
CALL INFR
JR NC,bo_1
CALL XYHL
LD BC,DSCR+257
ADD HL,BC
XOR A
POP DE
PUSH DE
CALL HERO
bo_1 POP DE
POP HL
RET
CONV_ ;превращения спрайта (не героя)
CALL GSP
PUSH AF
AND #7F
LD H,xCONV/256
OR #80
LD L,A
LD A,(HL)
CP 255
JR C,CV1
POP AF ;не конв
RET
CV1 POP AF
AND #80
OR (HL)
EXX
LD (HL),A
EXX
AND #7F
LD L,A
LD H,xATR/256
LD A,(HL)
AND %11100
CP %00100 ;дверь?
RET NZ
JR Z,CONV_
FLAMER ;простое попадание
LD A,3
CALL SOUNDn
LD A,7
CALL GUN_BT
PUSH AF
CALL GSP60
JR NC,FLM1
CALL ATSP
LD B,A
AND %11
LD C,A
INC C
POP AF
CP C
JR C,FLASH
LD A,C ;для Pwr=2
CP 3
JR NZ,FLM5
CALL RND
AND 3
JR NZ,FLASH
FLM5 LD A,B
AND %11100
CP %10100
JR C,FLM0
CP %11100
JP Z,BATREE
JP BOOME1
FLM0 CALL FLASH
CALL FX2TX
CALL CONV_
FLM4 CALL PXYF
JP OUTDSC
FLM1 ;в героя
SUB #60
CALL GET_IX
CALL FLASH
CALL FX2TX
CALL HERLIV
JR NZ,FLM2
POP AF
OR A
RET Z
LD (IX+8),0
CALL GSP
AND #80
OR (IX+7)
CALL PSP
JR FLM4
FLM2 POP AF
CALL G_HeFr
CALL DECHER
JR FLM4
FX2TX LD HL,(FX2)
LD (TX),HL
RET
FLASHs CALL FSOUND
FLASH LD A,(G_TYPE) ;вспышка
LD HL,BOFL_T
CALL BT
LD B,A
ADD A,A
ADD A,B
CALL M96
LD DE,xBUM
ADD HL,DE
EX DE,HL
LD B,3
FLH1 PUSH BC
PUSH DE
CALL FX2TX
CALL INFR
CALL XYHL
LD BC,DSCR+257
ADD HL,BC
XOR A
POP DE
PUSH DE
CALL HERO
LD HL,(FX2)
INC L
CALL RELA
DEC L
INC H
CALL RELA
CALL OUTDSC
CALL PBU
LD A,3
CALL DELAY
POP DE
LD HL,96
ADD HL,DE
EX DE,HL
POP BC
DJNZ FLH1
JP OUTDSC
F_SH DEFB 0
FXOLD DEFW 0 ;стар.FX
FX2 DEFW 0 ;FX/2,FY/2
PHIGH DEFW 0
DHIGH DEFB 0
FXY0 DEFB -13,8, -17,9, -15,-14, -18,-15 ;сдв.экр
DEFB -7,2, -4,-3, -25,-2, -26,-4
FIRnxt ;след. поз. пули ;0,1,2-далее,вылет,попал
CALL FX2TX
LD (FXOLD),HL
LD DE,(PHIGH) ;высота
LD HL,FHIGH
LD A,(DHIGH)
ADD A,E
LD (DHIGH),A
Fn01 CP D
LD A,(F_SH)
JR C,Fn0
DEC (HL)
OR A
JR NZ,Fn02
INC (HL)
INC (HL)
Fn02 LD A,(DHIGH)
SUB D
LD (DHIGH),A
JR Fn01
Fn0 OR A
JR NZ,Fn2
LD A,(HL) ;dwn
CP 32
JR C,Fn3
LD A,2
RET
Fn3 CP 16
JR C,Fn1
LD A,(FLR)
OR A
JR NZ,Fn1
PUSH DE
CALL GSP
AND #7F
JR Z,Fn31
POP DE
Fn30 LD A,2
RET
Fn31 LD A,1
CALL FLOOR
CALL ALLSPF
POP DE
JR Fn1
Fn2 LD A,(HL) ;up
CP 200
JR C,Fn5
FnOUT LD A,1
RET
Fn5 CP 16
JR NC,Fn1
LD A,(FLR)
OR A
JR Z,Fn1
PUSH DE
XOR A
CALL FLOOR
CALL GSP
AND #7F
JR Z,Fn51
POP DE
LD A,1
CALL FLOOR
JR Fn30
Fn51 CALL ALLSPF
POP DE
Fn1 CALL LINnxt ;коорд
LD A,255
CP E
JR Z,FnOUT
CP D
JR Z,FnOUT
SRL E
SRL D
LD (FX2),DE
LD A,(XMAX)
CP E
JR C,FnOUT
LD A,(YMAX)
CP D
JR C,FnOUT
LD (TX),DE
PUSH DE
CALL INFR
JR C,FnOK
LD A,(INDC)
LD C,0
CP #14
JR Z,Fs1
INC C
CP #15
JR Z,Fs1
INC C
CP #1C
JR Z,Fs1
INC C
Fs1 RLC C
LD A,(DENC)
AND 1
ADD A,C
LD HL,FXY0
CALL WT
LD DE,(FXOLD)
LD A,L
ADD A,E
LD L,A
LD A,H
ADD A,D
LD H,A
LD (X0),HL
CALL ALLSPF
FnOK POP HL
LD (TX),HL
CALL GSP
AND #7F
OR A
RET Z
CP #60
JR NC,Fn6
CALL ATSP
LD C,A
LD A,2
BIT 6,C ;?break
RET Z
XOR A
BIT 5,C ;&?move
RET NZ
LD A,(FHIGH)
AND #F
CP 11
LD A,2
RET NC
XOR A
RET
Fn6 LD HL,(FX)
LD A,L
OR H
CPL
AND 1
RLCA
RET
HERROT LD IX,(HER_AD) ;поворот к цели
CALL GET_XY
CALL DIRF
LD D,(IX+3)
SUB D
RET Z
AND 7
CP 4
LD A,D
JR NC,HRR1
INC A
INC A
HRR1 DEC A
AND 7
LD (IX+3),A
LD A,(IX+5)
OR A
LD A,(FLR)
PUSH AF
CALL Z,LOOKS
POP AF
CALL FLOOR
CALL ALLSPF
CALL OUTDSC
JR HERROT
CANF_B DEFB 1; можно стр.==#68
CANFIR ;возможность стрельбы
LD HL,0
LD (G_STP),HL
LD A,(FLR)
PUSH AF
LD HL,(PPX)
LD (TX),HL
LD DE,(XMAX)
INC D
INC E
LD A,H
CP D
JR NC,NO_CAN
LD A,L
CP E
JR NC,NO_CAN
LD A,(G_TYPE)
CP 10
JR NZ,Can1
CALL GSP60 ;для гр
OR A
JR Z,NO_GRE
CALL CANini
LD A,(LIN_LN)
CP 32
JR C,Can10
NO_GRE LD A,#48
JR Can2
Can1 CALL CANini
Can10 LD HL,(FX2)
LD DE,(PPX)
OR A
SBC HL,DE
JR NZ,Can3
POP BC
PUSH BC
LD A,(FLR)
CP B
JR Z,YESCAN
Can3 LD A,(G_TYPE)
CP 10
CALL Z,G_CORR
CALL CANnxt
CP 1
JR C,Can10
JR NZ,NO_CAN
YESCAN LD A,#68
Can2 LD (CANF_B),A
POP AF
JP FLOOR
CANF_V LD HL,(CANF_B) ;индикация in line of fire
LD H,L
CALL MEM7
LD (ATR+557),HL
JP PT128
NO_CAN LD A,#50
JR Can2
CANini CALL GET_DE
LD A,(FLR)
PUSH AF
PUSH HL
LD A,(HL)
LD (OLDFLR),A
CALL FLOOR
LD (FX2),DE
SLA D
SLA E
LD (FX),DE
LD HL,(PPX)
SLA H
SLA L
CALL LINini
POP HL
POP AF
OR A
LD A,23
JR NZ,CI1
LD A,7
CI1 CALL HI_10
LD C,A
LD A,(HL)
OR A
LD A,23
JR NZ,CI2
LD A,7
CI2 LD (FHIGH),A
SUB C
LD C,1 ;up
JR NC,CI3
DEC C ;dwn
NEG
CI3 LD L,A
SRL A
LD (DHIGH),A
LD A,(LIN_LN)
LD H,A
LD (PHIGH),HL
LD A,C
LD (F_SH),A
RET
CANnxt ;след. поз. пули ;0,1,2-далее,вылет,попал
CALL FX2TX
LD (FXOLD),HL
LD DE,(PHIGH) ;высота
LD HL,FHIGH
LD A,(DHIGH)
ADD A,E
LD (DHIGH),A
Cn01 CP D
LD A,(F_SH)
JR C,Cn0
DEC (HL)
OR A
JR NZ,Cn02
INC (HL)
INC (HL)
Cn02 LD A,(DHIGH)
SUB D
LD (DHIGH),A
JR Cn01
Cn0 OR A
JR NZ,Cn2
LD A,(HL) ;dwn
CP 32
JR C,Cn3
LD A,2
RET
Cn3 CP 16
JR C,Cn1
LD A,(FLR)
OR A
JR NZ,Cn1
PUSH DE
CALL GSP
AND #7F
JR Z,Cn31
POP DE
Cn30 LD A,2
RET
Cn31 LD A,1
CALL FLOOR
POP DE
JR Cn1
Cn2 LD A,(HL) ;Up
CP 200
JR C,Cn5
CnOUT LD A,1
RET
Cn5 CP 16
JR NC,Cn1
LD A,(FLR)
OR A
JR Z,Cn1
PUSH DE
XOR A
CALL FLOOR
CALL GSP
AND #7F
JR Z,Cn51
POP DE
LD A,1
CALL FLOOR
JR Cn30
Cn51 POP DE
Cn1 CALL LINnxt ;коорд
LD A,255
CP E
JR Z,CnOUT
CP D
JR Z,CnOUT
SRL E
SRL D
LD (FX2),DE
LD A,(XMAX)
CP E
JR C,CnOUT
LD A,(YMAX)
CP D
JR C,CnOUT
LD (TX),DE
CALL GSP
AND #7F
OR A
RET Z
CP #60
JR NC,Cn6
CALL ATSP
LD C,A
LD A,2
BIT 6,C ;?break
RET Z
XOR A
BIT 5,C ;&?move
RET NZ
LD A,(FHIGH)
AND #F
CP 11
LD A,2
RET NC
Cn6 XOR A
RET
CORR_T ;случайн.разброс
PUSH DE
LD DE,(FX2)
CALL RASST
CP 2
JR C,CRTE
LD E,2
CP 9
JR C,CRT2
INC E
CP 19
JR C,CRT2
INC E
CP 31
JR C,CRT2
INC E
CP 43
JR C,CRT2
INC E
CRT2 ADD A,100
LD (CRTprc+1),A ;100%+поправка на расст
LD A,E
LD (CORR_N+1),A
PUSH HL
LD A,(HER_AD) ;увеличение случ
CPL
CALL BA
LD HL,RNB
XOR (HL)
LD (HL),A
LD A,16
CALL HER_BA
LD E,A
LD A,(FIRTYP)
ADD A,2
CALL GUN_BT
LD L,A
CALL MULB
LD L,100
CALL DIVB2
CRT1 CALL RND
CRTprc CP 100
JR NC,CRT1
CP E
JR NC,CRTM
POP HL
CRTE POP DE
RET
CRTM POP HL
PUSH HL
CALL CRTRN
ADD A,L
LD L,A
CALL CRTRN
ADD A,H
LD H,A
LD DE,(XMAX)
LD A,L
CP E
JR NC,CRTM
LD A,H
CP D
JR NC,CRTM
POP DE
POP DE
RET
CRTRN CALL RND
LD E,A
AND 7
CORR_N CP 5
JR NC,CRTRN
BIT 6,E
RET Z
NEG
RET
VZLOM ;[] - убить всех (если ГАРПУНОВ И ТОРПЕДНИЦ по 31)
LD HL,S_GUN
LD A,(HL)
INC HL
INC HL
CP (HL)
RET NZ
CP 31
RET NZ
LD IX,MAN
LD DE,32
LD B,32
VZL1 LD A,(IX+5)
OR A
JR Z,VZL2
CALL RND
AND 3
JR Z,VZL3
;убить
LD (IX+13),0
JR VZL2
VZL3 ;парализ
LD (IX+26),222
VZL2 ADD IX,DE
DJNZ VZL1
RET
RASSTA CALL GET_DE
CALL GET_XY
RASST ;расст от НL к DE: A:=max(|E-L|,|D-H|)
PUSH HL
PUSH DE
LD A,L
SUB E
JR NC,RSA1
NEG
RSA1 LD L,A
LD A,D
SUB H
JR NC,RSA2
NEG
RSA2 CP L
JR NC,RSA3
LD A,L
RSA3 POP DE
POP HL
RET