upto 4 simultaneous multiples
authorMischa Poslawsky <nemesis@shiar.org>
Mon, 10 Jul 2000 13:07:44 +0000 (15:07 +0200)
committerMischa Poslawsky <nemesis@shiar.org>
Wed, 18 Mar 2009 03:36:14 +0000 (04:36 +0100)
+ you can have upto FOUR multiples! (~20 pixels apart)

nemesis.z80

index d57f1c11759fe607c230e8a0bcce170332e5f429..31cf27c0c2c2d0aa7ac844d1a45a04a4435e67c8 100644 (file)
@@ -65,12 +65,8 @@ starx1               = storepos+55           ;+55
 nrstars2       = 7
 starx2         = starx1+(nrstars1*2)   ;+69
                                        ;       ;--------MULTIPLES
-mx             = starx2+(nrstars2*2)   ;+83    ;position of multiple#1
-my             = mx+1                  ;+84    ;multiple y-pos
-m2x            = my+1                  ;+85
-m2y            = m2x+1                 ;+86
-your_locpos    = m2y+1                 ;+87    ;position in your_prevpos tabl
-your_prevpos   = your_locpos+1         ;+88    ;save previous positions (32d)
+your_prevpos   = starx2+(nrstars2*2)   ;+87    ;save previous positions (32d)
+mm             = 4
 
 ;^-----------------------------------<1        ;-120=$78
 
@@ -742,13 +738,11 @@ ok:                               ;we are
        in  a,(1)               ;come back in
 
        ld  b,a                 ;psh a (keys)
-       xor %11111111           ;inverted a = 0 if arrow-key has been pressed
-       ld  a,(your_multiples)
-       jr  z,no_adv            ;if so, leave the multiples where they are
-       or  %100                ;set move bit
-       jr  adv_ok
-no_adv:        and %11111011           ;reset move bit
-
+       xor -1                  ;inverted a: 0 if arrow-key has been pressed
+       ld  a,(your_multiples)          ;(btw: CPL doesn't set any flags)
+       res 7,a                 ;reset move bit (no flags changed)
+       jr  z,adv_ok            ;if so, leave the multiples where they are
+       set 7,a                 ;set move bit
 adv_ok:        ld  (your_multiples),a
 
        ld  a,(timer)           ;framecounter
@@ -818,39 +812,39 @@ disp_ship:
 handle_multiples:
        ld  a,(your_multiples)  ;do you have multiples
        ld  b,a                 ;save a for 2nd check
-       and %11                 ;no? (last two bits = nr of multiples)
+       and %111                ;no? (last two bits = nr of multiples)
        ret z                   ;then don't handle them either
-
-       ld  a,b                 ;restore a (your_multiples)
-       and %100                ;move the multiples??? (=move bit set?)
+       bit 7,b                 ;move the multiples??? (=move bit set?)
        jr  z,mult_adv          ;nope, just let them (saves (y)in y, (x)in x)
 
-       ld  hl,your_locpos      ;location to save this position
-       ld  a,(hl)              ;load a
-       inc a                   ;a=a+1 (next position)
-       and %00001111           ;if a>15 then a=a-16
-       ld  (hl),a              ;save new a
-       add a,a                 ;a=a*2
-       ld  c,a                 ;bc=2a
-       ld  b,0
-
-       ld  hl,your_prevpos     ;previous positions
-       add hl,bc               ;16 turns ago
-       ld  b,(hl)              ;old x-pos
-       inc hl                  ;and
-       ld  c,(hl)              ;old y-pos
-       ld  (mx),bc             ;save multiple position in (mx)
-       ld  (hl),d              ;save current pos. for 16 turns into the future
-       dec hl                  ;yes...
-       ld  (hl),e              ;...both
+       psh de                  ;current position = needed later
+       ld  hl,mm*14+1+your_prevpos     ;previous positions
+       ld  de,mm*14+3+your_prevpos     ;move all positions one back
+       ld  bc,mm*14+2
+       lddr                    ;change 0-57 -> 2-59 (if mm=4 that is)
+       inc hl                  ;your_prevpos+0
+       pop de
+       ld  (hl),d              ;x-pos
+       inc hl                  ;=current position
+       ld  (hl),e              ;y-pos
 
 mult_adv:
-       ld  de,(mx)
-       ld  a,d
-       ld  d,e
-       ld  e,a                 ;ex d,e
-       ld  ix,spr_multiple     ;sprite of the multiple
-       jp  putsprite           ;display it + <ret>
+       ld  hl,your_prevpos+16  ;first pos.
+disp_multiples:
+       psh af
+       psh hl
+       ld  d,(hl)              ;load coords
+       inc hl
+       ld  e,(hl)
+       ld  ix,spr_multiple     ;sprite
+       cal putsprite           ;display
+       pop hl
+       ld  de,14
+       add hl,de               ;next multiple
+       pop af                  ;counter
+       dec a
+       ret z                   ;return if all done
+       jr  disp_multiples      ;loop
 
 ;----explode----
 
@@ -903,13 +897,12 @@ no_armor:
 ;------------------------- place multiples ----------------------------------
 
 Place_multiples:
-       ld  (mx),de             ;set last multiple-position
        ld  hl,your_prevpos     ;place all previous positions
-       ld  b,16                ;all 16 of them
+       ld  b,mm*7+2            ;all saved positions of them (14 per multiple)
 place_multiples:
-       ld  (hl),d              ;set prev-x to d
+       ld  (hl),e              ;set prev-x to d
        inc hl                  ;next
-       ld  (hl),e              ;set prev-y to e
+       ld  (hl),d              ;set prev-y to e
        inc hl                  ;next
        dnz place_multiples     ;repeat
        ret
@@ -975,10 +968,16 @@ select5:
        dec a                   ;is it 5?
        jr  nz,select6          ;no, carry on once more
        ld  (hl),a              ;reset pickups
-       inc a
-       ld  (your_multiples),a
+       ld  hl,your_multiples
+       ld  a,(hl)              ;multiples you already got
+       inc a                   ;one more
+       cp  mm+1
+       jr  nc,enoughmultiples  ;maxed out
+       ld  (hl),a
+enoughmultiples:
        ld  de,(x)
-       cal Place_multiples
+       dec a                   ;if this is your first multiple then...
+       cal z,Place_multiples   ;reset multiples positions
        jp  disp_icons          ;display, return
 select6:
        ld  (hl),0              ;reset pickups
@@ -986,6 +985,36 @@ select6:
 
 ;------------------------- fire bullet --------------------------------------
 
+fire_multiples:
+       ld  hl,(your_prevpos+16);then, fire from multiple position
+       psh af
+       dec h                   ;one up (-2 height: keeps weapons centered)
+       cal fireany             ;fire from multiple position
+       pop af                  ;number of multiples
+       dec a                   ;one just displayed
+       ret z                   ;return if none left
+       ld  hl,(your_prevpos+30)
+       psh af
+       dec h
+       cal fireany
+       pop af
+       dec a
+       ret z
+       ld  hl,(your_prevpos+44)
+       psh af
+       dec h
+       cal fireany
+       pop af
+       dec a
+       ret z
+       ld  hl,(your_prevpos+58)
+       psh af
+       dec h
+       cal fireany
+       pop af
+       dec a
+       ret
+
 Fire_bullet:
        ld  hl,just_fired
        ld  a,(hl)              ;just_fired
@@ -999,14 +1028,10 @@ Fire_bullet:
        ld  (hl),5              ;.....then can't fire next turn (go to 5 imm.)
 
 fireOK:
-       ld  hl,(x)              ;yes: first fire from ship position (x)
        ld  a,(your_multiples)  ;any multiples?
-       and %11                 ;nope?
-       jr  z,fireany           ;then just fire somethin'
-       cal fireany             ;and blast
-       ld  hl,(mx)             ;then, fire from multiple position (mx)
-       dec h                   ;one up (-2 height: keeps weapons centered)
-                               ;blast again and <ret>
+       and %111                ;nr. of multiples
+       cal nz,fire_multiples   ;if >0 then fire them too
+       ld  hl,(x)              ;fire from ship position (x)
 fireany:                       ;HL=(x,y)
        ld  (firex),hl          ;set position to fire from
        ld  a,(your_weapon)
@@ -2145,7 +2170,7 @@ no_laser:
 
        ld  ix,spr_icon00       ;emptyIcon
        ld  a,(your_multiples)
-       and %11
+       and %111
        jr  z,no_multiples
        ld  ix,spr_icon05
 no_multiples:
@@ -3385,7 +3410,7 @@ spr_dividerline:
 txt_email:     .db "www.shiar.org ",127 ;title screen
                .db " shiar0@hotmail.com",0
 _txt_email = $3A01 ;$3A1E=just email
-txt_about:     .db "v0.98.77 ",127," by Shiar",0 ;right behind txt_email
+txt_about:     .db "v0.98.79 ",127," by Shiar",0 ;right behind txt_email
 _txt_about = $3321
 txt_menu1:     .db "NEW GAME",0
 txt_menu2:     .db "CONTINUE",0
@@ -3415,7 +3440,7 @@ levelp            .dw level01             ;pointer to level data          l01
 pickuptimer    .db  4                  ;counts when to place a pickup  4
 your_ship      .dw spr_ship01          ;your sprite                    sprs1
 your_score     .dw  0                  ;current score                  0
-your_pickup    .db  0                  ;pickups already picked up      0
+your_pickup    .db  3                  ;pickups already picked up      0
 your_occ       .db  0                  ;0=normal 1..16=exploding       0
 your_inv       .db  0                  ;invincibility left             0
 your_armor     .db 12                  ;HP left                        12
@@ -4085,4 +4110,10 @@ logo_nemesis:
 ;      # after pause weapon will not be fired
 ;      # teacher key fixed (waits for GRAPH to be release before&after)
 ;
-;       + added        - removed       * changed       # bug fixed
\ No newline at end of file
+; 0.99.79 -- 9.VII.00 -- size 6747
+;
+;      + you can have upto FOUR multiples! (~20 pixels apart)
+;
+;       + added        - removed       * changed       # bug fixed
+
+;bullet handling: (255/enemy)+419+putsprite cycles per bullet