From a95f6f043e19ee0a71a94bf67cdf19b12f204583 Mon Sep 17 00:00:00 2001 From: Trevor Boddy Date: Tue, 16 Aug 2022 17:38:58 -0400 Subject: [PATCH] some background/foreground work --- res/{bg/ceil1.png => chrome/frame.png} | Bin 4629 -> 4139 bytes res/{bg/floor1.png => fg/rock1.png} | Bin 4655 -> 4640 bytes res/fg/rock1t.png | Bin 0 -> 4863 bytes res/font.png | Bin 3678 -> 3665 bytes res/resources.res | 8 ++-- src/background.h | 31 ++++++---------- src/chrome.h | 10 +++++ src/foreground.h | 49 +++++++++++++++++++++++++ src/main.c | 10 +++-- src/player.h | 2 +- 10 files changed, 84 insertions(+), 26 deletions(-) rename res/{bg/ceil1.png => chrome/frame.png} (70%) rename res/{bg/floor1.png => fg/rock1.png} (70%) create mode 100644 res/fg/rock1t.png create mode 100644 src/foreground.h diff --git a/res/bg/ceil1.png b/res/chrome/frame.png similarity index 70% rename from res/bg/ceil1.png rename to res/chrome/frame.png index cefbd205d0373ab94acb79c18e674ee9eff0aa90..25fb5740c3b8612fc58f87ac79df343386b7657a 100644 GIT binary patch delta 342 zcmbQLvRXm0Gr-TCmrII^fq{Y7)59eQNOOQN2Q!fTe9>>`M#X1bOe~)^b8@FJaTuCg z85vs{T23zIRYh7uuu<_D7ZcmO&79mROdJM= zR)(flMy8WXc~wCiBV#L5!^w+yl@Xk?ycYF_W(G+X7N&-}#%akWx+W<=A~DIpR5v-r zGR?ry%+fH$(nv|6BDcWT*UBY7ximL5uf)^ERw*$hKPlBJB|kYc#i}49za+mnBfr4P zJUPwGAk8>QH`OFDMb|XNBvm&lDcM}tBE`_e(kRiy&@d5hntxGddgkOZK5>;KLrX)G zWCKgx)FjhHT@%C9B;BOM)I?oVBhxff3llRV6Qk708~O5FiBYJeP+a0#R$^72k(y_# zWMp7uq-$WIYiJe%50DgoCyAnzG^?CUsM5sblFWRd;^M@z$&CDRt`IsX=YrGb9F7{PK}I#@S;zQUJf7-3eZq0If2QIN cZ&68cn;Z?#U%EvNfC6P5#UmN|f4cekp`6 zdig7qiE!~`peCpvd-?4qcL<10&J~QTzjBA+2m=G7y{C&~h(+((O9%7r81S%MIKGr= zJ=d1M|KIau9Y0ZYwfU)U6Pqvp)6Q!=?ar4zw(N6cpY6`$^rxcwm0f4r{xc<)pE}j>V^c=)oTh7) zb?JhFpLhG1Zks))WzDqEPlmUz-Q0CHcb>AcT==y+TViMS-*h|@7`;-hYVlvs8M@3? zw*yjAU9DGceqQ)AFg?~pUh>3e)$?NY-EBJZ(?8qEbsPO}_ZN|?yH_LU6&YW3qTZnL eC)0oamiq;1HPwrnmzV)l9D}E;pUXO@geCwB68g*l delta 568 zcmZ3WvR-9^IF|(nGXn#|YDF%Cjf&5>nAmo1=HyOc;xI6@GBmX^GM!w?s|w;68CjWH zPM*)JjNlySwWv2qN=Z($OiI!?$S<(+baoCX%1_J8Nwrlf z4sv%=@N{)HGqf}_(>2mFoP3xsj3`5G_@xlx6vtnoVv%HSmSkdVp=)4ikfLjnXql*M znP`}%n`o4loMdQXXlRsXKG~LE5~|DCVsae6-Q+L_MS5zS;JYgn4q6A_> zerBhkFgGwFeLY44$rj JF6*2UngA!6rm6q{ diff --git a/res/fg/rock1t.png b/res/fg/rock1t.png new file mode 100644 index 0000000000000000000000000000000000000000..f9039fa6f67730733a4a31cd74e653db751fdda7 GIT binary patch literal 4863 zcmb_e2{@E%`+t!olBGx#)1b7BS&U(ZQO4LpIq0NPnU%pTW-&w2sFbDcWQnLGyUG?R zOC=oHN{CdpN;pz>B7Lv6|GECx`Og1b|L>dYdgpoG=lMOq`@Vno{XEYb;k?6EQC?FX z002dMJE9BNLKYu6De#||8d(E2OS~+dECC?@tin7=8UW-S7*r4LEL7J!Xs9`RyW zwgh#%+E_TCV~#P@-XN5ccY}mViMPeW6e1?hN&-D|qaTOC*%`?tJ&nw50Kn>4a-!FC z{)qFcx;OHG-ZCIPs_HobNL2<Q~3#!fIa~1)7Dz0B=(U2%xLF#N&x{+ z^`<3(VguJrlH0B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ghf=IGxH%Zs|%wdJ8LgCOaWQo5IAQ}Z4g*g z#bOS`CM2BmIoDZAo9)8^trmAmU+i)M%yxc1&$Bn;(t)m)R>SGM6?XqXN-0Hv^Muoy zZ}JqAT9LXO-r4EGo?sscKK$v2hvurM<^QL2fJuK}i?_WUZ(6-7+M&{Ly<+mczE@TI zzdwUoxqoN0eNe@t;!$C7=Ybn`xWCP7L&1Osy&Lv@QmP5TkYPNa;Z$m0kNe{Qj{dO= zI6UHyp-1NmpVPFGZwHEG16Xd8t*`g8^mJhDfu&N_3djK*(gq^SqQe>|t7Vg$D)CfY zpNM~bSgUmom{|@MMS$ajMLeWtf%!lV{j9f$dFyGwW!DmjJ2^Og;Q^ed!ffs!npx)l z)lSBRaTpXMiDgI!=6SIsf8ZA>{i>x1kBVzK&(k=_r32@9sdyGR8##3Q6UPh^Ao$Fp tR2FO_C<4=el@7QBpnkFGCN59-9~gv)5+e@`HYWf8002ovPDHLkV1g0eBW3^q diff --git a/res/resources.res b/res/resources.res index 37eda00..0fdb583 100644 --- a/res/resources.res +++ b/res/resources.res @@ -1,8 +1,10 @@ IMAGE font "font.png" BEST NONE +IMAGE frame "chrome/frame.png" FAST -IMAGE bgWall1 "bg/wall1.png" FAST -IMAGE bgCeil1 "bg/ceil1.png" FAST -IMAGE bgFloor1 "bg/floor1.png" FAST +IMAGE wall1 "bg/wall1.png" FAST + +IMAGE rock1 "fg/rock1.png" FAST +IMAGE rock1t "fg/rock1t.png" FAST SPRITE nitori "player/nitori.png" 4 4 FAST diff --git a/src/background.h b/src/background.h index 4a0a765..9ece06a 100644 --- a/src/background.h +++ b/src/background.h @@ -1,4 +1,4 @@ -// bg +// background #define BG_I 512 @@ -11,16 +11,7 @@ static void drawBg(){ for(u16 x = 0; x < BG_W; x++) for(u16 y = 0; y < BG_H; y++){ if(x % 8 == 0 && y % 8 == 0){ - 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); + VDP_drawImageEx(BG_A, &wall1, TILE_ATTR_FULL(PAL2, 0, 0, 0, BG_I), x, y, 0, DMA); } } } @@ -28,7 +19,6 @@ static void drawFg(){ // update - #define BG_SPEED FIX16(1) #define BG_SPEED_NORM FIX16(0.707) @@ -36,24 +26,27 @@ static void drawFg(){ #define BG_SIZE_F FIX16(BG_SIZE) +s16 bgPosX[WIN_H_T]; +fix16 bgPosXF[WIN_H_T]; Vect2D_f16 bgPos; static void scrollBg(){ - bgPos.x = fix16Sub(bgPos.x, BG_SPEED); - // bgPos.y = fix16Add(bgPos.y, BG_SPEED_NORM); - 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); + + for(u8 y = 0; y < WIN_H_T; y++){ + if(y > 3) bgPosXF[y] = fix16Sub(bgPosXF[y], BG_SPEED); + if(bgPosXF[y] <= -BG_SIZE_F) bgPosXF[y] = fix16Add(bgPosXF[y], BG_SIZE_F); + bgPosX[y] = fix16ToInt(bgPosXF[y]); + } } // loop void loadBg(){ + VDP_setScrollingMode(HSCROLL_TILE, VSCROLL_PLANE); drawBg(); - drawFg(); } void updateBg(){ - VDP_setHorizontalScroll(BG_B, fix16ToInt(bgPos.x)); - VDP_setVerticalScroll(BG_B, fix16ToInt(bgPos.y)); + VDP_setHorizontalScrollTile(BG_A, 0, bgPosX, WIN_H_T, DMA); scrollBg(); } \ No newline at end of file diff --git a/src/chrome.h b/src/chrome.h index 99c9622..5a75965 100644 --- a/src/chrome.h +++ b/src/chrome.h @@ -1,5 +1,14 @@ // chrome +#define CHROME_I 64 + +// frame + +static void loadFrame(){ + VDP_loadTileSet(frame.tileset, CHROME_I, DMA); + VDP_fillTileMapRect(BG_A, TILE_ATTR_FULL(PAL2, 1, 0, 0, CHROME_I), 0, 0, WIN_W_T, 3); +} + // score #define SCORE_X 4 @@ -52,6 +61,7 @@ static void loadHeat(){ // loop void loadChrome(){ + loadFrame(); loadScore(); loadRound(); loadHeat(); diff --git a/src/foreground.h b/src/foreground.h new file mode 100644 index 0000000..90ce7e6 --- /dev/null +++ b/src/foreground.h @@ -0,0 +1,49 @@ +// foreground + +#define FG_I 576 + + +// draw + +#define CEIL_Y 3 +#define FLOOR_Y 24 + +static void drawFg(){ + for(u16 x = 0; x < BG_W; x++){ + if(x % 4 == 0){ + VDP_drawImageEx(BG_B, &rock1t, TILE_ATTR_FULL(PAL2, 1, 0, 0, FG_I), x, CEIL_Y, 0, DMA); + VDP_drawImageEx(BG_B, &rock1, TILE_ATTR_FULL(PAL2, 1, 0, 0, FG_I + 16), x, FLOOR_Y, 0, DMA); + } + } +} + + +// update + +#define FG_SPEED FIX16(2) +#define BG_SPEED_NORM FIX16(2 * 0.707) + +#define FG_SIZE 32 + +#define FG_SIZE_F FIX16(FG_SIZE) + +Vect2D_f16 fgPos; + +static void scrollFg(){ + fgPos.x = fix16Sub(fgPos.x, FG_SPEED); + if(fgPos.x <= -FG_SIZE_F) fgPos.x = fix16Add(fgPos.x, FG_SIZE_F); + if(fgPos.y >= FG_SIZE_F) fgPos.y = fix16Sub(fgPos.y, FG_SIZE_F); +} + + +// loop + +void loadFg(){ + drawFg(); +} + +void updateFg(){ + // VDP_setHorizontalScroll(BG_B, fix16ToInt(fgPos.x)); + // VDP_setVerticalScroll(BG_B, fix16ToInt(fgPos.y)); + scrollFg(); +} \ No newline at end of file diff --git a/src/main.c b/src/main.c index f77ef09..036bf83 100644 --- a/src/main.c +++ b/src/main.c @@ -6,6 +6,7 @@ #include "global.h" #include "controls.h" #include "background.h" +#include "foreground.h" #include "player.h" #include "bullets.h" #include "chrome.h" @@ -17,14 +18,16 @@ static void loadInternals(){ JOY_setEventHandler(&updateControls); SPR_init(127, 0, 0); VDP_setScreenWidth256(); - VDP_setPalette(PAL1, font.palette -> data); - VDP_setPalette(PAL2, bgWall1.palette -> data); + VDP_setPalette(PAL1, nitori.palette -> data); + VDP_setPalette(PAL2, wall1.palette -> data); + VDP_setPalette(PAL3, font.palette -> data); VDP_loadFont(font.tileset, DMA); - VDP_setTextPalette(1); + VDP_setTextPalette(3); } static void loadGame(){ loadBg(); + loadFg(); loadPlayer(); loadChrome(); } @@ -33,6 +36,7 @@ static void updateGame(){ updatePlayer(); updateBullets(); updateBg(); + updateFg(); updateChrome(); clock++; if(clock >= CLOCK_LIMIT) clock -= CLOCK_LIMIT; diff --git a/src/player.h b/src/player.h index dffd0d6..09ac1b9 100644 --- a/src/player.h +++ b/src/player.h @@ -2,7 +2,7 @@ #define PLAYER_OFF FIX16(16) #define PLAYER_INIT_X FIX16(40) -#define PLAYER_INIT_Y FIX16(GAME_H / 2) +#define PLAYER_INIT_Y FIX16((GAME_H - 24) / 2 + 24) #define INVINCIBLE_LIMIT 60 * 4 #define SHOT_INTERVAL 15