worm 0.90.0501: title picture, mode-specific improvements
authorMischa Poslawsky <wormy@shiar.org>
Mon, 1 May 2000 13:02:24 +0000 (15:02 +0200)
committerMischa Poslawsky <wormy@shiar.org>
Sun, 22 Feb 2009 15:13:37 +0000 (16:13 +0100)
- title picture at main menu ("worm" formed by wormies)
- improve race scoring, remove hunting
- initial multifood support
- first worm can grow twice as long (useful in Peaworm games)
- scores saved for each peaworm level

makelvl.bat
title.bmp [new file with mode: 0644]
worm.z80
wormlvl.z80

index 4982435b5b6c2ab9db53bf1abc7d6a305aae60ef..be958972d70d794f66c5411fba2a83e10e2d10a0 100644 (file)
@@ -5,6 +5,6 @@ echo   MAKELVL LEVEL
 echo Needs TASM86.EXE and BIN2STR.EXE to compile.\r
 echo.\r
 tasm86 -80 -b %1.z80\r
-bin2str %1.obj 86 Levelfile for Worm .86 by Shiar\r
+bin2str %1.obj 86 Levelfile for Worm .90 by Shiar\r
 del %1.obj\r
-del %1.lst\r
+del %1.lst
\ No newline at end of file
diff --git a/title.bmp b/title.bmp
new file mode 100644 (file)
index 0000000..62fd899
Binary files /dev/null and b/title.bmp differ
index 2db4d9cdfa04d2bc8eb5628cb6c67cd8f150d3e4..68d511288ab76a6dec170ca86b54971e81e7cb51 100644 (file)
--- a/worm.z80
+++ b/worm.z80
@@ -1,5 +1,5 @@
 ; Title                      : Worm
-; Version                    : 89%
+; Version                    : 90%
 ; Release Date               : april 2000???
 ; Filename                   : worm.86p (4kb)
 ; Author(s)                  : Shiar
 ;----------- TO-DO -----------
 ;-----------------------------
 
-; 89% = DONE
+; 90% = DONE
 
 ;  3% * linkplay
-;  1% * titlescreen
 ;  2% * make linkplay available for all gametypes (not just deathmatch)
 ;     * game types:
 ;  1%   * ctf: take enemy flag (right-bottom) and return to your flag (left-top)
@@ -37,6 +36,8 @@
 ;-----------------------------
 ;-----------------------------
 
+#define buffer  ;use display buffer (otherwise write directly to screen)
+
 #define cal call
 #define psh push
 #define dnz djnz
@@ -68,7 +69,7 @@ _SET_MM_NUM_BYTES  = $464F ;number of bytes for mm.ldir = ahl
 _mm_ldir           = $52ED ;24bit ldir
 _RAM_PAGE_1        = $47E3 ;set $8000+ to page 1
 _RAM_PAGE_7        = $47F3
-_PTEMP_END         = $D29A
+_PTEMP_END         = $D29A ;end of VAT
 _load_ram_ahl      = $462F ;ahl->page+hl
 _writeb_inc_ahl    = $5567 ;ld (ahl),c
 
@@ -78,31 +79,35 @@ _writeb_inc_ahl    = $5567 ;ld (ahl),c
 
 ;--- permanent
 
-resbit = 2                        ;and%111110**
-
 ScrBuffer   = $8820 ;-A7FF (20*FF=1FE0)
-worm1p      = $A800 ;-ABFF (400)      %10101O00
-worm1       = $AC00 ;-AC1D (30d)
-worm2       = $AC1E ;-AC3B (1E)
-worm3       = $AC3C ;-AC59 (1E)
-worm4       = $AC5A ;-AC77 (1E)
-balls       = $AC78 ;-ACFF (3x45d)
+worm2p      = $A800 ;-ABFF (400)      %10101O00
+worm1       = $AC00 ;-AC1D (31d)
+worm2       = $AC1F ;-AC3B (1F)
+worm3       = $AC3E ;-AC59 (1F)
+worm4       = $AC5D ;-AC77 (1F)
+balls       = $AC7C ;-ACFF (3x43d)
 SinCosTable = $AD00 ;-AE00 (4x40)
         ;free $AE01 ;-AFFF (1FF)
-worm2p      = $B000 ;-B3FF (400)      %10110O00
-DispBuffer  = $B400 ;-B790 (10x57d)
-        ;free $B791 ;-B7FF (6F)
+worm1p      = $B000 ;-B7FF (800)      %1011O000
 worm3p      = $B800 ;-BBFF (400)      %10111O00
-        ;free $BC00 ;-BFFF (400)
+        ;free $BF91 ;-BFFF (6F)
 
      ;program $D748 ;-E7FF (106D+4A)
         ;free $E800 ;-EFFF (800)
 worm4p      = $F000 ;-F3FF (400)      %11110O00
 leveldata   = $F400 ;-FA70 (<=671)
 
+peaspos = $AE01
+
 ;--- temporary
 
-templevels  = $B400 ;(3*levelstr_on_calc)
+templevels  = $BC00 ;(3*strings) @init
+namelength  = $BC00 ;(1)         @menu
+#ifdef buffer
+DispBuffer  = $BC00 ;(10x57d)    @game
+#else
+DispBuffer  = $FC70
+#endif
 
 ;-----------------------------
 ;------- program start -------
@@ -110,7 +115,7 @@ templevels  = $B400 ;(3*levelstr_on_calc)
 
 .org _asm_exec_ram
 
-WormVersion = 089
+WormVersion = 090
 
 start:
   nop
@@ -120,7 +125,7 @@ start:
   .dw WormIcon
 
 WormMsg:
-  .db "WORM by SHIAR -- pre-beta 89%",0
+  .db "WORM by SHIAR -- pre-beta 90%",0
 WormIcon:
   .db 9,2
   .db %10010110,%01101111
@@ -134,13 +139,12 @@ WormIcon:
   .db %11000011,%10000000
 
 levelhead  = 'w'
-levelhead2 = 89 ;worm levels header = "89"
+levelhead2 = 90 ;worm levels header = "90"
 
 Start:
   ld  (SpSave),sp
   cal _runindicoff
   cal _flushallmenus
-  cal _clrLCD
 
   cal _RAM_PAGE_7
   ld  hl,$BFFF ;VAT start
@@ -231,13 +235,17 @@ searchcomplete:
   or  a
   sbc hl,bc
   pop hl
-  jp  z,levelloaded ;no ext files
+  jp  z,_clrWindow ;no ext files: exit
 dispnextlevel:
   cal _RAM_PAGE_1
   psh hl
   cal _clrWindow
-  ld  a,4
+  ld  a,2
   ld  (_curRow),a
+  ld  hl,txtLevsel
+  cal _puts ;"< Select levels: >"
+  ld  hl,$0004
+  ld  (_curRow),hl
   pop hl
   ld  a,(hl)
   cp  255
@@ -351,8 +359,23 @@ NegativeSineWave:
   ld  (curlevel),a
 DisplayMenu:
   cal _clrWindow
-  ld  hl,txtWelcome
-  cal _puts
+  ld  de,$FC42 ;(10,2)
+  ld  hl,wtPicture
+  ld  a,16 ;height
+disptitleloop:
+  ld  bc,8 ;width
+  ldir
+  ex  de,hl
+  ld  bc,8 ;next line
+  add hl,bc
+  ex  de,hl
+  dec a
+  jr  nz,disptitleloop
+
+  ld  hl,txtMenu
+  ld  de,$0D5A
+  ld  (_penCol),de
+  cal _vputs ;by Shiar
   ld  de,$0207
   ld  (_curRow),de
   cal _puts ;---
@@ -595,10 +618,8 @@ waitnokeypressed:
   jr  nz,waitnokeypressed
   ret
 
-namelength:
-  .db 0
 chartable:
-  .db 0,".<>!",0,0,0,0
+  .db 0,".<>!",0,0,0,0  ;down,L,R,up
   .db 0,"xtoje0",0      ;enter..clear
   .db " wsnid9",0       ;(-)..custom
   .db "zvrmhc8",0       ;dot..del
@@ -744,30 +765,25 @@ GameOver:
   ld  (worm2+score+1),hl
   ld  (worm3+score+1),hl
   ld  (worm4+score+1),hl
-  ld  hl,worm1set+4
-  ld  de,worm1+lives
-;&&&>*
-  cal _MOV5B ;9xld(de),(hl)
-  cal _mov9b
-  ld  hl,worm2set+4
-  ld  de,worm2+lives
-  cal _MOV5B
-  cal _mov9b
-  ld  hl,worm3set+4
-  ld  de,worm3+lives
-  cal _MOV5B
-  cal _mov9b
-  ld  hl,worm4set+4
-  ld  de,worm4+lives
-  cal _MOV5B
-  cal _mov9b
+  ld  hl,worm1set
+  ld  de,worm1+head
+  ld  a,4 ;4x (all worms)
+createwormsloop:
+  ld  bc,19
+  ldir ;copy 19 bytes
+  ex  de,hl
+  ld  bc,head
+  add hl,bc
+  ex  de,hl ;de=wormX+head
+  dec a     ;loop
+  jr  nz,createwormsloop
 
   ld  a,(Gametype)
   cp  1 ;=peaworm
   jr  nz,worminitdone
-  ld  (worm1+lives),a ;&&&<*
+  ld  (worm1+lives),a
 worminitdone:
-  pop hl
+  pop hl ;begin of current level
 
 StartLevel:
   ld  de,Left
@@ -832,31 +848,8 @@ setsprite:
   ldir
 toobad_noballs:
 
-#ifdef 0
-  ld  a,(gameCar)
-  and _datahunt
-  jr  z,nohunter
-  ld  a,huntersize
-  ld  (worm2+grow),a
-nohunter:
-#endif
-
   ex  de,hl
   ld  (thislevel),de
-  psh de
-  ld  hl,worm1set
-  ld  de,worm1+head
-  cal _MOV4B
-  ld  hl,worm2set
-  ld  de,worm2+head
-  cal _MOV4B
-  ld  hl,worm3set
-  ld  de,worm3+head
-  cal _MOV4B
-  ld  hl,worm4set
-  ld  de,worm4+head
-  cal _MOV4B
-  pop de
 
   ld  hl,worm1
   ld  a,(gameCar)
@@ -1091,7 +1084,10 @@ Delay:
   jr  nz,Delay
 NoDelay:
 
-  cal handlethoseneatlittleballs
+  ld  a,0
+nrballs =$-1
+  or  a
+  cal nz,handlethoseneatlittleballs
 
   ld  ix,worm1
   ld  a,(nrworms)
@@ -1322,6 +1318,8 @@ ExitNoStats:
   jp  _clrWindow
 
 loadhiscoreposinahl:
+  ld  a,(Level)
+  ld  b,a
   ld  a,(Gametype)
   or  a
 externalhiscoresavepos:
@@ -1330,7 +1328,9 @@ hiscrposa =$-1
   ld  hl,0
 hiscrposhl =$-2
   ret z ;(Gametype)=0
+addlevelposition:
   cal _AHL_PLUS_2_PG3
+  dnz addlevelposition
   ret
 
 ;-----------------------------
@@ -1387,6 +1387,7 @@ inputcall:
 respawncheck:
   cp  respawndelay-1
   jr  nz,unnamedlabel
+  cal saverespawncounter
 removeworm:
   ld  h,(ix+tail+1)
   ld  l,(ix+tail)
@@ -1398,7 +1399,7 @@ removewormloop:
   inc hl
   ld  b,(hl)
   inc hl
-  res resbit,h
+  cal resbit
   psh hl
   cal res4pixels
   pop hl
@@ -1417,7 +1418,8 @@ safewormsizedone:
 
   ;de=ix+head
   ld  (ix+tail+1),d
-  ld  (ix+tail),e
+  ld  (ix+tail),e ;head=tail/size=0
+  ret
 
 unnamedlabel:
   cp  1
@@ -1430,7 +1432,7 @@ respawndue:
   cp  l   ;changed?
   ret z
 saverespawncounter:
-  ld  (ix+delay),h
+  ld  (ix+delay),a
   ret
 
 ;------- handle worm ---------
@@ -1453,6 +1455,18 @@ donediddelydone:
   ld  e,(ix+pos2)
   ld  d,(ix+pos2+1)
 
+  psh hl
+  ld  hl,previouspos
+  ld  (hl),c
+  inc hl
+  ld  (hl),b
+  inc hl
+  inc hl
+  ld  (hl),e
+  inc hl
+  ld  (hl),d
+  pop hl
+
 ;-------- move worm ----------
 
 Wormmove:
@@ -1511,11 +1525,14 @@ GotFour:
 Hitworm:
   ld  a,(gameCar)
   ld  h,a
-  and _datafood
-  jp  z,WormDead
+  and _datadie
+  cal z,checkhitotherworm
+  ld  a,h
+  and _datamultpeas ;&&bit
+  jr  nz,multiple_peas
   ld  a,h
-  and _datahunt
-  cal nz,checkhitotherworm
+  and _datafood
+  jp  z,WormDead ;no food
 
   ld  hl,0
 PeaY =$-2
@@ -1545,10 +1562,10 @@ peagrowth =$-1
   ld  de,10
   cal IncScore
   pop af
-  jr  nz,still_alive_not_dead
+  jp  nz,still_alive_not_dead
   ld  a,(gameCar)
   and _datafoodl
-  jr  z,still_alive_not_dead
+  jp  z,still_alive_not_dead
   ld  a,(Gametype)
   or  a
   jp  nz,Exit ;stack restored
@@ -1563,20 +1580,32 @@ peagrowth =$-1
   cal _HLTIMES10
   ex  de,hl
   cal IncScore ;score+(40*level)
+  cal removeworm
   pop hl                         ; << call
   pop hl                         ; << call
   pop hl                         ; << levelp new
   jp  StartLevel
 
+multiple_peas:
+  ld  hl,(peaspos)
+  ld  a,(sprsize)
+  inc a
+  ld  d,a
+  ld  a,b
+  sub h
+  inc a
+  cp  d ;=(sprsize)+1
+  jp  nc,peaaction
+  ld  a,c
+  sub l
+  inc a
+  cp  d
+  ret c
+peaaction:
+  ret
+
 ;-----------------------------
 
-checkhitotherworm:
-  .db $dd,$7d ;ld a,lx
-  cp  worm2&255
-  ret nz
-ThisIsJustASillyUselessLabel:
-  ld  hl,(worm1+tail)
-  ld  de,(worm1+head)
 nextotherwormbit:
   ld  a,c
   sub (hl)
@@ -1588,13 +1617,14 @@ nextotherwormbit:
   sub (hl)
   inc a
   cp  4
-  jr  c,otherwormHIT ;yes
+  ret c ;nz ;yes
 nothit1:
   inc hl
-  res resbit,h
+  cal resbit
+ChkWorm:
   cal _cphlde
   jr  nz,nextotherwormbit
-  ret
+  ret ;z
 
 checkhitlapline:
   ld  a,63
@@ -1617,29 +1647,44 @@ nolap:
   ld  (ix+reserv),a
   ret
 
-otherwormHIT:
-  psh ix
-  ld  de,10
-  cal IncScore
+checkhitotherworm:
+ .db  $dd,$7d ;ld a,lx
+  cp  worm2&255
+ psh ix
+ jr nz,chkworm2 ; ret nz
   ld  ix,worm1
-  cal WormDead
-  pop ix
-  pop bc
+ jr chkworm
+chkworm2:
+ ld ix,worm2
+
+chkworm:
+ ld h,(ix+tail+1)
+ ld l,(ix+tail)
+ ld e,(ix+head)
+ ld d,(ix+head+1)
+  cal ChkWorm
+ pop ix
+  ret z ;not hit
+  pop bc ;call
+previouspos =$+1
+  ld  bc,0
+  ld  de,0
+  ld  (ix+pos),c
+  ld  (ix+pos+1),b
+  ld  (ix+pos2),e
+  ld  (ix+pos2+1),d
+  ret
 still_alive_not_dead:
 
 ;-------- draw worm ----------
 
 Drawworm:
-  ld  a,(gameCar)
-  and _datahunt
-  cal nz,HuntingTimeScore
-
   ld  c,(ix+pos)
   ld  b,(ix+pos+1)
 
-  ld  a,(gameCar)
-  and _datalaps
-  cal nz,checkhitlapline
+  ld  a,(Gametype)
+  cp  gamerace
+  cal z,checkhitlapline
 
   ld  l,(ix+head)
   ld  h,(ix+head+1)
@@ -1647,7 +1692,7 @@ Drawworm:
   inc hl
   ld  (hl),b
   inc hl
-  res resbit,h
+  cal resbit
   ld  (ix+head),l
   ld  (ix+head+1),h
 
@@ -1666,7 +1711,7 @@ removetail:
   inc hl
   ld  b,(hl)
   inc hl
-  res resbit,h
+  cal resbit
   ld  (ix+tail),l
   ld  (ix+tail+1),h
 
@@ -1689,13 +1734,8 @@ ResPixel:
 ;-----------------------------
 
 handlethoseneatlittleballs:
-  ld  a,0
-nrballs =$-1
-  or  a
-  ret z
-
   ld  hl,balls
-  ld  b,a
+  ld  b,a ;a=(nrballs)
 handleballs
   psh bc
   psh hl
@@ -1788,6 +1828,12 @@ checkballhit:
 ;----------- procs -----------
 ;-----------------------------
 
+resbit:
+  ld  a,h
+  and (ix+storepos)
+  ld  h,a
+  ret
+
 randompos:
   ld  b,a
 Random: ;(2..b+2)
@@ -1854,14 +1900,6 @@ divideagain: ;3x
   pop hl
   ret
 
-HuntingTimeScore:
-  .db $dd,$7d ;ld a,lx
-  cp  worm2&255
-  ret z ;=worm#2
-  dec (ix+reserv)
-  ret nz
-  ld  hl,10
-
 IncScore:
   ld  h,(ix+score+1)
   ld  l,(ix+score)
@@ -2045,10 +2083,10 @@ NotMaxYScroll:
   jr  nc,NotMinXScroll
   xor a
 NotMinXScroll:
-  cp 128
+  cp  128
 FieldWidth = $-1
-  jr c,NotMaxXScroll
-  ld a,(FieldWidth)
+  jr  c,NotMaxXScroll
+  ld  a,(FieldWidth)
 NotMaxXScroll:
   psh af                        ; >> 3
   and %11111000
@@ -2066,7 +2104,7 @@ NotMaxXScroll:
   inc c
 CopyScreen:
   add hl,bc
-  ld b,57
+  ld  b,57
 CopyScreenLoop:
   psh bc                        ; >> 4
   ld  bc,16
@@ -2121,10 +2159,12 @@ Bit7:
 AfterShiftDelay:
   halt
 AfterShift:
+#ifdef buffer
   ld  hl,DispBuffer
   ld  de,$fc00+$70
   ld  bc,1024-$70
   ldir
+#endif
   pop de                         ; << 1
   pop bc                         ; << 0k
   ret
@@ -2599,20 +2639,37 @@ LevelDefM:
 ;---------- data -------------
 ;-----------------------------
 
-txtWelcome: .db "Welcome to Worm!! ",
-            .db "by Shiar",0
+wtPicture:
+.db %00011110,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
+.db %00111110,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
+.db %01110000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000
+.db %01100000,%01111100,%00000001,%11111111,%00000000,%11110000,%01111001,%11100000
+.db %11100000,%11111110,%00000011,%11111111,%10000011,%11111000,%11111111,%11110000
+.db %11000001,%11000111,%00000111,%00000001,%11000111,%10011001,%11001111,%00111000
+.db %11000001,%10000011,%00000110,%00000000,%11100110,%00000001,%10011111,%10011000
+.db %11000001,%10000011,%00000110,%11000000,%01101110,%00000011,%10111001,%11011100
+.db %11000001,%11000111,%00000110,%11000000,%01101100,%00000011,%00110000,%11001100
+.db %11000000,%11000110,%00000110,%11000000,%01101100,%00000011,%00110000,%11001100
+.db %11100000,%11101110,%00001110,%11000000,%01101100,%00000011,%00111001,%11001100
+.db %01100000,%01111100,%00001100,%11000000,%01101100,%00000011,%00011111,%10001100
+.db %01110000,%00111000,%00011100,%11100000,%11101110,%00000011,%00001111,%00001100
+.db %00111000,%11111110,%00111000,%01110001,%11000110,%00000011,%10000000,%00011100
+.db %00011111,%11101111,%11110000,%00111111,%10000111,%00000001,%10000000,%00011000
+.db %00001111,%10000011,%11100000,%00011111,%00000011,%00000001,%10000000,%00011000
+
+txtMenu:    .db "by Shiar",0
             .db "Have fun!",0 ;4th menu item
-            .db "Level 00",0 ;3rd
-            .db "Worms: 0",0 ;2nd
+            .db "Level 00",0  ;3rd
+            .db "Worms: 0",0  ;2nd
 txtGame:    .db "Singleplayer",0  ;0 (1st)
-txtGame2:   .db "Peaworm     ",0  ;1
+txtGame2:   .db "Peaworm     ",0  ;1 (next 1st)
             .db "Deathmatch",0    ;2
             .db "Foodmatch ",0    ;3
-            .db "LinkMatch",0     ;4 (>options)
-            .db "Hunting  ",0     ;5
-            .db "Race   ",0       ;6
-            .db "CTF ",0          ;7
-            .db "Domination",0    ;(>=8)
+            .db "LinkMatch",0     ;4
+            .db "Race     ",0     ;5
+            .db "CTF ",0          ;6
+            .db "Domination",0    ;7
+txtLevsel:  .db $CF," Select levels: ",5,0
 txtName:    .db "Enter name player ",0
 txtWaiting: .db "Waiting...",0
 txtReceive: .db "Receiving..." ;,0
@@ -2640,25 +2697,34 @@ txtGO:     .db "----- GAME OVER -----",0
 
 gamesdata:
 
-_datalink  = %00000001
-_datalivel = %00000010 ;ix+lives=0 limit
+_datalink  = %00000001 ;linkplay
+_datalivel = %00000010 ;lives=0 limit
 _datafoodl = %00000100 ;left=0 limit
 _datanextl = %00001000 ;next level if left=0
 _datasingl = %00001000 ;singleplayer=1
 _datafood  = %00010000 ;food present
-_datahunt  = %00100000
-_datalaps  = %01000000 ;give lap score
+_________  = %00100000 ;
+_datadie   = %01000000 ;worm dies on impact
 _datascore = %10000000 ;score>=100 limit
+_datamultpeas = 0
+
+gamesingle   =  0
+datasingle: .db %01011110
+gamepeas     =  1
+datapeas:   .db %01011010
+gamedeathm   =  2
+datadeathm: .db %01000010
+gamefoodm    =  3
+datafoodm:  .db %11010000
+gamelinkm    =  4
+datalinkm:  .db %01000011
+gamerace     =  5
+datarace:   .db %10000000
+gamectf      =  6
+datactf:    .db %01000000
+gamedomin    =  7
+datadomin:  .db %01000000 ;==(8 modes)
 
-datasingle: .db %00011110
-datapeas:   .db %00011010
-datadeathm: .db %00000010
-datafoodm:  .db %10010000
-datalinkm:  .db %00000011
-datahuntin: .db %10100000
-datarace:   .db %11000000
-datactf:    .db %00000000 ;==(8 modes)
-;datadomin:  .db %00000000
 datalevels: .dw LevelDef, LevelDef
             .dw LevelDefM,LevelDefM
             .dw LevelDefM,LevelDefM
@@ -2666,16 +2732,16 @@ datalevels: .dw LevelDef, LevelDef
 nrlevels:   .db 2,2,2,2,2,2,2,2
 
 worm1set:  .dw worm1p,worm1p
-           .db 3,0,%01111110,%10,%100 ;< >
+           .db %11110111,3,0,%01111110,%10,%100 ;< >
 worm1name: .db "worm #01",0
 worm2set:  .dw worm2p,worm2p
-           .db 3,0,%00111111,%10000,%1000 ;f1 f2
+           .db %11111011,3,0,%00111111,%10000,%1000 ;f1 f2
 worm2name: .db "worm #02",0
 worm3set:  .dw worm3p,worm3p
-           .db 3,0,%01011111,%10,%100 ;sto ,
+           .db %11111011,3,0,%01011111,%10,%100 ;sto ,
 worm3name: .db "worm #03",0
 worm4set:  .dw worm4p,worm4p
-           .db 3,0,%01111101,%10,%1 ;enter +
+           .db %11111011,3,0,%01111101,%10,%1 ;enter +
 worm4name: .db "worm #04",0
 
 hipeaworm: .dw 0
@@ -2696,21 +2762,22 @@ grow     = 6   ;level
 died     = 8   ;game
 score    = 9   ;game
 delay    = 11  ;game
-
-head     = 12  ;level
-tail     = 14  ;level
-lives    = 16  ;game
-reserv   = 17  ;loop
+               ;19B @game
+head     = 12  ;4B (head=tail)
+tail     = 14  ;also@next level
+storepos = 16
+lives    = 17
+reserv   = 18  ;loop
  ;race:lap
  ;hunt:time
-input    = 18  ;&
-left     = 19  ;&
-right    = 20  ;&
-name     = 21  ;game
-wormsize = 30
-
-respawndelay  = 80
-maxnamelength = 9
+input    = 19
+left     = 20
+right    = 21
+name     = 22
+wormsize = 31
+
+respawndelay  = 30
+maxnamelength = 8+1
 
 ;-----------------------------
 ;----------- end -------------
index 1e0ba72fb49afa9c7bf75658a3326a5bde02c16f..41bf14dbde72c1637087a2ca11909611befbe133 100644 (file)
+;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"
 
-  .org $F3E3-16       ;$E9E3-[name size]
 
-  .db 'w',89          ;wormLevel header (version .89)
-  .db 16,"Worm LevelPack I" ;level name
-  .dw hiscore-single  ;leveldata size
+;---------- HEADER ----------
+
+  .org $F3E3-16                ;$F3E3-[name size]
+            ;^^ <-MUST EQUAL NAME SIZE BELOW!!! If not, Worm will crash!
+
+  .db 'w',90                   ;wormLevel header (version .90)
+  .db 16,"Worm LevelPack I"    ;name size (UPDATE .ORG!!!); level name
+  .dw hiscore-single           ;leveldata size
 
 
 levelsdata:
 
-  .dw single          ;points to singleplayer levels
-  .dw 0               ;...peaworm level (0 = no levels/empty level)
+  .dw single          ;points to singleplayer levels below
+  .dw peaworm         ;...peaworm level
   .dw deathmatch      ;...deathmatch
   .dw foodmatch       ;...foodmatch
   .dw linkmatch       ;...linkmatch
-  .dw hunting         ;...hunting
   .dw race            ;...race
   .dw ctf             ;...capture the flag
+  .dw domination      ;...domination
 
-  .db 2,2,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
+;note: use <.dw 0> if no levels present (empty level will be used).
 
-single:
+  .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
 
-  .db 5,4,15          ;peas in level, delay (0=fastest), pea-growth
-  .db 15,5            ;begin_size, sprite size (0=use default sprite)
+;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=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
+
+  .db 5,4,15          ;peas/delay/growth
+  .db 15,5            ;size/spritesize
   .db %01110000       ;sprite
   .db %10001000
   .db %10001000
   .db %10001000
   .db %01110000
-  .db 0               ;balls (see below)
-  .db 0,2,63          ;your start d (0=down,$80=up), y, x
-  .db 128,57          ;field width (128-255), height (57-255)
-  .db 0,0             ;no additional lines, boxes
+  .db 0               ;balls
+  .db 0,2,63          ;d/y/x
+  .db 128,57          ;field size
+  .db 0,0             ;no lines/boxes
 
-  .db 8,4,15,15,0,0
+  .db 8,4,15,15,0
+  .db 0               ;no sprite
   .db $40,14,2
   .db 128,57
-  .db 1               ;one line:
-  .db 28,28,100,28    ;line coords: x1,y1,x2,y2
+  .db 1
+  .db 28,28,100,28
   .db 0
 
   .db 9,4,15,15,0,0
@@ -52,10 +111,10 @@ single:
   .db 0
 
   .db 4,3,15,10,0,1
-  .db 2,4,0           ;1 bouncing ball, begin y, x, direction (%11=left+up)
+  .db 2,4,0           ;ball
   .db 0,2,124
   .db 128,57
-  .db 2
+  .db 2               ;lines
   .db 28,14,100,41
   .db 28,41,100,14
   .db 0
@@ -71,7 +130,7 @@ single:
   .db 10,3,15,15,0,0
   .db 2,8,$40
   .db 128,90
-  .db 3
+  .db 3               ;lines
   .db 18,20,18,70
   .db 110,20,110,70
   .db 18,45,110,45
@@ -92,7 +151,7 @@ single:
   .db 9,3,15,15,0,0
   .db $40,4,10
   .db 128,82
-  .db 3
+  .db 3               ;lines
   .db 0,20,74,20
   .db 54,40,128,40
   .db 0,60,74,60
@@ -113,7 +172,7 @@ single:
   .db 8,2,15,15,0,0
   .db $C0,67,48
   .db 128,128
-  .db 13
+  .db 13              ;lines
   .db 34,56,56,34
   .db 34,72,56,94
   .db 72,34,94,56
@@ -129,7 +188,7 @@ single:
   .db 91,106,115,106
   .db 0
 
-  .db 255             ;end marker
+  .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.
@@ -144,17 +203,36 @@ endtext:
   .db "  Congratulations!!",0
 
 
+peaworm:
+  .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:
   .db 8,5,15,31,0,0
   .db $40,28,2        ;begin stats for each player
-  .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
+  .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     ;x1,y1,x2,ysize(y2-y1)
-  .db 80,12,112,12    ;...
+  .db 4               ;4 boxes
+  .db 16,12,48,12
+  .db 80,12,112,12
   .db 16,34,48,12
   .db 80,34,112,12
 
@@ -166,6 +244,7 @@ deathmatch:
 
 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
@@ -179,30 +258,19 @@ linkmatch:
   .db 0,0
 
 
-hunting:
-  .db 8,7,15,17,0,0
-  .db $40,28,2,$C0,28,125, $00,2,63,$80,54,63
-  .db 128,57
-  .db 0
-  .db 4
-  .db 4,19,16,14
-  .db 4,19,80,14
-  .db 4,19,16,34
-  .db 4,19,80,34
-
-
 race:
-  .db 8,2,15,10,0,0
+  .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 1
-  .db 8,29,32,20
+  .db 2
+  .db 22,21,104,15
+  .db 52,10,74,37
 
 
 hiscore:
   .dw 0               ;singleplayer hiscore will be saved here
-  .dw 0               ;same for peaworm hiscore
+  .dw 1,2             ;peaworm hiscore for each peaworm-level
 
 
   .end