Squashed commit of the following:

commit b8c233642e9520df77213b870e419b57b748119a
Author: Alex Gentilucci <alexander.gentilucci@gmail.com>
Date:   Wed Jun 3 15:26:33 2020 -0600

    Removed Session from being tracked

commit 317b7a63052ef7a9f82ef3c93983259f2923d30e
Merge: f82d4fc 0eb7ff6
Author: Alex Gentilucci <alexander.gentilucci@gmail.com>
Date:   Wed Jun 3 15:24:55 2020 -0600

    Merge branch 'video' into next

commit f82d4fc3b9a084090f0c55bed0e01c3a2caf09d8
Author: Alex Gentilucci <alexander.gentilucci@gmail.com>
Date:   Wed Jun 3 15:24:21 2020 -0600

    Updated todo list

commit a1fef00ec6f8bda356e48eef573e67e27eb8d144
Author: Alex Gentilucci <alexander.gentilucci@gmail.com>
Date:   Wed Jun 3 15:17:05 2020 -0600

    Added player and scroll screen

commit fc988786b96d55703ab611fa2eb5315c888c3467
Author: Alex Gentilucci <alexander.gentilucci@gmail.com>
Date:   Wed Jun 3 10:46:06 2020 -0600

    Fixed cut-off pixel on schnoz

commit 0eb7ff61391d7474f67b4c6b2984f7d8ddf64984
Author: Alex Gentilucci <alexander.gentilucci@gmail.com>
Date:   Wed Jun 3 15:17:05 2020 -0600

    Added player and scroll screen

commit 1ddda26261ab01d96333bf647db697ab16c2a5f4
Author: Alex Gentilucci <alexander.gentilucci@gmail.com>
Date:   Wed Jun 3 10:47:25 2020 -0600

    Added GBFS to dependency list

commit c4f0835966f3bb2bd7b0b0a8a5984bcc8b84efcb
Merge: 589cb9e b424e17
Author: Alex Gentilucci <alexander.gentilucci@gmail.com>
Date:   Wed Jun 3 10:46:30 2020 -0600

    Merge branch 'art' into video

commit b424e17862fe0a2f507af4e82e18f3e5dd47b562
Author: Alex Gentilucci <alexander.gentilucci@gmail.com>
Date:   Wed Jun 3 10:46:06 2020 -0600

    Fixed cut-off pixel on schnoz

commit 476fcdbebc0606669bebf304bb819cf491d2672f
Author: Alex Gentilucci <alexander.gentilucci@gmail.com>
Date:   Tue Jun 2 23:16:44 2020 -0600

    Clarified README
This commit is contained in:
Alex Gentilucci 2020-06-03 15:30:50 -06:00
parent fb87c292ed
commit a0ab5a11d7
Signed by: nytpu
GPG Key ID: 144ADD49F173F5CE
5 changed files with 106 additions and 32 deletions

View File

@ -23,6 +23,7 @@ individually:
pointing towards the correct install locations
* `grit` — for converting exported maps or tilesets to `.h` and `.c` files for
use in the game
* `gbfs` — for building the GBFS filesystem
* `portlibs` installed to `$DEVKITPRO/portlibs`
* `libtonc` installed to `$DEVKITPRO/libtonc`
* Working installations of all `arm-none-eabi-` tools
@ -50,8 +51,8 @@ on your flashcart or in an emulator and it should just work™.
If you modified graphics at all, you *must* regenerate the bin files manually
(using `grit <file>.png -ff` or `grit <file>.png -ff<file>_f<frame>.grit` for
animations) and place them in the graphics folder. `make` will take care of
creating the GBFS file and adding it to the finished ROM for you though.
animations) and place the `bin`s in the graphics folder. `make` will take care
of creating the GBFS file and adding it to the finished ROM for you though.
### repo layout
I don't expect anyone else to work on this, so it's more for my reference than
@ -77,14 +78,15 @@ Current branches:
* `master` — main branch
## special thanks to
* [cearn][stt-1] for his wonderful [tonclib][stt-2] as well as his very
in-depth and useful [tonc tutorial][stt-3]. Without these tools and
references, I would have been totally unable to make anything like this.
* [DevKitPro][stt-4] for their amazing [DevKitARM][stt-5] toolchain, complete
* [DevKitPro][stt-1] for their amazing [DevKitARM][stt-2] toolchain, complete
with a custom `libc` and `gcc`, without which I wouldn't have even
thought of attempting anything with the GBA.
* [Squirm][stt-6], [Hollow Knight][stt-7], [Celeste][stt-8], [PICO-8][stt-9] &
its entire community, and an unenumerable number of other places for
* [cearn][stt-3] for his wonderful [tonclib][stt-4] as well as his very
in-depth and useful [tonc tutorial][stt-5]. Without these tools and
references, I would have been totally unable to make anything like this.
* [Damian Yerrick][stt-6] for [GBFS][stt-7], which makes it so much easier for
* [Squirm][stt-8], [Hollow Knight][stt-9], [Celeste][stt-10], [PICO-8][stt-11]
& its entire community, and an unenumerable number of other places for
inspiring this game.
## copyright
@ -105,12 +107,14 @@ either license. For more details, see COPYING.
[bld-1]: https://devkitpro.org/wiki/Getting_Started/devkitARM
[bld-2]: http://schacon.github.io/git/gitworkflows.html
[stt-1]: http://www.coranac.com/
[stt-2]: http://www.coranac.com/projects/tonc/
[stt-3]: http://www.coranac.com/tonc/text/toc.htm
[stt-4]: https://devkitpro.org/wiki/about
[stt-5]: https://devkitpro.org/wiki/devkitARM
[stt-6]: https://alpenter.space/squirm.html
[stt-7]: http://www.hollowknight.com/
[stt-8]: https://www.lexaloffle.com/bbs/?pid=11722
[stt-9]: https://www.lexaloffle.com/pico-8.php
[stt-1]: https://devkitpro.org/wiki/about
[stt-2]: https://devkitpro.org/wiki/devkitARM
[stt-3]: http://www.coranac.com/
[stt-4]: http://www.coranac.com/projects/tonc/
[stt-5]: http://www.coranac.com/tonc/text/toc.htm
[stt-6]: https://pineight.com/
[stt-7]: https://pineight.com/gba/#gbfs
[stt-8]: https://alpenter.space/squirm.html
[stt-9]: http://www.hollowknight.com/
[stt-10]: https://www.lexaloffle.com/bbs/?pid=11722
[stt-11]: https://www.lexaloffle.com/pico-8.php

14
TODO.md
View File

@ -1,12 +1,12 @@
# things to do:
* [ ] Finish tilemaps
* [ ] Hub
* [x] Hub
* [ ] Fire
* [ ] Water(?)
* [ ] Overworld
* [ ] Currently unknown...
* [ ] Currently unknown
* [ ] Make sprites
* [ ] Player
* [x] Player
* [ ] Mobile enemies
* [ ] Hub
* [ ] Fire
@ -16,4 +16,10 @@
* [ ] Easter eggs
* [ ] Other
* [ ] Code the game
* To be filled out later...
* [x] Display background
* [x] Display sprites
* [x] Move sprites with d-pad
* [x] Scroll background when sprite is in outer ¼ of the screen
* [ ] Collide sprites with background
* [ ] Enemy logic
* [ ] More…

View File

@ -1 +1 @@
-g -gB4 -al17 -aw16 -m! -p -pn4 -pS -ftb -fh! -oschnoz_f2 -Oschnoz -Zl
-g -gB4 -al16 -aw16 -m! -p -pn4 -pS -ftb -fh! -oschnoz_f2 -Oschnoz -Zl

Binary file not shown.

View File

