bg work. first round of cleanup

This commit is contained in:
t. boddy 2022-08-16 01:31:13 -04:00
parent 9eb10a68c3
commit 8015aef572
10 changed files with 32 additions and 21 deletions

View File

@ -3,7 +3,13 @@
######### #########
- 100 (overheat) - 100 (overheat)
- connect/transfer (???) - connect/transfer (big fist)
#########
# STORY #
#########
- 18.5 nitori
############ ############
@ -44,10 +50,8 @@
# ASSET NEEDS # # ASSET NEEDS #
############### ###############
- tate sprite for nitori.... - big fist sprite for tate
- think connect/transfer - 2 songs minimum needed
- bigger shot and robot sprite?
- 2 songs min needed
- start - start
- stage - stage
- extra songs ordered by priority - extra songs ordered by priority

BIN
res/bg/ceil1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
res/bg/wall1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -1,9 +1,8 @@
IMAGE font "font.png" BEST NONE IMAGE font "font.png" BEST NONE
IMAGE tile1_1 "tiles/1_1.png" FAST IMAGE bgWall1 "bg/wall1.png" FAST
IMAGE tile1_2 "tiles/1_2.png" FAST IMAGE bgCeil1 "bg/ceil1.png" FAST
IMAGE bgFloor1 "bg/floor1.png" FAST
IMAGE bg1_1 "bg/1_1.png" FAST
IMAGE frame1 "chrome/frame1.png" FAST IMAGE frame1 "chrome/frame1.png" FAST
IMAGE frame2 "chrome/frame2.png" FAST IMAGE frame2 "chrome/frame2.png" FAST

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -5,15 +5,22 @@
#define BG_W GAME_W_T + 8 #define BG_W GAME_W_T + 8
#define BG_H WIN_H_T #define BG_H WIN_H_T
#define BG_SIZE 64
// draw // draw
static void drawBg(){ static void drawBg(){
for(u16 x = 0; x < BG_W; x++) for(u16 y = 0; y < BG_H; y++){ for(u16 x = 0; x < BG_W; x++) for(u16 y = 0; y < BG_H; y++){
if(x % 8 == 0 && y % 8 == 0){ if(x % 8 == 0 && y % 8 == 0){
VDP_drawImageEx(BG_B, &bg1_1, TILE_ATTR_FULL(PAL2, 0, 0, 0, BG_I), x, y, 0, DMA); VDP_drawImageEx(BG_B, &bgWall1, TILE_ATTR_FULL(PAL2, 0, 0, 0, BG_I), x, y, 0, DMA);
}
}
}
static void drawFg(){
for(u16 x = 0; x < BG_W; x++){
if(x % 4 == 0){
VDP_drawImageEx(BG_A, &bgCeil1, TILE_ATTR_FULL(PAL2, 0, 0, 0, BG_I + 64), x, 0, 0, DMA);
VDP_drawImageEx(BG_A, &bgFloor1, TILE_ATTR_FULL(PAL2, 0, 0, 0, BG_I + 64 + 12), x, 21, 0, DMA);
} }
} }
} }
@ -25,25 +32,28 @@ static void drawBg(){
#define BG_SPEED FIX16(1) #define BG_SPEED FIX16(1)
#define BG_SPEED_NORM FIX16(0.707) #define BG_SPEED_NORM FIX16(0.707)
#define BG_SIZE 64
#define BG_SIZE_F FIX16(BG_SIZE) #define BG_SIZE_F FIX16(BG_SIZE)
Vect2D_f16 bgPos; Vect2D_f16 bgPos;
static void scrollBg(){ static void scrollBg(){
VDP_setHorizontalScroll(BG_B, fix16ToInt(bgPos.x));
VDP_setVerticalScroll(BG_B, fix16ToInt(bgPos.y));
bgPos.x = fix16Sub(bgPos.x, BG_SPEED); bgPos.x = fix16Sub(bgPos.x, BG_SPEED);
// bgPos.y = fix16Add(bgPos.y, BG_SPEED_NORM); // bgPos.y = fix16Add(bgPos.y, BG_SPEED_NORM);
if(bgPos.x <= -BG_SIZE_F) bgPos.x = fix16Add(bgPos.x, BG_SIZE_F); if(bgPos.x <= -BG_SIZE_F) bgPos.x = fix16Add(bgPos.x, BG_SIZE_F);
if(bgPos.y >= BG_SIZE_F) bgPos.y = fix16Sub(bgPos.y, BG_SIZE_F); if(bgPos.y >= BG_SIZE_F) bgPos.y = fix16Sub(bgPos.y, BG_SIZE_F);
} }
// loop // loop
void loadBg(){ void loadBg(){
drawBg(); drawBg();
drawFg();
} }
void updateBg(){ void updateBg(){
VDP_setHorizontalScroll(BG_B, fix16ToInt(bgPos.x));
VDP_setVerticalScroll(BG_B, fix16ToInt(bgPos.y));
scrollBg(); scrollBg();
} }

View File

@ -22,4 +22,5 @@
s16 clock; s16 clock;
u32 score; u32 score,
highScore;

View File

@ -6,7 +6,6 @@
#include "global.h" #include "global.h"
#include "controls.h" #include "controls.h"
#include "background.h" #include "background.h"
#include "tiles.h"
#include "player.h" #include "player.h"
#include "chrome.h" #include "chrome.h"
@ -17,21 +16,19 @@ static void loadInternals(){
JOY_setEventHandler(&updateControls); JOY_setEventHandler(&updateControls);
SPR_init(127, 0, 0); SPR_init(127, 0, 0);
VDP_setScreenWidth256(); VDP_setScreenWidth256();
VDP_setPalette(PAL1, tile1_1.palette -> data); VDP_setPalette(PAL1, font.palette -> data);
VDP_setPalette(PAL2, bg1_1.palette -> data); VDP_setPalette(PAL2, bgWall1.palette -> data);
VDP_loadFont(font.tileset, DMA); VDP_loadFont(font.tileset, DMA);
VDP_setTextPalette(1); VDP_setTextPalette(1);
} }
static void loadGame(){ static void loadGame(){
loadBg(); loadBg();
loadTiles();
loadPlayer(); loadPlayer();
loadChrome(); loadChrome();
} }
static void updateGame(){ static void updateGame(){
updateTiles();
updatePlayer(); updatePlayer();
updateBg(); updateBg();
updateChrome(); updateChrome();