ssrc = $(wildcard src/*.s) $(wildcard src/gba/*.s) data/lut.s
obj = $(src:.c=.arm.o) $(ssrc:.s=.arm.o)
dep = $(src:.c=.arm.d)
-name = gbajam22
+name = voxelburg
elf = $(name).elf
bin = $(name).gba
data = data/color.raw data/color.pal data/height.raw \
- data/spr_game.raw data/spr_game.pal
+ data/spr_game.raw data/spr_game.pal data/menuscr.555
libs = libs/maxmod/libmm.a
%.pal: %.png tools/pngdump/pngdump
tools/pngdump/pngdump -o $@ -c $<
+%.555: %.png tools/pngdump/pngdump
+ tools/pngdump/pngdump -o $@ -555 $<
+
data/lut.s: tools/lutgen
tools/lutgen >$@
SPRID_HUSK = SPRID(112, 64)
};
+/* main game data */
extern unsigned char color_pixels[];
extern unsigned char color_cmap[];
extern unsigned char height_pixels[];
extern unsigned char spr_game_pixels[];
extern unsigned char spr_game_cmap[];
+/* menu screen assets */
+extern unsigned char menuscr_pixels[];
+
#endif /* DATA_H_ */
.globl height_pixels
.globl spr_game_pixels
.globl spr_game_cmap
+ .globl menuscr_pixels
.align 1
color_pixels:
.align 1
spr_game_cmap:
.incbin "data/spr_game.pal"
+
+ .align 1
+menuscr_pixels:
+ .incbin "data/menuscr.555"
mask(INTR_VBLANK);
- if(scr->start && scr->start() == -1) {
- return -1;
- }
if(curscr && curscr->stop) {
curscr->stop();
}
+ if(scr->start && scr->start() == -1) {
+ return -1;
+ }
curscr = scr;
unmask(INTR_VBLANK);
static int xform_s;
static short vblcount;
+static void *prev_iwram_top;
static inline void xform_pixel(int *xp, int *yp);
uint8_t *cptr;
struct enemy *enemy;
+ prev_iwram_top = iwram_sbrk(0);
+
gba_setmode(4, DISPCNT_BG2 | DISPCNT_OBJ | DISPCNT_FB1);
vblperf_setcolor(0);
static void gamescr_stop(void)
{
+ iwram_brk(prev_iwram_top);
}
static void gamescr_frame(void)
update_keyb();
- if(KEYPRESS(BN_SELECT)) {
- vox_quality ^= 1;
+ if(KEYPRESS(BN_START)) {
+ /* TODO pause menu */
+ change_screen(find_screen("menu"));
}
if(keystate) {
REG_BG2PC = -sa;
REG_BG2PD = ca;
- keystate = ~REG_KEYINPUT;
-
if((keystate & (BN_LEFT | BN_RIGHT)) == 0) {
if(bank) {
bank -= bankdir << 4;
#include "debug.h"
#include "game.h"
#include "maxmod.h"
+#include "input.h"
static void vblank(void);
panic(get_pc(), "failed to initialize screens");
}
- if(change_screen(find_screen("game")) == -1) {
+ if(change_screen(find_screen("menu")) == -1) {
panic(get_pc(), "failed to find game screen");
}
{
vblperf_count++;
+ keyb_vblank();
curscr->vblank();
#ifndef NOSOUND
BN_LT = 0x0200
};
+#ifdef BUILD_GBA
+#define keyb_vblank() (keystate = ~REG_KEYINPUT)
+#endif
+
#define KEYPRESS(key) ((keystate & (key)) && (keydelta & (key)))
#define KEYRELEASE(key) ((keystate & (key)) == 0 && (keydelta & (key)))
#include "game.h"
+#include "data.h"
+#include "gba.h"
+#include "util.h"
+#include "dma.h"
+#include "input.h"
+#include "debug.h"
static int menuscr_start(void);
static void menuscr_stop(void);
static void menuscr_frame(void);
+static void menuscr_vblank(void);
static struct screen menuscr = {
"menu",
menuscr_start,
menuscr_stop,
menuscr_frame,
- 0
+ menuscr_vblank
};
struct screen *init_menu_screen(void)
static int menuscr_start(void)
{
+ gba_setmode(3, DISPCNT_BG2);
+ dma_copy16(3, gba_vram_lfb0, menuscr_pixels, 240 * 160, 0);
return 0;
}
static void menuscr_frame(void)
{
+ update_keyb();
+
+ if(KEYPRESS(BN_START)) {
+ change_screen(find_screen("game"));
+ }
+}
+
+static void menuscr_vblank(void)
+{
}
#define present(x) \
do { \
- REG_DISPCNT = DISPCNT_BG2 | DISPCNT_OBJ | 4 | ((x) << 4); \
+ REG_DISPCNT = (REG_DISPCNT & ~DISPCNT_FB1) | ((x) << 4); \
} while(0)
#define ARM_IWRAM __attribute__((noinline, target("arm"), section(".iwram")))
static struct vox_object *vox_obj;
static int vox_num_obj, vox_obj_stride;
-int vox_quality = 1;
int *projlut;
int vox_init(int xsz, int ysz, uint8_t *himg, uint8_t *cimg)
vox_begin();
- if(vox_quality) {
- for(i=0; i<vox_nslices; i++) {
- vox_render_slice(i);
- }
- } else {
- for(i=0; i<vox_nslices; i++) {
- if(i >= 10 && (i & 1) == 0) {
- continue;
- }
- vox_render_slice(i);
- }
+ for(i=0; i<vox_nslices; i++) {
+ vox_render_slice(i);
}
}
int32_t scale;
};
-extern int vox_quality;
-
int vox_init(int xsz, int ysz, uint8_t *himg, uint8_t *cimg);
void vox_destroy(void);