@ -1,31 +1,95 @@
#include <tonc.h>
#include "gbfs.h"
OBJ_ATTR obj_buffer[128];
OBJ_AFFINE *obj_aff_buffer= (OBJ_AFFINE*)obj_buffer;
typedef struct {
OBJ_ATTR *obj;
u32 tid, pb;
int x, y, x_prev, y_prev;
} sprite_reg;
int main (void)
{
// Find the beginning of the GBFS 'sector'
const GBFS_FILE *gbfs_start = find_first_gbfs_file(find_first_gbfs_file);
// LZ77 decompress needed GBFS files to VRAM
LZ77UnCompVram((u32*) gbfs_get_obj(gbfs_start, "hub.pal.bin", NULL), &pal_bg_mem[0]);
LZ77UnCompVram((u32*) gbfs_get_obj(gbfs_start, "hub.img.bin", NULL), &tile_mem[0][0]);
LZ77UnCompVram((u32*) gbfs_get_obj(gbfs_start, "hub.map.bin", NULL), &se_mem[30][0]);
vid_vsync();
LZ77UnCompVram((u32*) gbfs_get_obj(gbfs_start, "schnoz.pal.bin", NULL), pal_obj_mem);
LZ77UnCompVram((u32*) gbfs_get_obj(gbfs_start, "schnoz_f1.img.bin", NULL), &tile_mem[4][0]);
LZ77UnCompVram((u32*) gbfs_get_obj(gbfs_start, "schnoz_f2.img.bin", NULL), &tile_mem[4][8]);
REG_BG0CNT= BG_CBB(0) | BG_SBB(30) | BG_4BPP | BG_REG_64x32;
REG_DISPCNT = DCNT_BG0;
oam_init(obj_buffer, 128);
sprite_reg player = {&obj_buffer[0], 0, 0, 5, 80};
obj_set_attr(
player.obj,
ATTR0_TALL,
ATTR1_SIZE_32 | ATTR1_HFLIP,
ATTR2_PALBANK(player.pb) | player.tid
);
obj_set_pos(player.obj, player.x, player.y);
int x = 0, y = 0;
oam_copy(oam_mem, obj_buffer, 1);
BG_POINT bg1_pos = {0, 96};
// Use background 1 to leave background 0 free for sprites to move behind
REG_BG1CNT= BG_CBB(0) | BG_SBB(30) | BG_4BPP | BG_REG_64x32;
REG_DISPCNT = DCNT_BG1 | DCNT_OBJ | DCNT_OBJ_1D;
u32 fcounter = 0;
while (1) {
vid_vsync();
key_poll();
++fcounter;
x += key_tri_horz();
y += key_tri_vert();
x = clamp(x, 0, 512-SCREEN_WIDTH);
y = clamp(y, 0, 256-SCREEN_HEIGHT);
player.x_prev = player.x;
player.y_prev = player.y;
player.x += key_tri_horz();
player.y += key_tri_vert();
REG_BG0HOFS = x;
REG_BG0VOFS = y;
if ((key_tri_horz() || key_tri_vert()) && !(fcounter % 16)) {
player.tid ^= 8;
} else if (!(key_tri_horz() || key_tri_vert())) {
player.tid = 0;
}
if (key_tri_horz() > 0) {
player.obj->attr1 |= ATTR1_HFLIP;
} else if (key_tri_horz() < 0) {
player.obj->attr1 &= ~ATTR1_HFLIP;
}
if ((player.x >= 3*(SCREEN_WIDTH/4)-15) && (bg1_pos.x < 512-SCREEN_WIDTH)) {
++bg1_pos.x;
player.x = clamp(player.x, 0, 3*(SCREEN_WIDTH/4)-15);
} else if ((player.x <= (SCREEN_WIDTH/4)-15) && (bg1_pos.x > 0)) {
--bg1_pos.x;
player.x = clamp(player.x, (SCREEN_WIDTH/4)-15, SCREEN_WIDTH-15);
}
if ((player.y >= 3*(SCREEN_HEIGHT/4)-31) && (bg1_pos.y < 256-SCREEN_HEIGHT)) {
++bg1_pos.y;
player.y = clamp(player.y, 0, 3*(SCREEN_HEIGHT/4)-31);
} else if ((player.y <= (SCREEN_HEIGHT/4)-31) && (bg1_pos.y > 0)) {
--bg1_pos.y;
player.y = clamp(player.y, (SCREEN_HEIGHT/4)-31, SCREEN_HEIGHT-31);
}
player.x = clamp(player.x, 0, SCREEN_WIDTH-15);
player.y = clamp(player.y, -9, SCREEN_HEIGHT-31);
obj_set_pos(player.obj, player.x, player.y);
player.obj->attr2 = ATTR2_BUILD(player.tid, player.pb, 0);
oam_copy(oam_mem, obj_buffer, 1);
REG_BG1HOFS = bg1_pos.x;
REG_BG1VOFS = bg1_pos.y;
}
}