worm 0.90.0503: ctf, example level file
authorMischa Poslawsky <wormy@shiar.org>
Wed, 3 May 2000 10:30:24 +0000 (12:30 +0200)
committerMischa Poslawsky <wormy@shiar.org>
Sun, 22 Feb 2009 15:13:37 +0000 (16:13 +0100)
- capture the flag, though not perfect yet (issues replacing food)
- seperate playable levelset from fully documented (tutorial) example

example1.z80 [new file with mode: 0644]
worm.z80
wormlvl.z80

diff --git a/example1.z80 b/example1.z80
new file mode 100644 (file)
index 0000000..9a2a556
--- /dev/null
@@ -0,0 +1,218 @@
+; *** WORM LEVELFILE ***
+;       example #1
+;        by SHIAR
+
+;Sample levelfile with everything commented.
+;Teaches you everything to build your own level.
+
+
+;-----------------------------------------------------------------------------
+
+;Standard 128x57 FIELD:
+;       +-----------------+
+;(0,0)> |####(BORDER)#####|
+;       |#*(2,2)         #|
+;       |#               #|
+;       |#(63,28)*(64,28)#|
+;       |#               #|
+;       |#      (125,54)*#|
+;       |#################| <(127,56)
+;       +-----------------+
+;Drawable screen is (2,2)-(125,54); center is (63.5,28)
+;
+;Screen will scroll with screensizes above 128x57 (max.256x256)
+;Example 256x80 FIELD (use 0,80):
+;       +-----------------------------------+
+;(0,0)> |#############(BORDER)##############|
+;       |#*(2,2)          :                #|
+;       |#                :                #|
+;       |#                :                #|
+;       |#                :                #|
+;       |#       (125,54)*:                #|
+;       |#"""""""""""""""":""""""""""""""""#|
+;       |#                :      (253,253)*#|
+;       |###################################| <(255,255)
+;       +-----------------------------------+
+
+
+;-----------------------------------------------------------------------------
+
+;DOUBLE CHECK THE FOLLOWING THINGS:
+; * correct name size at .org
+; * max. choosable level doesn't exeed actual levels present
+; * enough hiscore space (two bytes for each peaworm level!)
+
+
+;------------------------------- HEADER --------------------------------------
+
+;#include "asm86.h"            ;use include files to make your own
+;#include "ti86asm.inc"        ;singleplayer ending (just like normal asm)
+
+
+  .org $F3E3-10                ;$F3E3-[name size]
+            ;^^ <-MUST EQUAL NAME SIZE BELOW!!! If not, Worm will crash!
+
+  .db 'w',90                   ;wormLevel header (version .90)
+  .db 10,"Example #1"          ;name size (UPDATE .ORG!!!); level name
+  .dw hiscore-single           ;leveldata size
+
+
+levelsdata:
+
+  .dw single          ;points to singleplayer levels below
+  .dw peaworm         ;...peaworm level
+  .dw deathmatch      ;...deathmatch
+  .dw foodmatch       ;...foodmatch
+  .dw linkmatch       ;...linkmatch
+  .dw race            ;...race
+  .dw ctf             ;...capture the flag
+  .dw domination      ;...domination
+
+;note: use <.dw 0> if no levels present (empty level will be used).
+
+  .db 2,3,4,2         ;max. choosable level+1 for each gametype
+  .db 2,2,2,2         ;so: 2 = level 1 only; 4 = level 1 to 3 available
+
+;again .db 0 indicates no levels present.
+
+
+;------------------------------- LEVELS --------------------------------------
+
+;LEVEL-FORMAT:
+;------------
+; .db 5               ;nr. of peas in level
+; .db 4               ;delay (0=fastest, 4=normal)
+; .db 15              ;growth per pea
+; .db 15              ;begin size
+; .db 4               ;sprite size (1-8; 0=use default sprite)
+; .db %01100000       ;the sprite
+; .db %11110000
+; .db %11110000
+; .db %01100000
+; .db 2               ;bouncing balls (0-40)
+; .db 2               ;BALL #1: begin y-position
+; .db 4               ;         begin-x
+; .db %00             ;         direction (%00=right+down, %11=left+up)
+; .db 2,7,%00         ;BALL #2: y,x,direction
+; .db 0               ;your start direction (0=up,$40=right,$80=down,$C0=left)
+; .db 2               ;your y-position (2=at top)
+; .db 63              ;your x-position (63=center)
+;                     ;IN MULTIPLAYER LEVELS also set positions for worm 2-4:
+;(.db $C0,28,125 )    ;player 2 moves left
+;(.db $00, 2, 63 )    ;player 3 moves down
+;(.db $80,54, 63 )    ;player 4 moves up
+;
+; .db 128,57          ;field size: width (128-255), height (57-255)
+;                     ; screen will SCROLL if size is more than 128,57
+; .db 2               ;number of lines:
+; .db 28,14,100,41    ;LINE #1 coordinates: (x1,y1)-(x2,y2)
+; .db 28,41,100,14    ;LINE #2: the same
+; .db 1               ;number of boxes:
+; .db 16,12,48,12     ;BOX #1: x1,y1,x2,ysize(y2-y1)
+;------------         ;THAT'S ALL; repeat for all levels
+
+
+single:               ;singleplayer levels start here
+
+  .db 5,4,15
+  .db 15,5
+  .db %01110000
+  .db %10001000
+  .db %10001000
+  .db %10001000
+  .db %01110000
+  .db 0
+  .db 0,2,63
+  .db 128,57
+  .db 0,0             ;no lines/boxes
+
+  .db 8,4,15,15,0
+  .db 0
+  .db $40,14,2
+  .db 128,57
+  .db 1               ;one horizontal line
+  .db 28,28,100,28
+  .db 0
+
+  .db 255             ;end marker: no more levels
+
+;Code to run when all levels are done:
+;Worm waits a second, then screen is cleared and this code will be run.
+
+   ret                ;no end, quit and continue with stats-screen
+
+;This is a sample ending displaying "Congratulations!!" to use instead of RET:
+;  ld hl,endtext
+;  call _puts         ;display text
+;  jp _getkey         ;wait for a key and return (jp = call+ret)
+;endtext:
+; .db "  Congratulations!!",0
+
+
+peaworm:              ;peaworm levels (2)
+  .db 5,4,15
+  .db 15,5
+  .db %01110000
+  .db %10001000
+  .db %10001000
+  .db %10001000
+  .db %01110000
+  .db 0
+  .db 0,2,63
+  .db 128,57
+  .db 0,0
+
+  .db 5,4,15,15,0,0
+  .db 0,2,63
+  .db 128,57
+  .db 0,0
+
+
+deathmatch:           ;deathmatch levels
+  .db 8,5,15,31,0,0
+  .db $40,28,2        ;begin stats for each player
+  .db $C0,28,125
+  .db $00,2,63
+  .db $80,54,63
+  .db 128,57          ;field size
+  .db 0
+  .db 4               ;4 boxes
+  .db 16,12,48,12
+  .db 80,12,112,12
+  .db 16,34,48,12
+  .db 80,34,112,12
+
+
+foodmatch:
+ctf:
+domination:
+  .db 8,5,18,15,0,0
+  .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
+  .db 128,57
+  .db 0,0
+
+
+linkmatch:
+  .db 8,0,15,15,0,0
+  .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
+  .db 228,157
+  .db 0,0
+
+
+race:
+  .db 8,4,15,10,0,0
+  .db $40,3,2,$40,6,2, $40,9,2,$40,12,2
+  .db 128,57
+  .db 0
+  .db 2
+  .db 22,21,104,15
+  .db 52,10,74,37
+
+
+hiscore:              ;space reserved to store hi-scores
+  .dw 0               ;singleplayer hiscore will be saved here
+  .dw 0,0             ;peaworm hiscore for each peaworm-level
+
+
+  .end
+.end
\ No newline at end of file
index 68d511288ab76a6dec170ca86b54971e81e7cb51..b4b4373104cca44d88adf7a46617005fb310b216 100644 (file)
--- a/worm.z80
+++ b/worm.z80
@@ -1001,6 +1001,16 @@ noboxes:
 
   psh hl                        ; >> levelp new
   cal showstats
+  ld  a,(Gametype)
+  cp  gamectf
+  jr  nz,noctf
+  ld  hl,$1010
+  ld  (peaspos),hl
+  cal DrawPea
+  ld  hl,$2010
+  ld  (peaspos+3),hl
+  cal DrawPea
+noctf:
   ld  a,(gameCar)
   and _datafood
   jr  z,nofood
@@ -1537,18 +1547,7 @@ Hitworm:
   ld  hl,0
 PeaY =$-2
 PeaX =$-1
-  ld  a,(sprsize)
-  inc a
-  ld  d,a
-  ld  a,b
-  sub h
-  inc a
-  cp  d ;=(sprsize)+1
-  jp  nc,WormDead
-  ld  a,c
-  sub l
-  inc a
-  cp  d
+  cal chkpeahit
   jp  nc,WormDead
   cal DrawPea ;remove pea
   ld  a,(ix+grow)
@@ -1562,10 +1561,10 @@ peagrowth =$-1
   ld  de,10
   cal IncScore
   pop af
-  jp  nz,still_alive_not_dead
+  jp  nz,Drawworm ;continue
   ld  a,(gameCar)
   and _datafoodl
-  jp  z,still_alive_not_dead
+  jp  z,Drawworm
   ld  a,(Gametype)
   or  a
   jp  nz,Exit ;stack restored
@@ -1586,8 +1585,7 @@ peagrowth =$-1
   pop hl                         ; << levelp new
   jp  StartLevel
 
-multiple_peas:
-  ld  hl,(peaspos)
+chkpeahit: ;hl=peapos
   ld  a,(sprsize)
   inc a
   ld  d,a
@@ -1595,14 +1593,49 @@ multiple_peas:
   sub h
   inc a
   cp  d ;=(sprsize)+1
-  jp  nc,peaaction
+  ret nc ;nc=no pea
   ld  a,c
   sub l
   inc a
   cp  d
-  ret c
-peaaction:
-  ret
+  ret ;c=pea
+
+flagcaptured:
+  psh hl
+  ld  de,30
+  cal IncScore
+  pop hl
+  cal WormDead
+DrawAllPeas:
+  ld  hl,(peaspos)
+  cal DrawPea
+  ld  hl,(peaspos+3)
+  jp  DrawPea
+
+multiple_peas:
+  ld  hl,(peaspos)
+  ld  a,(ix+reserv)
+  ld  e,a ;push a
+  and %01
+  jr  nz,corrrectpea
+  ld  hl,(peaspos+3)
+corrrectpea:
+  cal chkpeahit
+  jp  nc,WormDead
+  ld  a,e ;pop a
+  xor %01 ;0=1;1=0
+  ld  (ix+reserv),a
+  and %01
+  add a,a
+  ld  b,a
+  ld  a,e
+  and %10
+  cp  b
+  psh af ;safe z-flag
+  cal DrawPea ;remove
+  pop af
+  jr  z,flagcaptured
+  jr  Drawworm
 
 ;-----------------------------
 
@@ -1674,7 +1707,6 @@ previouspos =$+1
   ld  (ix+pos2),e
   ld  (ix+pos2+1),d
   ret
-still_alive_not_dead:
 
 ;-------- draw worm ----------
 
@@ -1885,8 +1917,7 @@ DrawPea: ;hl=(PeaY)
   ld  c,l
   ld  de,peasprite
 spritepos =$-2
-  cal PutSprite ;||-ed
-  ret
+  jp  PutSprite ;||-ed
 
 ;----------- score -----------
 
@@ -2706,7 +2737,7 @@ _datafood  = %00010000 ;food present
 _________  = %00100000 ;
 _datadie   = %01000000 ;worm dies on impact
 _datascore = %10000000 ;score>=100 limit
-_datamultpeas = 0
+_datamultpeas = %00100000
 
 gamesingle   =  0
 datasingle: .db %01011110
@@ -2721,7 +2752,7 @@ datalinkm:  .db %01000011
 gamerace     =  5
 datarace:   .db %10000000
 gamectf      =  6
-datactf:    .db %01000000
+datactf:    .db %11100000
 gamedomin    =  7
 datadomin:  .db %01000000 ;==(8 modes)
 
@@ -2732,10 +2763,10 @@ datalevels: .dw LevelDef, LevelDef
 nrlevels:   .db 2,2,2,2,2,2,2,2
 
 worm1set:  .dw worm1p,worm1p
-           .db %11110111,3,0,%01111110,%10,%100 ;< >
+           .db %11110111,3,%00,%01111110,%10,%100 ;< >
 worm1name: .db "worm #01",0
 worm2set:  .dw worm2p,worm2p
-           .db %11111011,3,0,%00111111,%10000,%1000 ;f1 f2
+           .db %11111011,3,%11,%00111111,%10000,%1000 ;f1 f2
 worm2name: .db "worm #02",0
 worm3set:  .dw worm3p,worm3p
            .db %11111011,3,0,%01011111,%10,%100 ;sto ,
@@ -2769,7 +2800,7 @@ storepos = 16
 lives    = 17
 reserv   = 18  ;loop
  ;race:lap
- ;hunt:time
+ ;ctf:pea
 input    = 19
 left     = 20
 right    = 21
index 41bf14dbde72c1637087a2ca11909611befbe133..57e2d55c7a14dc384d372d01764fdc709e247669 100644 (file)
@@ -1,86 +1,36 @@
-;128x57 FIELD:
-;       +-----------------+
-;(0,0)> |####(BORDER)#####|
-;       |#*(2,2)         #|
-;       |#               #|
-;       |#(63,28)*(64,28)#|
-;       |#               #|
-;       |#      (125,54)*#|
-;       |#################| <(127,56)
-;       +-----------------+
 ;Drawable screen is (2,2)-(125,54); center is (63.5,28)
 
-
 #include "asm86.h"
 #include "ti86asm.inc"
 
 
 ;---------- HEADER ----------
 
-  .org $F3E3-16                ;$F3E3-[name size]
-            ;^^ <-MUST EQUAL NAME SIZE BELOW!!! If not, Worm will crash!
+  .org $F3E3-16
 
-  .db 'w',90                   ;wormLevel header (version .90)
-  .db 16,"Worm LevelPack I"    ;name size (UPDATE .ORG!!!); level name
-  .dw hiscore-single           ;leveldata size
+  .db 'w',90
+  .db 16,"Worm LevelPack I"
+  .dw hiscore-single
 
 
 levelsdata:
 
-  .dw single          ;points to singleplayer levels below
-  .dw peaworm         ;...peaworm level
-  .dw deathmatch      ;...deathmatch
-  .dw foodmatch       ;...foodmatch
-  .dw linkmatch       ;...linkmatch
-  .dw race            ;...race
-  .dw ctf             ;...capture the flag
-  .dw domination      ;...domination
-
-;note: use <.dw 0> if no levels present (empty level will be used).
+  .dw single
+  .dw peaworm
+  .dw deathmatch
+  .dw foodmatch
+  .dw linkmatch
+  .dw race
+  .dw ctf
+  .dw domination
 
-  .db 2,3,3,2         ;max. choosable level+1 for each gametype
-  .db 2,2,2,2         ;so: 2 = level 1 only; 4 = level 1 to 3 available
-
-;again .db 0 indicates no levels present.
+  .db 2,3,4,2
+  .db 2,2,2,2
 
 
 ;---------- LEVELS ----------
 
-;LEVEL-FORMAT:
-;------------
-; .db 5               ;nr. of peas in level
-; .db 4               ;delay (0=fastest, 4=normal)
-; .db 15              ;growth per pea
-; .db 15              ;begin size
-; .db 4               ;sprite size (1-8; 0=use default sprite)
-; .db %01100000       ;the sprite
-; .db %11110000
-; .db %11110000
-; .db %01100000
-; .db 2               ;bouncing balls (0-40)
-; .db 2               ;BALL #1: begin y-position
-; .db 4               ;         begin-x
-; .db %00             ;         direction (%00=right+down, %11=left+up)
-; .db 2,7,%00         ;BALL #2: y,x,direction
-; .db 0               ;your start direction (0=down,$40=right,$80=up,$C0=left)
-; .db 2               ;your y-position (2=at top)
-; .db 63              ;your x-position (63=center)
-;                     ;IN MULTIPLAYER LEVELS also set positions for worm 2-4:
-;(.db $C0,28,125 )    ;player 2 moves left
-;(.db $00, 2, 63 )    ;player 3 moves down
-;(.db $80,54, 63 )    ;player 4 moves up
-;
-; .db 128,57          ;field size: width (128-255), height (57-255)
-;                     ; screen will SCROLL if size is more than 128,57
-; .db 2               ;number of lines:
-; .db 28,14,100,41    ;LINE #1 coordinates: (x1,y1)-(x2,y2)
-; .db 28,41,100,14    ;LINE #2: the same
-; .db 1               ;number of boxes:
-; .db 16,12,48,12     ;BOX #1: x1,y1,x2,ysize(y2-y1)
-;------------         ;THAT'S ALL; repeat for all levels
-
-
-single:               ;singleplayer levels start here
+single:
 
   .db 5,4,15          ;peas/delay/growth
   .db 15,5            ;size/spritesize
@@ -188,17 +138,12 @@ single:               ;singleplayer levels start here
   .db 91,106,115,106
   .db 0
 
-  .db 255             ;end marker: no more levels
-
-;Code to run when all levels are done:
-;Worm waits a second, then screen is cleared and this code will be run.
-;End with <ret> (stats-screen will then be displayed.)
-;If you don't want an ending, simply put <ret>.
+  .db 255
 
    ld   hl,endtext
    call _puts         ;display text
    jp   _getkey       ;wait for a key
-                      ;jp ? = call ? + ret
+
 endtext:
   .db "  Congratulations!!",0
 
@@ -237,9 +182,15 @@ deathmatch:
   .db 80,34,112,12
 
   .db 8,4,18,15,0,0
-  .db $40,30,2,$C0,30,125, $00,2,64,$80,54,64
+  .db $20,2,2,$A0,54,125, $E0,2,125,$60,54,2
   .db 128,57
-  .db 0,0
+  .db 1
+  .db 35,28,92,28
+  .db 4
+  .db 2,20,18,17
+  .db 109,20,125,17
+  .db 48,2,79,10
+  .db 48,47,79,55
 
 
 foodmatch:
@@ -269,8 +220,8 @@ race:
 
 
 hiscore:
-  .dw 0               ;singleplayer hiscore will be saved here
-  .dw 1,2             ;peaworm hiscore for each peaworm-level
+  .dw 0
+  .dw 1,2
 
 
   .end