I started by blogging the process of porting my homebrew game Anguna from the Gameboy Advance to the Nintendo DS. Now, my random thoughts on development and chronicling whatever hobby project catches my fancy.
I recently realized that I was doing it wrong in my room definitions. Previously, I was storing the addresses of each section of background wall data, like:
TestRoom.byte#<TestRoomLineDefsA ;background definition..byte#>TestRoomLineDefsA ; The < and > signify low and high bytes of .byte#<TestRoomLineDefsB ; the pointer address..byte#>TestRoomLineDefsB.byte#<TestRoomLineDefsC ; Atari backgrounds are made up of 3 chunks.byte#>TestRoomLineDefsC ; of data which is why there are 3 pointers..byte#ROOM_COLOR_BROWN ;room colors.byte#ROOM_COLOR_GRAY.byte#TOP_CLOSED ;door flags
.byte#<EnemyDefSlime ;what enemies are in this room.byte#>EnemyDefSlime.byte#3 ;number of enemies.byte#NO_ITEM ;any special items in the room
That's 6 bytes for each room that are used to point to the background data. Realistically, there's no way I'm going to have more than 255 different room backgrounds. (There's…
To be somewhat true to the GBA version, Atari Anguna needs doors: doors that open with the right colored key, doors that open when all enemies are killed, and fake walls that don't look like doors, but allow you to walk through them. Plus, since I'm reusing room wall layouts to save cartridge space, I want the ability to say "use room XYZ but seal off the left door"
This was the new challenge this month. I had to find a mechanism for dynamically drawing doors. The general idea would be just to fill in the "door" opening in the wall with more wall -- either some other color for a locked door, or with the wall color for sealed or fake walls.
The trick is dynamically doing this. The top and bottom walls/doors weren't too bad. I made a rule that no enemies will overlap those scanlines, and, by writing separate kernel code for those lines, gave me enough time to modify the background dynamically. It's easy enough to just modify the "background color…