clean up
This commit is contained in:
parent
06648c2dc1
commit
06e8e735fb
12 changed files with 17 additions and 31 deletions
BIN
res/alice.png
BIN
res/alice.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.4 KiB |
BIN
res/clouds.png
BIN
res/clouds.png
Binary file not shown.
|
Before Width: | Height: | Size: 70 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 KiB |
BIN
res/fadetop.png
BIN
res/fadetop.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB |
BIN
res/human.png
BIN
res/human.png
Binary file not shown.
|
Before Width: | Height: | Size: 4.5 KiB |
|
|
@ -5,10 +5,6 @@ IMAGE logo "logo.png" NONE NONE
|
||||||
|
|
||||||
IMAGE sky "sky.png" NONE NONE
|
IMAGE sky "sky.png" NONE NONE
|
||||||
IMAGE ground "ground.png" NONE NONE
|
IMAGE ground "ground.png" NONE NONE
|
||||||
// IMAGE clouds "clouds.png" NONE NONE
|
|
||||||
|
|
||||||
IMAGE fadeTop "fadetop.png" NONE NONE
|
|
||||||
IMAGE fadeBottom "fadebottom.png" NONE NONE
|
|
||||||
|
|
||||||
// SPRITE sakuyaSprite "sakuya.png" 4 4 NONE 0
|
// SPRITE sakuyaSprite "sakuya.png" 4 4 NONE 0
|
||||||
SPRITE sakuyaSprite "sakuya2.png" 6 6 NONE 0
|
SPRITE sakuyaSprite "sakuya2.png" 6 6 NONE 0
|
||||||
|
|
@ -16,11 +12,8 @@ SPRITE sakuyaSprite "sakuya2.png" 6 6 NONE 0
|
||||||
SPRITE bulletsSprite "bullets.png" 2 2 NONE 0
|
SPRITE bulletsSprite "bullets.png" 2 2 NONE 0
|
||||||
SPRITE pBulletSprite "pbullet.png" 4 4 NONE 0
|
SPRITE pBulletSprite "pbullet.png" 4 4 NONE 0
|
||||||
|
|
||||||
SPRITE butterflySprite "butterfly.png" 4 4 NONE 8
|
|
||||||
// SPRITE fairySprite "fairy.png" 4 4 NONE 8
|
// SPRITE fairySprite "fairy.png" 4 4 NONE 8
|
||||||
SPRITE fairySprite "fairy2.png" 4 4 NONE 8
|
SPRITE fairySprite "fairy2.png" 4 4 NONE 8
|
||||||
SPRITE aliceSprite "alice.png" 6 6 NONE 0
|
|
||||||
SPRITE humanSprite "human.png" 2 2 NONE 0
|
|
||||||
SPRITE koaSprite "koakuma.png" 4 4 NONE 0
|
SPRITE koaSprite "koakuma.png" 4 4 NONE 0
|
||||||
|
|
||||||
// IMAGE mapPlayer "mapplayer.png" NONE NONE
|
// IMAGE mapPlayer "mapplayer.png" NONE NONE
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@ void loadBackground(){
|
||||||
VDP_setVerticalScroll(BG_B, 32);
|
VDP_setVerticalScroll(BG_B, 32);
|
||||||
VDP_loadTileSet(sky.tileset, BG_I, DMA);
|
VDP_loadTileSet(sky.tileset, BG_I, DMA);
|
||||||
VDP_loadTileSet(ground.tileset, BG_I + 64, DMA);
|
VDP_loadTileSet(ground.tileset, BG_I + 64, DMA);
|
||||||
VDP_loadTileSet(fadeBottom.tileset, BG_I + 64 + 64, DMA);
|
|
||||||
VDP_loadTileSet(fadeTop.tileset, BG_I + 64 + 64 + 4, DMA);
|
|
||||||
for(u8 y = 0; y < 4; y++){
|
for(u8 y = 0; y < 4; y++){
|
||||||
for(u8 x = 0; x < 16; x++){
|
for(u8 x = 0; x < 16; x++){
|
||||||
VDP_fillTileMapRectInc(BG_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, BG_I + (y > 2 ? 64 : 0)), x * 8, y * 8, 8, 8);
|
VDP_fillTileMapRectInc(BG_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, BG_I + (y > 2 ? 64 : 0)), x * 8, y * 8, 8, 8);
|
||||||
|
|
@ -40,12 +38,6 @@ void loadBackground(){
|
||||||
for(u8 i = 0; i < 8; i++)
|
for(u8 i = 0; i < 8; i++)
|
||||||
bgScroll[27 - i] = (initScroll - fix32ToInt(parallaxAccum[i]));
|
bgScroll[27 - i] = (initScroll - fix32ToInt(parallaxAccum[i]));
|
||||||
VDP_setHorizontalScrollTile(BG_B, 0, bgScroll, 28, DMA);
|
VDP_setHorizontalScrollTile(BG_B, 0, bgScroll, 28, DMA);
|
||||||
|
|
||||||
// fade
|
|
||||||
// for(u8 x = 0; x < 20; x++)
|
|
||||||
// VDP_fillTileMapRectInc(BG_A, TILE_ATTR_FULL(PAL1, 0, 0, 0, BG_I + 64 + 64), x * 2, 26, 2, 2);
|
|
||||||
// for(u8 x = 0; x < 10; x++)
|
|
||||||
// VDP_fillTileMapRectInc(BG_A, TILE_ATTR_FULL(PAL1, 0, 0, 0, BG_I + 64 + 64 + 4), x * 4, 22, 4, 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateBackground(){
|
void updateBackground(){
|
||||||
|
|
|
||||||
|
|
@ -68,13 +68,13 @@ void spawnBullet(struct bulletSpawner spawner, void(*updater)){
|
||||||
s16 i = -1;
|
s16 i = -1;
|
||||||
for(s16 j = 0; j < BULLET_COUNT; j++) if(!bullets[j].active) { i = j; break; }
|
for(s16 j = 0; j < BULLET_COUNT; j++) if(!bullets[j].active) { i = j; break; }
|
||||||
if(i == -1 && spawner.player){
|
if(i == -1 && spawner.player){
|
||||||
|
|
||||||
for(s16 j = 0; j < BULLET_COUNT; j++) if(bullets[j].active && !bullets[j].player){
|
for(s16 j = 0; j < BULLET_COUNT; j++) if(bullets[j].active && !bullets[j].player){
|
||||||
killBullet(j, FALSE);
|
killBullet(j, FALSE);
|
||||||
i = j;
|
i = j;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if(i == -1 && !spawner.player) return;
|
if(i == -1) return;
|
||||||
|
|
||||||
bullets[i].active = TRUE;
|
bullets[i].active = TRUE;
|
||||||
bullets[i].pos.x = spawner.x;
|
bullets[i].pos.x = spawner.x;
|
||||||
|
|
@ -93,9 +93,6 @@ void spawnBullet(struct bulletSpawner spawner, void(*updater)){
|
||||||
bullets[i].explosion = FALSE;
|
bullets[i].explosion = FALSE;
|
||||||
bullets[i].dist = bullets[i].player ? 16 : (spawner.anim == 0 ? 4 : 7);
|
bullets[i].dist = bullets[i].player ? 16 : (spawner.anim == 0 ? 4 : 7);
|
||||||
|
|
||||||
u8 off = bullets[i].player ? P_BULLET_OFF : BULLET_OFF;
|
|
||||||
s16 sx = getScreenX(bullets[i].pos.x, player.camera);
|
|
||||||
s16 sy = fix32ToInt(bullets[i].pos.y);
|
|
||||||
bullets[i].image = SPR_addSprite(spawner.player ? &pBulletSprite : &bulletsSprite,
|
bullets[i].image = SPR_addSprite(spawner.player ? &pBulletSprite : &bulletsSprite,
|
||||||
-32, -32,
|
-32, -32,
|
||||||
TILE_ATTR(gameOver ? PAL1 : PAL0, 0, 0, spawner.player && spawner.angle == 512 ? 1 : 0));
|
TILE_ATTR(gameOver ? PAL1 : PAL0, 0, 0, spawner.player && spawner.angle == 512 ? 1 : 0));
|
||||||
|
|
@ -105,11 +102,10 @@ void spawnBullet(struct bulletSpawner spawner, void(*updater)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(spawner.anim) SPR_setAnim(bullets[i].image, spawner.anim);
|
|
||||||
bullets[i].anim = spawner.anim;
|
bullets[i].anim = spawner.anim;
|
||||||
bullets[i].frame = spawner.frame;
|
bullets[i].frame = spawner.frame;
|
||||||
SPR_setFrame(bullets[i].image, spawner.frame);
|
|
||||||
SPR_setAnim(bullets[i].image, spawner.anim);
|
SPR_setAnim(bullets[i].image, spawner.anim);
|
||||||
|
SPR_setFrame(bullets[i].image, spawner.frame);
|
||||||
SPR_setDepth(bullets[i].image, spawner.player ? 7 : (spawner.top ? 3 : 4));
|
SPR_setDepth(bullets[i].image, spawner.player ? 7 : (spawner.top ? 3 : 4));
|
||||||
doBulletRotation(i);
|
doBulletRotation(i);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,8 @@ void updateEnemyOne(u8 i){
|
||||||
}
|
}
|
||||||
|
|
||||||
// normal shooting
|
// normal shooting
|
||||||
if(enemies[i].clock % 20 == enemies[i].ints[0] && enemies[i].onScreen){
|
if((s16)(enemies[i].clock % 20) == enemies[i].ints[0] && enemies[i].onScreen){
|
||||||
enemies[i].clock % 40 == enemies[i].ints[0] ? sfxEnemyShotB() : sfxEnemyShotA();
|
(s16)(enemies[i].clock % 40) == enemies[i].ints[0] ? sfxEnemyShotB() : sfxEnemyShotA();
|
||||||
struct bulletSpawner spawner = {
|
struct bulletSpawner spawner = {
|
||||||
.x = enemies[i].pos.x,
|
.x = enemies[i].pos.x,
|
||||||
.y = enemies[i].pos.y,
|
.y = enemies[i].pos.y,
|
||||||
|
|
|
||||||
13
src/global.h
13
src/global.h
|
|
@ -1,3 +1,13 @@
|
||||||
|
// forward declarations (defined in sfx.h, chrome.h, main.c)
|
||||||
|
void sfxPlayerShot();
|
||||||
|
void sfxEnemyShotA();
|
||||||
|
void sfxEnemyShotB();
|
||||||
|
void sfxEnemyShotC();
|
||||||
|
void sfxExplosion();
|
||||||
|
void sfxPickup();
|
||||||
|
void loadMap();
|
||||||
|
void loadGame();
|
||||||
|
|
||||||
u32 clock;
|
u32 clock;
|
||||||
#define CLOCK_LIMIT 32000
|
#define CLOCK_LIMIT 32000
|
||||||
#define PROP_COUNT 8
|
#define PROP_COUNT 8
|
||||||
|
|
@ -23,7 +33,6 @@ u32 score;
|
||||||
#define MAP_W 38
|
#define MAP_W 38
|
||||||
#define MAP_H 3
|
#define MAP_H 3
|
||||||
|
|
||||||
char debugStr[8];
|
|
||||||
void EMPTY(s16 i){(void)i;}
|
void EMPTY(s16 i){(void)i;}
|
||||||
|
|
||||||
bool started;
|
bool started;
|
||||||
|
|
@ -62,7 +71,7 @@ struct playerStruct {
|
||||||
Vect2D_f32 pos, vel;
|
Vect2D_f32 pos, vel;
|
||||||
s16 shotAngle;
|
s16 shotAngle;
|
||||||
u8 lives, recoveringClock;
|
u8 lives, recoveringClock;
|
||||||
fix32 camera, yCamera;
|
fix32 camera;
|
||||||
Sprite* image;
|
Sprite* image;
|
||||||
};
|
};
|
||||||
struct playerStruct player;
|
struct playerStruct player;
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,6 @@ static void boundsPlayer(){
|
||||||
player.camera += GAME_WRAP;
|
player.camera += GAME_WRAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.yCamera = (fix32ToInt(player.pos.y) - FIX16(112)) >> 2;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cameraPlayer(){
|
static void cameraPlayer(){
|
||||||
|
|
@ -126,7 +124,6 @@ void loadPlayer(){
|
||||||
fix32ToInt(player.pos.x) - PLAYER_OFF,
|
fix32ToInt(player.pos.x) - PLAYER_OFF,
|
||||||
fix32ToInt(player.pos.y) - PLAYER_OFF,
|
fix32ToInt(player.pos.y) - PLAYER_OFF,
|
||||||
TILE_ATTR(PAL0, 0, 0, 0));
|
TILE_ATTR(PAL0, 0, 0, 0));
|
||||||
player.yCamera = (fix32ToInt(player.pos.y) - FIX16(112)) >> 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updatePlayer(){
|
void updatePlayer(){
|
||||||
|
|
@ -150,6 +147,5 @@ void updatePlayer(){
|
||||||
s16 sx = getScreenX(player.pos.x, player.camera);
|
s16 sx = getScreenX(player.pos.x, player.camera);
|
||||||
s16 sy = fix32ToInt(player.pos.y);
|
s16 sy = fix32ToInt(player.pos.y);
|
||||||
SPR_setPosition(player.image, sx - PLAYER_OFF, sy - PLAYER_OFF);
|
SPR_setPosition(player.image, sx - PLAYER_OFF, sy - PLAYER_OFF);
|
||||||
intToStr(fix32ToInt(player.pos.x), debugStr, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue