A dungeon delver roguelike using Pathfinder 2nd edition rules
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Attempting to add a title screen, currently not working

+255 -16
+3 -2
gb/Makefile
··· 3 3 SRCDIR = src 4 4 OBJDIR = obj 5 5 BINDIR = bin 6 + LIBDIR = libs 6 7 RESDIR = $(SRCDIR)/resources 7 8 ASMDIR = $(SRCDIR)/main 8 9 RESSPRITES = $(RESDIR)/sprites ··· 46 47 $(GENBACKGROUNDS)/title.tilemap 47 48 48 49 $(GENSPRITES)/%.2bpp: $(RESSPRITES)/%.png | $(GENSPRITES) 49 - $(GFX) -c "#FFFFFF,#cfcfcf,#686868,#000000;" --columns -o $@ $< 50 + $(GFX) -c '#fff,#cfcfcf,#686868,#000;' --columns -o $@ $< 50 51 51 52 $(GENBACKGROUNDS)/%.tilemap: $(RESBACKGROUNDS)/%.png | $(GENBACKGROUNDS) 52 - $(GFX) -c "#FFFFFF,#cbcbcb,#414141,#000000;" \ 53 + $(GFX) -c '#000,#545654,#9fa29f,#fff;' \ 53 54 --tilemap $@ \ 54 55 --unique-tiles \ 55 56 -o $(GENBACKGROUNDS)/$*.2bpp \
+39
gb/libs/input.asm
··· 1 + INCLUDE "hardware.inc/hardware.inc" 2 + 3 + SECTION "Input", ROM0 4 + 5 + Input:: 6 + ; Poll half the controller 7 + ld a, P1F_GET_BTN 8 + call .onenibble 9 + ld b, a ; B7-4 = 1; B3-0 = unpressed buttons 10 + 11 + ; Poll the other half 12 + ld a, P1F_GET_DPAD 13 + call .onenibble 14 + swap a ; A3-0 = unpressed directions; A7-4 = 1 15 + xor a, b ; A = pressed buttons + directions 16 + ld b, a ; B = pressed buttons + directions 17 + 18 + ; And release the controller 19 + ld a, P1F_GET_NONE 20 + ldh [rP1], a 21 + 22 + ; Combine with previous wCurKeys to make wNewKeys 23 + ld a, [wCurKeys] 24 + xor a, b ; A = keys that changed state 25 + and a, b ; A = keys that changed to presed 26 + ld [wNewKeys], a 27 + ld a, b 28 + ld [wCurKeys], a 29 + ret 30 + 31 + .onenibble 32 + ldh [rP1], a ; switch the key matrix 33 + call .knownret ; burn 10 cycles calling a known ret 34 + ldh a, [rP1] ; ignore value while waiting for the key matrix to settle 35 + ldh a, [rP1] 36 + ldh a, [rP1] ; this read counts 37 + or a, $f0 ; A7-4 = 1; A3-0 = unpressed keys 38 + .knownret 39 + ret
+57 -14
gb/src/main/main.asm
··· 1 1 INCLUDE "hardware.inc/hardware.inc" 2 2 rev_Check_hardware_inc 4.0 3 3 4 + SECTION "GameVariables", WRAM0 5 + 6 + wLastKeys:: db 7 + wCurKeys:: db 8 + wNewKeys:: db 9 + wGameState:: db 10 + 4 11 SECTION "Header", ROM0[$100] 5 12 6 13 ; This is your ROM's entry point ··· 19 26 SECTION "Entry point", ROM0 20 27 21 28 EntryPoint: 22 - ; Seed random number generator 23 - ld b, 0 24 - ld c, 10 25 - call srand 29 + ; Shut down audio circuitry 30 + xor a 31 + ld [rNR52], a 32 + ld [wGameState], a 33 + 34 + ; Wait for VBlank phase before initiating the library 35 + call WaitForOneVBlank 36 + 37 + ; Turn the LCD off 38 + xor a 39 + ld [rLCDC], a 40 + 41 + ; Turn the LCD on 42 + ld a, LCDCF_ON | LCDCF_BGON | LCDCF_OBJON 43 + ld [rLCDC], a 44 + 45 + ; During the first (blank) frame, intialize display registers 46 + ld a, %11100100 47 + ld [rBGP], a 48 + ld [rOBP0], a 49 + 50 + NextGameState:: 51 + ; Do not turn the LCD off outside of VBlank 52 + call WaitForOneVBlank 53 + call ClearBackground 26 54 27 - ; Initialize Dungeon 28 - ld b, 6 ; Starting Width 29 - ld c, 6 ; Starting Height 30 - ld d, 36 ; W * H 31 - ld e, 27 ; W * H * 0.75 32 - call InitDungeon 33 - call GenerateDungeon 55 + ; Turn the LCD off 56 + xor a 57 + ld [rLCDC], a 34 58 35 - jp Done 59 + ld [rSCX], a 60 + ld [rSCY], a 61 + ld [rWX], a 62 + ld [rWY], a 63 + ; disable interrupts 64 + ; call DisableInterrupts 65 + 66 + ; Clear all sprites 67 + ; call ClearAllSprites 68 + 69 + ; Initiate the next state 70 + ld a, [wGameState] 71 + cp 1 ; 1 = Gameplay 72 + ; call z, InitGameplayState 73 + ld a, [wGameState] 74 + and a ; 0 = Menu 75 + call z, InitTitleScreenState 36 76 37 - Done: 38 - jp Done 77 + ; Update the next state 78 + ld a, [wGameState] 79 + cp 1 ; 1 = Gameplay 80 + ; jp z, UpdateGameplayState 81 + jp UpdateTitleScreenState
+9
gb/src/main/states/gameplay/interrupts.asm
··· 1 + INCLUDE "hardware.inc/hardware.inc" 2 + 3 + SECTION "Interrupts", ROM0 4 + 5 + DisableInterrupts:: 6 + xor a 7 + ldh [rSTAT], a 8 + di 9 + ret
+36
gb/src/main/states/title-screen/title-screen-state.asm
··· 1 + INCLUDE "hardware.inc/hardware.inc" 2 + 3 + SECTION "TitleScreenState", ROM0 4 + 5 + titleScreenTileData: INCBIN "src/generated/backgrounds/title.2bpp" 6 + titleScreenTileDataEnd: 7 + 8 + titleScreenTileMap: INCBIN "src/generated/backgrounds/title.tilemap" 9 + titleScreenTileMapEnd: 10 + 11 + InitTitleScreenState:: 12 + call DrawTitleScreen 13 + 14 + ld a, LCDCF_ON | LCDCF_BGON | LCDCF_OBJON 15 + ld [rLCDC], a 16 + ret 17 + 18 + DrawTitleScreen:: 19 + ld de, titleScreenTileData 20 + ld hl, $9340 21 + ld bc, titleScreenTileDataEnd - titleScreenTileData 22 + call CopyDEIntoMemoryAtHL 23 + 24 + ld de, titleScreenTileMap 25 + ld hl, $9800 26 + ld bc, titleScreenTileMapEnd - titleScreenTileMap 27 + jp CopyDEintoMemoryAtHL_With520Offset 28 + 29 + UpdateTitleScreenState:: 30 + ld a, PADF_A 31 + ld [mWaitKey], a 32 + 33 + call WaitForKeyFunction 34 + ld a, 1 35 + ld [wGameState], a 36 + jp NextGameState
+27
gb/src/main/utils/background-utils.asm
··· 1 + INCLUDE "hardware.inc/hardware.inc" 2 + 3 + SECTION "Background", ROM0 4 + 5 + ClearBackground:: 6 + ; Turn the LCD off 7 + xor a 8 + ld [rLCDC], a 9 + 10 + ld bc, 1024 11 + ld hl, $9800 12 + 13 + ClearBackgroundLoop: 14 + xor a 15 + ld [hli], a 16 + 17 + dec bc 18 + ld a, b 19 + or c 20 + 21 + jp nz, ClearBackgroundLoop 22 + 23 + ; Turn the LCD on 24 + ld a, LCDCF_ON | LCDCF_BGON | LCDCF_OBJON 25 + ld [rLCDC], a 26 + 27 + ret
+35
gb/src/main/utils/input-utils.asm
··· 1 + SECTION "InputUtilsVariables", WRAM0 2 + 3 + mWaitKey:: db 4 + 5 + SECTION "InputUtils", ROM0 6 + 7 + WaitForKeyFunction:: 8 + push bc 9 + 10 + WaitForKeyFunction_Loop: 11 + ld a, [wCurKeys] 12 + ld [wLastKeys], a 13 + 14 + call Input 15 + 16 + ld a, [mWaitKey] 17 + ld b, a 18 + ld a, [wCurKeys] 19 + and b 20 + jp z, WaitForKeyFunction_NotPressed 21 + 22 + ld a, [wLastKeys] 23 + and b 24 + jp nz, WaitForKeyFunction_NotPressed 25 + 26 + pop bc 27 + ret 28 + 29 + WaitForKeyFunction_NotPressed: 30 + ld a, 1 31 + ld [wVBlankCount], a 32 + 33 + call WaitForVBlankFunction 34 + 35 + jp WaitForKeyFunction_Loop
+21
gb/src/main/utils/memory-utils.asm
··· 1 + SECTION "MemoryUtilsSection", ROM0 2 + 3 + CopyDEIntoMemoryAtHL:: 4 + ld a, [de] 5 + ld [hli], a 6 + inc de 7 + dec bc 8 + ld a, b 9 + or c 10 + jp nz, CopyDEIntoMemoryAtHL 11 + ret 12 + 13 + CopyDEintoMemoryAtHL_With520Offset:: 14 + ld a, [de] 15 + add a, 52 16 + ld [hli], a 17 + inc de 18 + dec bc 19 + or c 20 + jp nz, CopyDEintoMemoryAtHL_With520Offset 21 + ret
+28
gb/src/main/utils/vblank-utils.asm
··· 1 + INCLUDE "hardware.inc/hardware.inc" 2 + 3 + SECTION "VBlankVariables", WRAM0 4 + 5 + wVBlankCount:: db 6 + 7 + SECTION "VBlankFunctions", ROM0 8 + 9 + WaitForOneVBlank:: 10 + ld a, 1 11 + ld [wVBlankCount], a 12 + 13 + WaitForVBlankFunction:: 14 + 15 + WaitForVBlankFunction_Loop:: 16 + ld a, [rLY] 17 + cp 144 18 + jp c, WaitForVBlankFunction_Loop 19 + ld a, [wVBlankCount] 20 + sub 1 21 + ld [wVBlankCount], a 22 + ret z 23 + 24 + WaitForKeyFunction_Loop2:: 25 + ld a, [rLY] 26 + cp 144 27 + jp nc, WaitForKeyFunction_Loop2 28 + jp WaitForVBlankFunction_Loop