Home | Rules and Guide | Sign In/Create Account | Write a Post | Reddit | #ludumdare on irc.afternet.org (Info)

Thanks for making Ludum Dare 26 AWESOME! See you in August!

Ludum Dare 26 — April 26-29th, 2013
[ Results: Top 100 Compo, Jam | Top 25 Categories | View My Entry ]
[ View All 2346 Games (Compo Only, Jam Only) | Warmup ]

[ 10 Sec Video Compilation (x3) | 260 Game Video Compilation | IndieCade Deal | Ludum Deals (Unity Deal Ends Soon!) ]


Levels now load… without graphics :/

Posted by
August 24th, 2012 10:55 pm

I’m not QUITE up to that stage yet.

What I DO have, however, is a level loader.

lvl_load:
    movea.l a0,a1
    
    ; blank out entities
    move.w #(ent_sizeof*rENT_MAX)/4-1,d0
    movea.l #rENT_START, a0
    clr.l d1
lp_lvl_load_clearents:
    move.l d1, (a0)+
    dbra d0, lp_lvl_load_clearents
    
    ; clear USED pointer
    move.l #0, rENT_USED
    
    ; prep entities
    clr.w d0
    move.b (a1)+,d0
    addq.l #1,a1
    movea.l #rENT_START,a0
lp_lvl_load_entities:
        ; load X/Y
        clr.w d1
        clr.w d2
        move.b (a1)+,d1
        move.b (a1)+,d2
        lsl.w #5,d1
        lsl.w #5,d2
        move.w d1,ent_x(a0)
        move.w d2,ent_y(a0)
        
        ; load init pointer and run
        movea.l (a1)+,a3
        jsr (a3)
        moveq.l #ent_sizeof,d1
        
        ; set "next" pointer
        move.l rENT_USED,ent_next(a0)
        move.l a0,rENT_USED
        
        ; advance
        adda.l d1, a0
        dbra d0,lp_lvl_load_entities
    
    ; set FREE pointer
    move.l a0, rENT_FREE
    
    ; skip header and whatnot
    clr.l d0
    move.b 5(a1),d0
    move.b d0,d1
    add.b d1,d1
    add.b d1,d0
    lea $12(a1,d0), a1
    
    ; ok, in this part we need to decode the RLE.
    ; it's easier than encoding it, trust me :) 
    move.w #(64*64)-1,d0
    movea.l #rLVL_START,a0
    move.b #0,d1 ; RLELEN
lp_lvl_load_tiles:
    cmpi.b #$00,d1
    beq.b lp_lvl_load_tiles_reload
    cmpi.b #$80,d1
    beq.b lp_lvl_load_tiles_reload
    bcs.b lp_lvl_load_tiles_literal
        ; RLE: copy last tile
        ; someone will kill me for doing it THIS way XD
        move.b -1(a0),(a0)+
        bra.b lpc_lvl_load_tiles
lp_lvl_load_tiles_reload:
        ; load new tile
        move.b (a1)+,d1
        move.b (a1)+,(a0)+
        bra.b lps_lvl_load_tiles
lp_lvl_load_tiles_literal:
        ; LITERAL: copy tile
        move.b (a1)+,(a0)+
        bra.b lpc_lvl_load_tiles
lpc_lvl_load_tiles:
    subq #1,d1
lps_lvl_load_tiles:
    dbra d0, lp_lvl_load_tiles
    
    ; draw level
    jsr lvl_draw
    rts

lvl_draw:
    ; TODO!
    rts

Kudos to anyone who can guess the format :D

3 Responses to “Levels now load… without graphics :/”

  1. hypp says:

    Looks like 680xx assembly. Atari? Amiga?

Leave a Reply

You must be logged in to post a comment.


All posts, images, and comments are owned by their creators.

[cache: storing page]