Advertisement
NovaYoshi

levels.s

Sep 24th, 2014
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;
  2. ; ppppppmm - win condition, parameter
  3. ; ffffdeee - level effect, enemy distribution, max enemy number
  4. ; pppeeeee - enemy type 1
  5. ; pppeeeee - enemy type 2
  6. ; pppeeeee - enemy type 3
  7. ; pppeeeee - enemy type 4
  8. ; aaaaaaaa - map address low
  9. ; aaaaaaaa - map address high
  10.  
  11. WINMODE_REGULAR    = 0
  12. WINMODE_GET_COINS  = 1
  13. WINMODE_SURVIVAL   = 2
  14. WINMODE_HOTELMARIO = 3
  15. EPARAM_0           = 0 << 5
  16. EPARAM_1           = 1 << 5
  17. EPARAM_2           = 2 << 5
  18. EPARAM_3           = 3 << 5
  19. EPARAM_4           = 4 << 5
  20. EPARAM_5           = 5 << 5
  21. EPARAM_6           = 6 << 5
  22. EPARAM_7           = 7 << 5
  23.  
  24. EFFECT_NONE = $00
  25. EFFECT_SCROLL1 = $10 ; scrolling right, slow
  26. EFFECT_SCROLL2 = $20 ; scrolling right, medium
  27. EFFECT_SCROLL3 = $30 ; scrolling right, fast
  28. EFFECT_NOCYCLE = $40 ; no level cycling
  29.  
  30.  
  31. ; 1 2 3 - pack 1
  32. ; 4 5 6 - pack 2
  33. ; 7 8   - challenge
  34.  
  35. .proc LevelParamTable
  36. ;  .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_WAITSHOOT, OBJECT_WAITSHOOT, OBJECT_WAITSHOOT, OBJECT_WAITSHOOT, 0, 0
  37. ; world 1 - pack 1
  38.   .byt WINMODE_REGULAR +(5-1)*4,   EFFECT_NOCYCLE|DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER,   0, 0
  39.   .byt WINMODE_REGULAR +(8-1)*4,   DIST_EQUAL4 +(2-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_JUMPY, OBJECT_JUMPY,     0, 0
  40.   .byt WINMODE_REGULAR +(10-1)*4,  DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_JUMPY, OBJECT_DIAGSHOOT, 0, 0
  41.   .byt WINMODE_SURVIVAL+(15-1)*4,  DIST_EQUAL4 +(4-1), OBJECT_WALKER, OBJECT_JUMPY,  OBJECT_JUMPY, OBJECT_DIAGSHOOT, 0, 0
  42. ; world 2
  43.   .byt WINMODE_GET_COINS +(8-1)*4, DIST_EQUAL4 +(3-1), OBJECT_JUMPY, OBJECT_JUMPY, OBJECT_WALKER, OBJECT_WALKER, <LevelSimple1, >LevelSimple1
  44.   .byt WINMODE_REGULAR +(7-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_FLYBOMBER, OBJECT_FLYBOMBER, OBJECT_JUMPY, OBJECT_JUMPY, 0, 0
  45.   .byt WINMODE_GET_COINS +(8-1)*4, DIST_EQUAL4 +(3-1), OBJECT_FLOATVERTSHOOT, OBJECT_FLOATVERTSHOOT, OBJECT_DIAGSHOOT, OBJECT_WALKER, 0, 0
  46.   .byt WINMODE_REGULAR +(10-1)*4,  DIST_EQUAL4 +(7-1), OBJECT_BOMB, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, <LevelBowl, >LevelBowl
  47. ; world 3
  48.   .byt WINMODE_REGULAR +(10-1)*4,  DIST_EQUAL4 +(4-1), OBJECT_FLOATVERTSHOOT, OBJECT_FLOATVERTSHOOT, OBJECT_DIAGSHOOT, OBJECT_DIAGSHOOT, <LevelSimple2, >LevelSimple2
  49.   .byt WINMODE_GET_COINS +(6-1)*4, DIST_EQUAL4 +(5-1), OBJECT_GOOMBA, OBJECT_JUMPY, OBJECT_JUMPY, OBJECT_JUMPY, <LevelManyPlatforms1, >LevelManyPlatforms1
  50.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(5-1), OBJECT_WALKER, OBJECT_BOMB, OBJECT_BOMB, OBJECT_BOMB, <LevelBowl, >LevelBowl
  51.   .byt WINMODE_REGULAR +(8-1)*4,  DIST_EQUAL4 +(2-1), OBJECT_FLOATVERTSHOOT, OBJECT_FLOATVERTSHOOT, OBJECT_DIAGSHOOT, OBJECT_FLYBOMBER, <LevelStairs1, >LevelStairs1
  52. ; world 4 - pack 2
  53.   .byt WINMODE_HOTELMARIO,   DIST_EQUAL4 +(3-1), OBJECT_DIAGSHOOT, OBJECT_DIAGSHOOT, OBJECT_JUMPY, OBJECT_JUMPY, <LevelMoney1, >LevelMoney1
  54.   .byt WINMODE_REGULAR +(10-1)*4,   DIST_SPLIT53 +(3-1), OBJECT_GOOMBA, OBJECT_GOOMBA, OBJECT_SNEAKER, OBJECT_SNEAKER, <LevelSShape, >LevelSShape
  55.   .byt WINMODE_REGULAR +(10-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_BURGER1, OBJECT_FLYDIAG, OBJECT_RETARD, OBJECT_WALKER, 0, 0
  56.   .byt WINMODE_GET_COINS +(7-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_SNEAKER, OBJECT_JUMPY, OBJECT_SNEAKER, OBJECT_WALKER, <LevelStairs1, >LevelStairs1
  57. ; world 5
  58.   .byt WINMODE_REGULAR +(7-1)*4,   DIST_EQUAL4 +(6-1), OBJECT_JUMPY, OBJECT_JUMPY, OBJECT_JUMPY, OBJECT_JUMPY, <LevelNarrow1, >LevelNarrow1
  59.   .byt WINMODE_REGULAR +(10-1)*4,  DIST_EQUAL4 +(3-1), OBJECT_GOOMBA, OBJECT_GOOMBA, OBJECT_SNEAKER, OBJECT_SNEAKER, <LevelNarrow1, >LevelNarrow1
  60.   .byt WINMODE_GET_COINS +(5-1)*4, DIST_EQUAL4 +(3-1), OBJECT_BURGER2, OBJECT_BURGER2, OBJECT_FLOATVERTSHOOT, OBJECT_FLOATVERTSHOOT, 0, 0
  61.   .byt WINMODE_HOTELMARIO,         DIST_EQUAL4 +(3-1), OBJECT_BURGER1, OBJECT_BURGER1, OBJECT_BURGER2, OBJECT_BURGER2, <LevelMoney1, >LevelMoney1
  62. ; world 6
  63.   .byt WINMODE_REGULAR +(10-1)*4,   DIST_EQUAL4 +(5-1), OBJECT_GEORGE, OBJECT_GEORGE, OBJECT_GEORGE, OBJECT_GEORGE, 0, 0
  64.   .byt WINMODE_REGULAR +(9-1)*4,   DIST_EQUAL4 +(5-1), OBJECT_DIAGSHOOT, OBJECT_RETARD, OBJECT_DIAGSHOOT, OBJECT_GOOMBA, <LevelManyPlatforms2, >LevelManyPlatforms2
  65.   .byt WINMODE_REGULAR +(9-1)*4,   DIST_EQUAL4 +(8-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, <LevelNarrow1, >LevelNarrow1
  66.   .byt WINMODE_GET_COINS +(6-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_TOASTBOT, OBJECT_TOASTBOT, OBJECT_DIAGSHOOT, OBJECT_BURGER1, 0, 0
  67. ; world 7 - challenge levels
  68.   .byt WINMODE_GET_COINS +(7-1)*4,   DIST_EQUAL4 +(5-1), OBJECT_SNEAKER, OBJECT_SNEAKER, OBJECT_SNEAKER, OBJECT_SNEAKER, <LevelDollarSign, >LevelDollarSign
  69.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(5-1), OBJECT_RETARD, OBJECT_RETARD, OBJECT_TOASTBOT, OBJECT_GEORGE, <LevelTriangle, >LevelTriangle
  70.   .byt WINMODE_REGULAR +(8-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_GEORGE, OBJECT_GEORGE, OBJECT_FLYBOMBER, OBJECT_FLYBOMBER, <LevelSimple1, >LevelSimple1
  71.   .byt WINMODE_REGULAR +(18-1)*4,  DIST_EQUAL4 +(6-1), OBJECT_SNEAKER, OBJECT_SNEAKER, OBJECT_SNEAKER, OBJECT_SNEAKER, <LevelSShape, >LevelSShape
  72. ; world 8
  73.   .byt WINMODE_HOTELMARIO,   DIST_EQUAL4 +(5-1), OBJECT_RETARD, OBJECT_RETARD, OBJECT_WAITSHOOT, OBJECT_WAITSHOOT, <LevelTriangle, >LevelTriangle
  74.   .byt WINMODE_REGULAR +(12-1)*4,  DIST_EQUAL4 +(8-1), OBJECT_RETARD, OBJECT_RETARD, OBJECT_RETARD, OBJECT_RETARD, <LevelTriangle, >LevelTriangle
  75.   .byt WINMODE_GET_COINS +(5-1)*4, DIST_EQUAL4 +(8-1), OBJECT_SNEAKER, OBJECT_SNEAKER, OBJECT_SNEAKER, OBJECT_SNEAKER, <LevelStairs1, >LevelStairs1
  76.   .byt WINMODE_REGULAR +(1-1)*4,   DIST_EQUAL4 +(1-1), OBJECT_BILL_HEAD, OBJECT_BILL_HEAD, OBJECT_BILL_HEAD, OBJECT_BILL_HEAD, <LevelFinal, >LevelFinal
  77.  
  78. ; world 9 - bonus levels
  79.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_SPLIT53 +(3-1), OBJECT_TRIGWALK, OBJECT_TRIGWALK, OBJECT_WALKER, OBJECT_WALKER,   0, 0
  80.   .byt WINMODE_REGULAR +(7-1)*4,   DIST_SPLIT53 +(3-1), OBJECT_ROLL_BALL, OBJECT_ROLL_BALL, OBJECT_GOOMBA, OBJECT_GOOMBA,   0, 0
  81.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_TRIGWALK, OBJECT_TRIGWALK, OBJECT_TRIGWALK, OBJECT_TRIGWALK,   <LevelZJ, >LevelZJ
  82.   .byt WINMODE_GET_COINS +(5-1)*4, DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_JUMPY, OBJECT_JUMPY,   <LevelExplode, >LevelExplode
  83. ; world 10
  84.   .byt WINMODE_REGULAR +(9-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_RETARD, OBJECT_RETARD, OBJECT_WALKER, OBJECT_WALKER,   <LevelFlipMirror, >LevelFlipMirror
  85.   .byt WINMODE_REGULAR +(11-1)*4,  DIST_EQUAL4 +(5-1), OBJECT_THWOMP_STATIC, OBJECT_THWOMP_STATIC, OBJECT_THWOMP_STATIC, OBJECT_THWOMP_STATIC,   0, 0
  86.   .byt WINMODE_GET_COINS +(7-1)*4, DIST_EQUAL4 +(6-1), OBJECT_FLYDIAG, OBJECT_FLYDIAG, OBJECT_DIAGSHOOT, OBJECT_DIAGSHOOT,   <LevelX, >LevelX
  87.   .byt WINMODE_REGULAR +(7-1)*4,   DIST_EQUAL4 +(4-1), OBJECT_GEORGE, OBJECT_GEORGE, OBJECT_TOASTBOT, OBJECT_TOASTBOT,   <LevelTPSpikes, >LevelTPSpikes
  88. ; world 11
  89.   .byt WINMODE_REGULAR +(10-1)*4,   DIST_EQUAL4 + EFFECT_SCROLL1 +(3-1), OBJECT_TRIGBOMB, OBJECT_TRIGBOMB, OBJECT_DIAGSHOOT, OBJECT_DIAGSHOOT,   <LevelScrolling1, >LevelScrolling1
  90.   .byt WINMODE_GET_COINS +(7-1)*4,  DIST_EQUAL4 + EFFECT_SCROLL1 +(3-1), OBJECT_BOUNCE_BALL, OBJECT_BOUNCE_BALL, OBJECT_JUMPY, OBJECT_JUMPY,   <LevelSimple1, >LevelSimple1
  91.   .byt WINMODE_HOTELMARIO, DIST_EQUAL4 + EFFECT_SCROLL2 +(3-1), OBJECT_SPEARS, OBJECT_SPEARS, OBJECT_SPEARS, OBJECT_SPEARS,   <LevelMoney1, >LevelMoney1
  92.   .byt WINMODE_HOTELMARIO, DIST_EQUAL4 +(6-1), OBJECT_ROLL_BALL, OBJECT_ROLL_BALL, OBJECT_ROLL_BALL, OBJECT_ROLL_BALL,   <LevelTriangle, >LevelTriangle
  93. ; world 12
  94.   .byt WINMODE_REGULAR +(7-1)*4,   DIST_EQUAL4 +(5-1), OBJECT_BOUNCE_BALL, OBJECT_BOUNCE_BALL, OBJECT_THWOMP_MOVE, OBJECT_THWOMP_MOVE,   <LevelSimple3, >LevelSimple3
  95.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 + EFFECT_SCROLL1 +(5-1), OBJECT_FLAPPY, OBJECT_FLAPPY, OBJECT_BURGER2, OBJECT_BURGER2,   <LevelScrolling2, >LevelScrolling2
  96.   .byt WINMODE_REGULAR +(10-1)*4,  DIST_EQUAL4 +(6-1), OBJECT_BOUNCE_BALL, OBJECT_BOUNCE_BALL, OBJECT_BOUNCE_BALL, OBJECT_BOUNCE_BALL,   <LevelX, >LevelX
  97.   .byt WINMODE_REGULAR +(7-1)*4,   DIST_EQUAL4 +(6-1), OBJECT_TRIGBOMB, OBJECT_TRIGBOMB, OBJECT_TRIGBOMB, OBJECT_TRIGBOMB,   <LevelStairs1, >LevelStairs1
  98. ; world 13
  99.   .byt WINMODE_GET_COINS +(6-1)*4,   DIST_EQUAL4 +(5-1), OBJECT_TRIGBOMB, OBJECT_TRIGBOMB, OBJECT_FLYBOMBER, OBJECT_FLYBOMBER,   <LevelTPIslands, >LevelTPIslands
  100.   .byt WINMODE_REGULAR +(7-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_FLAPPY, OBJECT_FLAPPY, OBJECT_FLAPPY, OBJECT_FLAPPY,   <LevelScrolling2, >LevelScrolling2
  101.   .byt WINMODE_REGULAR +(12-1)*4,  DIST_EQUAL4 +(3-1), OBJECT_GEORGE, OBJECT_GEORGE, OBJECT_POTION, OBJECT_POTION,   <LevelSpringsCycle, >LevelSpringsCycle
  102. .if 0
  103.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER,   0, 0
  104. ; world 14
  105.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER,   0, 0
  106.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER,   0, 0
  107.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER,   0, 0
  108.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER,   0, 0
  109. ; world 15
  110.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER,   0, 0
  111.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER,   0, 0
  112.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER,   0, 0
  113.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER,   0, 0
  114. ; world 16
  115.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER,   0, 0
  116.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER,   0, 0
  117.   .byt WINMODE_REGULAR +(5-1)*4,   DIST_EQUAL4 +(3-1), OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER, OBJECT_WALKER,   0, 0
  118. .endif
  119.   .byt WINMODE_REGULAR +(2-1)*4,   DIST_EQUAL4 + EFFECT_SCROLL2 + (2-1), OBJECT_BILL_HEAD, OBJECT_BILL_HEAD, OBJECT_BILL_HEAD, OBJECT_BILL_HEAD, <LevelFinal, >LevelFinal
  120. .endproc
  121.  
  122. .proc LoadLevelParams ; A = level to load
  123.   ldy LevelEditMode
  124.   bne EditMode
  125.  
  126.   pha
  127.   lda #0
  128.   sta 1
  129.   pla
  130.   asl ; don't need a ROL after every single ASL due to range of level numbers
  131.   asl ; 1 increases support to 64 levels, 2 to 128 etc, but we only need 64 currently
  132.   asl
  133.   rol 1
  134.   add #<LevelParamTable
  135.   sta 0
  136.  
  137.   lda 1
  138.   adc #>LevelParamTable
  139.   sta 1
  140.  
  141.   ldy #0
  142. : lda (0),y
  143.   sta LevelConfigBytes,y
  144.   iny
  145.   cpy #8
  146.   bne :-
  147.  
  148. EditMode:
  149. ; goal type and goal param are stored in the same byte
  150.   lda LevelConfigBytes
  151.   pha
  152.   lsr
  153.   lsr
  154.   sta LevelGoalParam
  155.   inc LevelGoalParam
  156.  
  157.   lda IsScoreMode ; make the level longer if it's versus score
  158.   beq :+
  159.   lda LevelGoalParam
  160.   asl
  161.   add LevelGoalParam
  162.   sta LevelGoalParam
  163. :
  164.  
  165.   pla
  166.   and #3
  167.   sta LevelGoalType
  168.  
  169. ; fetch the four different types of enemies
  170.   lda LevelConfigBytes+2
  171.   sta 0
  172.   lda LevelConfigBytes+3
  173.   sta 1
  174.   lda LevelConfigBytes+4
  175.   sta 2
  176.   lda LevelConfigBytes+5
  177.   sta 3
  178.  
  179. ; get max enemies per screen, then fill out the big 16 entry table based on the distribution flag
  180.   lda LevelConfigBytes+1
  181.   pha
  182.   and #7
  183.   sta MaxScreenEnemies
  184.   inc MaxScreenEnemies
  185.   pla     ; the distribution defaults to 4/16 chance for all enemies
  186.   ldx #0  ; but if the flag for it is set, the chance is changed to 5/16 for the first two
  187.   ldy #0  ; and 3/16 for the last two
  188.   and #DIST_SPLIT53
  189.   tax
  190.  
  191. : lda EnemyDistributionTable,x
  192.   sty 4
  193.   tay
  194.   lda 0, y ; look up from list of enemies for this level
  195.   ldy 4
  196.   sta LevelEnemyPool,y
  197.   inx
  198.   iny
  199.   cpy #16
  200.   bne :-
  201.  
  202. ; apply level effects
  203.   lda LevelConfigBytes+1
  204.   and #$f0
  205.   cmp #EFFECT_NOCYCLE
  206.   bne :+
  207.   inc NoLevelCycle
  208.   rts
  209. : cmp #EFFECT_SCROLL1
  210.   bne :+
  211.   lda #1
  212.   sta ScrollMode
  213. : cmp #EFFECT_SCROLL2
  214.   bne :+
  215.   lda #2
  216.   sta ScrollMode
  217.   rts
  218. : cmp #EFFECT_SCROLL3
  219.   bne :+
  220.   lda #3
  221.   sta ScrollMode
  222.   rts
  223. :
  224.   rts
  225. .endproc
  226.  
  227. DIST_EQUAL4   = 0 << 3
  228. DIST_SPLIT53  = 1 << 3
  229. .proc EnemyDistributionTable
  230.   .byt 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3
  231.   .byt 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3
  232. .endproc
  233.  
  234. LVL_PLAYER = $00
  235. ; single tile stuff continues until $1f
  236. LVL_HSOLID = $20
  237. LVL_HEMPTY = $30
  238. LVL_HCOFFS = $40
  239. LVL_HCONS  = $50
  240. LVL_PLATFM = $60
  241. LVL_HCOFFP = $70
  242. LVL_HCONP  = $80
  243. LVL_VSOLID = $90
  244. LVL_VEMPTY = $a0
  245. LVL_VCOFFS = $b0
  246. LVL_VCONS  = $c0
  247. LVL_RECTFL = $d0
  248.  
  249. .enum
  250.   LVL_EMPTY
  251.   LVL_SPIKES
  252.   LVL_SPRING
  253.   LVL_LAUNCH
  254.   LVL_SOLID
  255.   LVL_MIRROR
  256.   LVL_PLATFM2
  257.   LVL_MONEY
  258. ;
  259.   LVL_CYCSOFF
  260.   LVL_CYCSON
  261.   LVL_CYCPOFF
  262.   LVL_CYCPON
  263.   LVL_TELEL
  264.   LVL_TELER
  265.   LVL_BOMB
  266.   LVL_KILL
  267. ;
  268.   LVL_HMOVEP
  269.   LVL_VMOVEP
  270.   LVL_HMOVEH
  271.   LVL_VMOVEH
  272.   LVL_EXPLODE
  273.   LVL_SWITCH
  274. .endenum
  275.  
  276. LevelData_MetaList: ; used anywhere a single nybble specifies a block type
  277.   .byt METATILE_EMPTY, METATILE_SPIKES, METATILE_SPRING, METATILE_LAUNCH, METATILE_SOLID, METATILE_MIRROR, METATILE_PLATFM, METATILE_MONEY
  278.   .byt METATILE_CYCLE_OFF_SOLID, METATILE_CYCLE_ON_SOLID, METATILE_CYCLE_OFF_PLATF, METATILE_CYCLE_ON_PLATF
  279.   .byt METATILE_TELEPORT_LEFT, METATILE_TELEPORT_RIGHT, METATILE_BOMB_TRAP, METATILE_KILL_SPIKES
  280. LevelData_MetaList2: ; alternate expansion list
  281.   .byt METATILE_HMOVING_PLAT, METATILE_VMOVING_PLAT, METATILE_HMOVING_HARM, METATILE_VMOVING_HARM
  282.   .byt METATILE_EXPLODE, METATILE_INSTANT_SWITCH
  283.  
  284. ; LIST OF LEVEL DESIGNS STARTS HERE
  285. LevelBowl:
  286.   .byt $a0, LVL_RECTFL+LVL_SOLID, $4f
  287.   .byt $a1, LVL_HEMPTY+13
  288.   .byt $a1, LVL_LAUNCH
  289.   .byt $ae, LVL_LAUNCH
  290.   .byt $b2, LVL_HEMPTY+11
  291.   .byt $b2, LVL_LAUNCH
  292.   .byt $bd, LVL_LAUNCH
  293.   .byt $c3, LVL_HEMPTY+9
  294.   .byt $c3, LVL_LAUNCH
  295.   .byt $cc, LVL_LAUNCH
  296.   .byt $d4, LVL_HEMPTY+7
  297.   .byt $d4, LVL_LAUNCH
  298.   .byt $db, LVL_LAUNCH
  299.   .byt $d7, $00
  300. LevelSimple1:
  301.   .byt $b1, LVL_RECTFL+LVL_SOLID, $33
  302.   .byt $a1, LVL_HSOLID+0
  303.   .byt $91, LVL_SPIKES
  304.   .byt $eb, LVL_HSOLID+3
  305.   .byt $dc, LVL_SPRING
  306.   .byt $d7, LVL_SOLID
  307.   .byt $b9, LVL_SOLID
  308.   .byt $ba, LVL_PLATFM+2
  309.   .byt $87, LVL_SOLID
  310.   .byt $84, LVL_PLATFM+2
  311.   .byt $56, LVL_PLATFM+2
  312.   .byt $59, LVL_SOLID
  313.   .byt $a3, $00
  314. LevelSimple2:
  315.   .byt $e1, LVL_HSOLID+4
  316.   .byt $e8, LVL_HSOLID+3
  317.   .byt $ed, LVL_HSOLID+1
  318.   .byt $c5, LVL_PLATFM+3
  319.   .byt $a0, LVL_PLATFM+3
  320.   .byt $90, LVL_HSOLID
  321.   .byt $80, LVL_SPIKES
  322.   .byt $83, LVL_HSOLID+1
  323.   .byt $45, LVL_VSOLID+4
  324.   .byt $46, LVL_PLATFM+4
  325.   .byt $97, LVL_PLATFM+3
  326.   .byt $6a, LVL_PLATFM+2
  327.   .byt $de, LVL_SPIKES
  328.   .byt $d2, $00
  329. LevelManyPlatforms1:
  330.   .byt $e1, LVL_HSOLID+12
  331.   .byt $a0, LVL_PLATFM+4
  332.   .byt $a6, LVL_PLATFM+3
  333.   .byt $c7, LVL_PLATFM+1
  334.   .byt $ca, LVL_PLATFM+1
  335.   .byt $d7, LVL_SPIKES
  336.   .byt $d8, LVL_SPIKES
  337.   .byt $d9, LVL_SPIKES
  338.   .byt $da, LVL_SPIKES
  339.   .byt $d2, LVL_SPIKES
  340.   .byt $ae, LVL_PLATFM+1
  341.   .byt $8a, LVL_PLATFM+1
  342.   .byt $85, LVL_PLATFM+3
  343.   .byt $75, LVL_LAUNCH
  344.   .byt $74, LVL_HSOLID
  345.   .byt $71, LVL_PLATFM+2
  346.   .byt $54, LVL_PLATFM+1
  347.   .byt $57, LVL_PLATFM+2
  348.   .byt $78, LVL_MIRROR
  349.   .byt $92, $00
  350. LevelManyPlatforms2:
  351.   .byt $e1, LVL_HSOLID+3
  352.   .byt $d4, LVL_SPRING
  353.   .byt $e7, LVL_HSOLID+2
  354.   .byt $c9, LVL_VSOLID+1
  355.   .byt $ca, LVL_PLATFM+1
  356.   .byt $cc, LVL_VSOLID+1
  357.   .byt $ec, LVL_HSOLID+2
  358.   .byt $ba, LVL_SPRING
  359.   .byt $93, LVL_PLATFM+4
  360.   .byt $83, LVL_RECTFL+LVL_SPIKES, $04
  361.   .byt $71, LVL_PLATFM+6
  362.   .byt $62, LVL_RECTFL+LVL_LAUNCH, $02
  363.   .byt $63, LVL_SOLID
  364.   .byt $68, LVL_PLATFM
  365.   .byt $59, LVL_PLATFM+1
  366.   .byt $8a, LVL_PLATFM+2
  367.   .byt $7b, LVL_SPRING
  368.   .byt $43, LVL_PLATFM+1
  369.   .byt $20, LVL_PLATFM+2
  370.   .byt $24, LVL_PLATFM+2
  371.   .byt $2a, LVL_PLATFM+2
  372.   .byt $1b, LVL_SPRING
  373.   .byt $d2, $00
  374. LevelStairs1:
  375.   .byt $e2, LVL_HSOLID+6
  376.   .byt $73, LVL_PLATFM+8
  377.   .byt $63, LVL_SPRING
  378.   .byt $64, LVL_HEMPTY
  379.   .byt $b4, LVL_PLATFM
  380.   .byt $a4, LVL_SPRING
  381.   .byt $9f, LVL_SOLID
  382.   .byt $9d, LVL_PLATFM
  383.   .byt $8c, LVL_SOLID
  384.   .byt $8d, LVL_MIRROR
  385.   .byt $ae, LVL_PLATFM
  386.   .byt $bd, LVL_PLATFM
  387.   .byt $cc, LVL_PLATFM
  388.   .byt $cb, LVL_MIRROR
  389.   .byt $d9, LVL_PLATFM+2
  390.   .byt $d4, $00
  391. LevelMoney1:
  392.   .byt $e1, LVL_PLATFM
  393.   .byt $e2, LVL_RECTFL+LVL_SPIKES, $0c
  394.   .byt $e6, LVL_SOLID
  395.   .byt $d6, LVL_SPRING
  396.   .byt $93, LVL_RECTFL+LVL_MONEY, $29
  397.   .byt $83, LVL_PLATFM+9
  398.   .byt $4c, LVL_PLATFM
  399.   .byt $5c, LVL_RECTFL+LVL_MONEY, $20
  400.   .byt $55, LVL_RECTFL+LVL_MONEY, $05
  401.   .byt $52, LVL_RECTFL+LVL_MONEY, $60
  402.   .byt $53, LVL_MONEY
  403.   .byt $73, LVL_MONEY
  404.   .byt $6c, LVL_PLATFM
  405.   .byt $76, LVL_VEMPTY+5
  406.   .byt $c3, LVL_PLATFM+2
  407.   .byt $a3, LVL_PLATFM+2
  408.   .byt $c7, LVL_PLATFM+5
  409.   .byt $a7, LVL_PLATFM+5
  410.   .byt $63, LVL_PLATFM+7
  411.   .byt $43, LVL_PLATFM+7
  412.   .byt $44, LVL_VSOLID+4
  413.   .byt $34, LVL_RECTFL+LVL_MONEY, $05
  414.   .byt $36, LVL_SPIKES
  415.   .byt $3a, LVL_SPIKES
  416.   .byt $b4, $00
  417. LevelDollarSign:
  418.   .byt $e0, LVL_HSOLID+10
  419.   .byt $29, LVL_RECTFL+LVL_MONEY, $a0
  420.   .byt $a2, LVL_PLATFM+10
  421.   .byt $76, LVL_PLATFM+6
  422.   .byt $46, LVL_PLATFM+8
  423.   .byt $56, LVL_RECTFL+LVL_PLATFM2, $20
  424.   .byt $8c, LVL_RECTFL+LVL_PLATFM2, $20
  425.   .byt $84, $00
  426. LevelNarrow1:
  427.   .byt $20, LVL_VSOLID+9
  428.   .byt $81, LVL_PLATFM+1
  429.   .byt $83, LVL_HSOLID+1
  430.   .byt $d1, LVL_RECTFL+LVL_SOLID, $1b
  431.   .byt $29, LVL_RECTFL+LVL_SOLID, $96
  432.   .byt $b8, LVL_RECTFL+LVL_SOLID, $15
  433.   .byt $c1, LVL_SPRING
  434.   .byt $c4, $00
  435. LevelSShape:
  436.   .byt $e3, LVL_HSOLID+11
  437.   .byt $8e, LVL_VSOLID+6
  438.   .byt $88, LVL_HSOLID+6
  439.   .byt $38, LVL_VSOLID+5
  440.   .byt $38, LVL_HSOLID+6
  441.   .byt $28, LVL_RECTFL+LVL_SPIKES, $06
  442.   .byt $d5, LVL_SPRING
  443.   .byt $b4, LVL_PLATFM+2
  444.   .byt $d3, $00
  445. LevelTriangle:
  446.   .byt $e1, LVL_HSOLID+13
  447.   .byt $d1, LVL_RECTFL+LVL_MONEY, $0c
  448.   .byt $b2, LVL_HSOLID+7
  449.   .byt $b4, LVL_PLATFM+2
  450.   .byt $90, LVL_HSOLID
  451.   .byt $bc, LVL_HSOLID+2
  452.   .byt $af, LVL_HSOLID
  453.   .byt $ce, LVL_VSOLID+2
  454.   .byt $9d, LVL_PLATFM
  455.   .byt $83, LVL_HSOLID+1
  456.   .byt $87, LVL_HSOLID+6
  457.   .byt $63, LVL_VSOLID+1
  458.   .byt $52, LVL_VSOLID
  459.   .byt $d5, LVL_SPRING
  460.   .byt $55, LVL_PLATFM
  461.   .byt $56, LVL_HSOLID+1
  462.   .byt $5a, LVL_HSOLID+2
  463.   .byt $5c, LVL_VSOLID+2
  464.   .byt $36, LVL_VSOLID+1
  465.   .byt $35, LVL_RECTFL+LVL_LAUNCH, $10
  466.   .byt $3a, LVL_VSOLID+1
  467.   .byt $29, LVL_VSOLID
  468.   .byt $26, LVL_PLATFM
  469.   .byt $28, LVL_RECTFL+LVL_MONEY, $50
  470.   .byt $76, LVL_RECTFL+LVL_MONEY, $04
  471.   .byt $76, LVL_RECTFL+LVL_MONEY, $30
  472.   .byt $a3, LVL_RECTFL+LVL_MONEY, $0b
  473.   .byt $bb, LVL_RECTFL+LVL_MONEY, $10
  474.   .byt $d3, $00
  475. LevelFinal:
  476.   .byt $e1, LVL_HSOLID+13
  477.   .byt $d4, $00
  478.  
  479. LevelScrolling1:
  480.   .byt $e0, LVL_HSOLID+12
  481.   .byt $d3, LVL_SPRING
  482.   .byt $d4, LVL_HSOLID+6
  483.   .byt $c4, LVL_HSOLID+3
  484.   .byt $b6, LVL_SPRING
  485.   .byt $aa, LVL_PLATFM+2
  486.   .byt $9b, LVL_SPRING
  487.   .byt $9d, LVL_PLATFM+2
  488.   .byt $8f, LVL_SPRING
  489.   .byt $b4, $00
  490. LevelScrolling2:
  491.   .byt $e0, LVL_RECTFL+LVL_SPIKES, $0f
  492.   .byt $51, LVL_VSOLID+9
  493.   .byt $93, LVL_VSOLID+5
  494.   .byt $25, LVL_VSOLID+12
  495.   .byt $54, LVL_HSOLID
  496.   .byt $86, LVL_HSOLID
  497.   .byt $b7, LVL_HSOLID+3
  498.   .byt $8b, LVL_RECTFL+LVL_SOLID, $63
  499.   .byt $7c, $00
  500. LevelTPSpikes:
  501.   .byt $ea, LVL_RECTFL+LVL_KILL, $04
  502.   .byt $b0, LVL_HSOLID+12
  503.   .byt $80, LVL_VSOLID+3
  504.   .byt $71, LVL_RECTFL+LVL_KILL, $05
  505.   .byt $57, LVL_VSOLID+2
  506.   .byt $57, LVL_HSOLID+5
  507.   .byt $4c, LVL_HSOLID
  508.   .byt $4c, LVL_TELER
  509.   .byt $a4, LVL_TELEL
  510.   .byt $a7, LVL_BOMB
  511.   .byt $aa, LVL_SPRING
  512.   .byt $a8, $00
  513. LevelX:
  514.   .byt $c2, LVL_RECTFL+LVL_CYCSON, $22
  515.   .byt $95, LVL_RECTFL+LVL_CYCSON, $22
  516.   .byt $68, LVL_RECTFL+LVL_CYCSON, $22
  517.   .byt $3b, LVL_RECTFL+LVL_CYCSON, $22
  518.   .byt $cb, LVL_RECTFL+LVL_CYCSOFF, $22
  519.   .byt $98, LVL_RECTFL+LVL_CYCSOFF, $22
  520.   .byt $65, LVL_RECTFL+LVL_CYCSOFF, $22
  521.   .byt $32, LVL_RECTFL+LVL_CYCSOFF, $22
  522.   .byt $b3, $00
  523. LevelTPIslands:
  524.   .byt $e2, LVL_HSOLID+2
  525.   .byt $c7, LVL_VSOLID+2
  526.   .byt $b7, LVL_SPRING
  527.   .byt $b9, LVL_RECTFL+LVL_SOLID, $22
  528.   .byt $7c, LVL_VSOLID+4
  529.   .byt $72, LVL_RECTFL+LVL_SOLID, $32
  530.   .byt $d3, LVL_TELER
  531.   .byt $63, LVL_TELER
  532.   .byt $ab, LVL_TELER
  533.   .byt $75, LVL_HMOVEP
  534.   .byt $d4, $00
  535. LevelSpringsCycle:
  536.   .byt $e2, LVL_HSOLID+5
  537.   .byt $c3, LVL_RECTFL+LVL_SOLID, $33
  538.   .byt $e8, LVL_RECTFL+LVL_SPRING, $06
  539.   .byt $c7, LVL_HCONS+7
  540.   .byt $b8, LVL_RECTFL+LVL_LAUNCH, $05
  541.   .byt $a9, LVL_RECTFL+LVL_LAUNCH, $03
  542.   .byt $b9, LVL_HCONS+3
  543.   .byt $aa, LVL_HCONS+1
  544.   .byt $2e, LVL_HCOFFS
  545.   .byt $37, LVL_HCOFFS+7
  546.   .byt $b3, $00
  547. LevelZJ:
  548.   .byt $e0, LVL_HSOLID+3
  549.   .byt $b0, LVL_VSOLID+3
  550.   .byt $d2, LVL_SPRING
  551.   .byt $e8, LVL_RECTFL+LVL_KILL, $07
  552.   .byt $8d, LVL_RECTFL+LVL_SOLID, $62
  553.   .byt $b2, LVL_PLATFM+5
  554.   .byt $a5, LVL_SPRING
  555.   .byt $84, LVL_PLATFM+2
  556.   .byt $87, LVL_VSOLID+2
  557.   .byt $88, LVL_HMOVEP
  558.   .byt $d3, $00
  559. LevelFlipMirror:
  560.   .byt $e1, LVL_HCOFFS+3
  561.   .byt $eb, LVL_HCONS+3
  562.   .byt $d4, LVL_SPRING
  563.   .byt $db, LVL_SPRING
  564.   .byt $c5, LVL_RECTFL+LVL_CYCSON, $22
  565.   .byt $c8, LVL_RECTFL+LVL_CYCSOFF, $22
  566.   .byt $b4, LVL_HCOFFP+2
  567.   .byt $b9, LVL_HCONP+2
  568.   .byt $93, LVL_HCOFFP+4
  569.   .byt $98, LVL_HCONP+4
  570.   .byt $d4, $00
  571. LevelExplode:
  572.   .byt $d1, LVL_RECTFL+LVL_SOLID, $17
  573.   .byt $c4, LVL_SPRING
  574.   .byt $b6, LVL_RECTFL+LVL_SOLID, $12
  575.   .byt $a7, LVL_HSOLID+1
  576.   .byt $a6, LVL_EXPLODE
  577.   .byt $a2, LVL_HCONP+1
  578.   .byt $81, LVL_HCONP+3
  579.   .byt $67, LVL_EXPLODE
  580.   .byt $98, LVL_SPRING
  581.   .byt $9b, LVL_RECTFL+LVL_SOLID, $12
  582.   .byt $8b, LVL_RECTFL+LVL_SPIKES, $02
  583.   .byt $6a, LVL_HCOFFP+3
  584.   .byt $c2, $00
  585. LevelSimple3:
  586.   .byt $e2, LVL_HSOLID+12
  587.   .byt $d6, LVL_SPRING
  588.   .byt $be, LVL_VSOLID+2
  589.   .byt $cd, LVL_VSOLID+1
  590.   .byt $dc, LVL_VSOLID+0
  591.   .byt $b5, LVL_PLATFM+2
  592.   .byt $a5, LVL_SPRING
  593.   .byt $9a, LVL_PLATFM+2
  594.   .byt $79, LVL_VSOLID+1
  595.   .byt $76, LVL_PLATFM+2
  596.   .byt $48, LVL_VSOLID+2
  597.   .byt $49, LVL_PLATFM+2
  598.   .byt $d4, $00
  599. LevelBowlSwitch:
  600.   .byt $e2, LVL_HSOLID+11
  601.   .byt $d2, LVL_SPIKES
  602.   .byt $dd, LVL_SPIKES
  603.   .byt $62, LVL_VSOLID+6
  604.   .byt $63, LVL_VSOLID
  605.   .byt $6d, LVL_VSOLID+6
  606.   .byt $6c, LVL_VSOLID
  607.   .byt $84, LVL_HCOFFP+7
  608.   .byt $c6, LVL_HCONP+3
  609.   .byt $d4, $00
  610. LevelTwoHills:
  611.   .byt $e2, LVL_HSOLID+11
  612.   .byt $d5, LVL_SPRING
  613.   .byt $b5, LVL_RECTFL+LVL_SOLID, $22
  614.   .byt $ab, LVL_RECTFL+LVL_SOLID, $32
  615.   .byt $e8, LVL_RECTFL+LVL_SPIKES, $02
  616.   .byt $9c, LVL_SPRING
  617.   .byt $81, LVL_HSOLID+2
  618.   .byt $52, LVL_PLATFM+3
  619.   .byt $56, LVL_HCOFFP+2
  620.   .byt $d4, $00
  621. LevelManyPlatforms3:
  622.   .byt $e1, LVL_HSOLID+13
  623.   .byt $d1, LVL_RECTFL+LVL_SPIKES, 13
  624.   .byt $e8, LVL_RECTFL+LVL_SPIKES, $03
  625.   .byt $d8, LVL_PLATFM+3
  626.   .byt $b1, LVL_HCOFFP+4
  627.   .byt $b7, LVL_HCONP+3
  628.   .byt $a0, LVL_HCONP+4
  629.   .byt $96, LVL_HCOFFP+4
  630.   .byt $82, LVL_HCONP+3
  631.   .byt $86, LVL_HCONP+3
  632.   .byt $74, LVL_HCOFFP+3
  633.   .byt $6a, LVL_HCOFFP+3
  634.   .byt $57, LVL_HCONP+3
  635.   .byt $44, LVL_HCOFFP+3
  636.   .byt $c8, $00
  637. ;LevelStairs2:
  638. ;  .byt $d4, $00
  639.  
  640. .proc DecodeLevelMap
  641. BufPos = 0
  642. Param = 1
  643. Temp = 2
  644. Code = 3
  645. Width = 4
  646. Height = 5
  647. Pointer = 6 ;is also 7
  648. BlockId = 8
  649.   lda LevelMapPointer+0 ; LevelMapPointer isn't in zeropage, so copy it there
  650.   sta Pointer+0
  651.   lda LevelMapPointer+1
  652.   sta Pointer+1
  653.  
  654.   lda #1
  655.   sta IsMappedLevel
  656.   ldy #0
  657. Loop:
  658.   lda (Pointer),y
  659.   sta BufPos
  660.   iny
  661.   lda (Pointer),y
  662.   bne :+
  663.     lda BufPos ; reload the position, we need that
  664.     unpack LevelEditStartX, LevelEditStartY
  665.     rts
  666. : iny
  667.  
  668.   pha ; get param
  669.   and #15
  670.   sta Param
  671.   tax ; just in case this needs to use the param as a block number
  672.   lda LevelData_MetaList,x
  673.   sta BlockId
  674.   pla
  675.  
  676.   and #$f0 ; get function
  677.   lsr
  678.   lsr
  679.   lsr
  680.  
  681.   sty Temp
  682.   jsr Call
  683.   ldy Temp
  684.   jmp Loop
  685. Call:
  686.   tax
  687.   lsr
  688.   sta Code
  689.   lda ObjectTypeTable+1,x
  690.   pha
  691.   lda ObjectTypeTable+0,x
  692.   pha
  693.   lda Code
  694.   ldx BufPos
  695.   rts
  696. ObjectTypeTable:
  697.   .raddr ZeroType
  698.   .raddr OneType
  699.   .raddr HorzRepeat ; solid
  700.   .raddr HorzRepeat ; empty
  701.   .raddr HorzRepeat ; cycle off solid
  702.   .raddr HorzRepeat ; cycle on solid
  703.   .raddr HorzRepeat ; platform
  704.   .raddr HorzRepeat ; cycle off platform
  705.   .raddr HorzRepeat ; cycle on platform
  706.   .raddr VertRepeat ; solid
  707.   .raddr VertRepeat ; empty
  708.   .raddr VertRepeat ; cycle off solid
  709.   .raddr VertRepeat ; cycle on solid
  710.   .raddr RectFill
  711. ZeroType:
  712.   lda BlockId
  713.   sta LevelBuf,x
  714.   rts
  715. OneType:
  716.   sty TempVal+1
  717.   ldy Param
  718.   lda LevelData_MetaList+16,y
  719.   ldy TempVal+1
  720.   sta LevelBuf,x
  721.   rts
  722. HorzRepeat:
  723.   sub #2
  724.   tay
  725.   lda FillTypeTable,y
  726.   ldy Param
  727.   iny
  728. : sta LevelBuf,x
  729.   inx
  730.   dey
  731.   bne :-
  732.   rts
  733. VertRepeat:
  734.   sub #9
  735.   tay
  736.   lda FillTypeTable,y
  737.   ldy Param
  738.   iny
  739. : sta LevelBuf,x
  740.   pha
  741.   txa
  742.   axs #-16
  743.   pla
  744.   dey
  745.   bne :-
  746.   rts
  747. RectFill:
  748.   inc Temp
  749.   lda (Pointer),y
  750.   unpack Width,Height
  751.   inc Width
  752.   inc Height
  753.  
  754. HeightLoop:
  755.   ldy Width
  756.   lda BlockId
  757.   stx BufPos
  758. WidthLoop:
  759.   sta LevelBuf,x
  760.   inx
  761.   dey
  762.   bne WidthLoop
  763.  
  764.   lax BufPos
  765.   axs #-16
  766.  
  767.   dec Height
  768.   bne HeightLoop
  769.   rts
  770. FillTypeTable:
  771.   .byt METATILE_SOLID, METATILE_EMPTY, METATILE_CYCLE_OFF_SOLID, METATILE_CYCLE_ON_SOLID
  772.   .byt METATILE_PLATFM, METATILE_CYCLE_OFF_PLATF, METATILE_CYCLE_ON_PLATF
  773. .endproc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement