Rework connected tile rendering
Might drop FPS to about 50 in certain special circumstances on o3DS
This commit is contained in:
parent
d93e3753f0
commit
ccdb63fb1e
12 changed files with 210 additions and 433 deletions
BIN
data/icons2.png
BIN
data/icons2.png
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 15 KiB |
|
@ -1468,11 +1468,9 @@ void reloadColors() {
|
||||||
dirtColor[3] = SWAP_UINT32(sf2d_get_pixel(icons, 16, 3));
|
dirtColor[3] = SWAP_UINT32(sf2d_get_pixel(icons, 16, 3));
|
||||||
dirtColor[4] = SWAP_UINT32(sf2d_get_pixel(icons, 16, 4));
|
dirtColor[4] = SWAP_UINT32(sf2d_get_pixel(icons, 16, 4));
|
||||||
|
|
||||||
grassColor[0] = SWAP_UINT32(sf2d_get_pixel(icons, 17, 0));
|
grassColor = SWAP_UINT32(sf2d_get_pixel(icons, 17, 0));
|
||||||
grassColor[1] = SWAP_UINT32(sf2d_get_pixel(icons, 17, 1));
|
|
||||||
|
|
||||||
sandColor[0] = SWAP_UINT32(sf2d_get_pixel(icons, 18, 0));
|
sandColor = SWAP_UINT32(sf2d_get_pixel(icons, 18, 0));
|
||||||
sandColor[1] = SWAP_UINT32(sf2d_get_pixel(icons, 18, 1));
|
|
||||||
|
|
||||||
waterColor[0] = SWAP_UINT32(sf2d_get_pixel(icons, 19, 0));
|
waterColor[0] = SWAP_UINT32(sf2d_get_pixel(icons, 19, 0));
|
||||||
waterColor[1] = SWAP_UINT32(sf2d_get_pixel(icons, 19, 1));
|
waterColor[1] = SWAP_UINT32(sf2d_get_pixel(icons, 19, 1));
|
||||||
|
@ -1485,6 +1483,5 @@ void reloadColors() {
|
||||||
rockColor[2] = SWAP_UINT32(sf2d_get_pixel(icons, 21, 2));
|
rockColor[2] = SWAP_UINT32(sf2d_get_pixel(icons, 21, 2));
|
||||||
rockColor[3] = SWAP_UINT32(sf2d_get_pixel(icons, 21, 3));
|
rockColor[3] = SWAP_UINT32(sf2d_get_pixel(icons, 21, 3));
|
||||||
|
|
||||||
woodColor[0] = SWAP_UINT32(sf2d_get_pixel(icons, 22, 0));
|
woodColor = SWAP_UINT32(sf2d_get_pixel(icons, 22, 0));
|
||||||
woodColor[1] = SWAP_UINT32(sf2d_get_pixel(icons, 22, 1));
|
|
||||||
}
|
}
|
|
@ -74,17 +74,14 @@ sf2d_texture *bottombg;
|
||||||
sf2d_texture * minimap[5];
|
sf2d_texture * minimap[5];
|
||||||
u8 map[5][128*128];
|
u8 map[5][128*128];
|
||||||
u8 data[5][128*128];
|
u8 data[5][128*128];
|
||||||
u8 treeTable[256];
|
|
||||||
u16 rockTable[256];
|
|
||||||
u16 grassTable[16];
|
|
||||||
|
|
||||||
u32 dirtColor[5];
|
u32 dirtColor[5];
|
||||||
u32 grassColor[2];
|
u32 grassColor;
|
||||||
u32 sandColor[2];
|
u32 sandColor;
|
||||||
u32 waterColor[2];
|
u32 waterColor[2];
|
||||||
u32 lavaColor[2];
|
u32 lavaColor[2];
|
||||||
u32 rockColor[4];
|
u32 rockColor[4];
|
||||||
u32 woodColor[2];
|
u32 woodColor;
|
||||||
|
|
||||||
char currentFileName[256];
|
char currentFileName[256];
|
||||||
extern u8 currentMenu;
|
extern u8 currentMenu;
|
||||||
|
|
|
@ -879,16 +879,17 @@ void renderMenu(int menu,int xscr,int yscr){
|
||||||
drawTextColor("Touch the keypad below",(320-22*12)/2,12,0xFF33FFFF);
|
drawTextColor("Touch the keypad below",(320-22*12)/2,12,0xFF33FFFF);
|
||||||
|
|
||||||
sf2d_draw_rectangle(0, 50, 320, 110, 0xFF7F7FBF);
|
sf2d_draw_rectangle(0, 50, 320, 110, 0xFF7F7FBF);
|
||||||
|
|
||||||
|
if(touchDelay > 0){
|
||||||
|
sf2d_draw_rectangle(touchX, touchY, touchW, touchH, 0xFF0000AF);
|
||||||
|
}
|
||||||
|
|
||||||
drawSizedText(guiText0,4, 60, 2);
|
drawSizedText(guiText0,4, 60, 2);
|
||||||
drawSizedText(guiText1,4, 80, 2);
|
drawSizedText(guiText1,4, 80, 2);
|
||||||
drawSizedText(guiText2,12, 100, 2);
|
drawSizedText(guiText2,12, 100, 2);
|
||||||
drawSizedText(guiText3,28, 120, 2);
|
drawSizedText(guiText3,28, 120, 2);
|
||||||
drawSizedText(guiText4,12, 140, 2);
|
drawSizedText(guiText4,12, 140, 2);
|
||||||
|
|
||||||
if(touchDelay > 0){
|
|
||||||
sf2d_draw_rectangle(touchX, touchY, touchW, touchH, 0xAF);
|
|
||||||
}
|
|
||||||
|
|
||||||
drawText("Press to confirm", (320-18*12)/2, 180);
|
drawText("Press to confirm", (320-18*12)/2, 180);
|
||||||
renderButtonIcon(k_accept.input & -k_accept.input, 122, 178, 1);
|
renderButtonIcon(k_accept.input & -k_accept.input, 122, 178, 1);
|
||||||
drawText("Press to return", 58, 210);
|
drawText("Press to return", 58, 210);
|
||||||
|
@ -1031,7 +1032,7 @@ void renderMenu(int menu,int xscr,int yscr){
|
||||||
if(!rev){ opacity+=5; if(opacity == 255) rev = true; }
|
if(!rev){ opacity+=5; if(opacity == 255) rev = true; }
|
||||||
else { opacity-=5; if(opacity == 100) rev = false; }
|
else { opacity-=5; if(opacity == 100) rev = false; }
|
||||||
sprintf(scoreText,"Score: %d", player.p.score);
|
sprintf(scoreText,"Score: %d", player.p.score);
|
||||||
drawTextColor("You Win!",158,76,0x0000AFAF + opacity);
|
drawTextColor("You Win!",158,76,0x0000AFAF + (opacity << 24));
|
||||||
drawText(scoreText, 200-((strlen(scoreText)-1)*6), 100);
|
drawText(scoreText, 200-((strlen(scoreText)-1)*6), 100);
|
||||||
drawText("Press to continue", 96, 150);
|
drawText("Press to continue", 96, 150);
|
||||||
renderButtonIcon(k_attack.input & -k_attack.input, 166, 148, 1);
|
renderButtonIcon(k_attack.input & -k_attack.input, 166, 148, 1);
|
||||||
|
@ -1052,7 +1053,7 @@ void renderMenu(int menu,int xscr,int yscr){
|
||||||
if(!rev){ opacity+=5; if(opacity == 255) rev = true; }
|
if(!rev){ opacity+=5; if(opacity == 255) rev = true; }
|
||||||
else { opacity-=5; if(opacity == 100) rev = false; }
|
else { opacity-=5; if(opacity == 100) rev = false; }
|
||||||
sprintf(scoreText,"Score: %d", player.p.score);
|
sprintf(scoreText,"Score: %d", player.p.score);
|
||||||
drawTextColor("You DIED!",158,76,0x000000AF + opacity);
|
drawTextColor("You DIED!",158,76,0x000000AF + (opacity << 24));
|
||||||
drawText(scoreText, 200-((strlen(scoreText)-1)*6), 100);
|
drawText(scoreText, 200-((strlen(scoreText)-1)*6), 100);
|
||||||
drawText("Press to continue", 96, 150);
|
drawText("Press to continue", 96, 150);
|
||||||
renderButtonIcon(k_attack.input & -k_attack.input, 166, 148, 1);
|
renderButtonIcon(k_attack.input & -k_attack.input, 166, 148, 1);
|
||||||
|
@ -1240,10 +1241,7 @@ void renderMenu(int menu,int xscr,int yscr){
|
||||||
render16(startX,startY+12,0,128,0);//Player(Carrying)
|
render16(startX,startY+12,0,128,0);//Player(Carrying)
|
||||||
render16(startX,startY,128,128,0);//Workbench
|
render16(startX,startY,128,128,0);//Workbench
|
||||||
startX = 120;startY = 20;
|
startX = 120;startY = 20;
|
||||||
render16b(startX,startY,16,96,0,waterColor[0]);// water pit
|
menuRenderTilePit(startX,startY,176,16,waterColor[0]);// water pit
|
||||||
render16b(startX+16,startY,32,96,0,waterColor[0]);
|
|
||||||
render16b(startX,startY+16,48,96,0,waterColor[0]);
|
|
||||||
render16b(startX+16,startY+16,64,96,0,waterColor[0]);
|
|
||||||
renderc (startX+8,startY+12,48,160,16,8,0);//Waves
|
renderc (startX+8,startY+12,48,160,16,8,0);//Waves
|
||||||
renderc (startX+8,startY+8,0,112,16,8,0);//Player (Top-Half)
|
renderc (startX+8,startY+8,0,112,16,8,0);//Player (Top-Half)
|
||||||
startX = 110;startY = 76;
|
startX = 110;startY = 76;
|
||||||
|
@ -1257,10 +1255,7 @@ void renderMenu(int menu,int xscr,int yscr){
|
||||||
renderc (startX+14,startY,32,160,8,16,0);//Slash
|
renderc (startX+14,startY,32,160,8,16,0);//Slash
|
||||||
render (startX+12,startY+4,104,144,1);//Sword
|
render (startX+12,startY+4,104,144,1);//Sword
|
||||||
startX = 64;startY = 40;
|
startX = 64;startY = 40;
|
||||||
render16b(startX,startY,16,80,0,grassColor[0]);// grass pit
|
menuRenderTilePit(startX,startY,112,16,grassColor);// grass pit
|
||||||
render16b(startX+16,startY,32,80,0,grassColor[0]);
|
|
||||||
render16b(startX,startY+16,48,80,0,grassColor[0]);
|
|
||||||
render16b(startX+16,startY+16,64,80,0,grassColor[0]);
|
|
||||||
render16 (startX+8,startY+4,0,16,0);//Tree
|
render16 (startX+8,startY+4,0,16,0);//Tree
|
||||||
render (startX+1,startY+14,80,152,0);// Apple
|
render (startX+1,startY+14,80,152,0);// Apple
|
||||||
render16 (startX+9,startY+18,16,112,0);//Player
|
render16 (startX+9,startY+18,16,112,0);//Player
|
||||||
|
@ -1315,3 +1310,22 @@ void renderMenu(int menu,int xscr,int yscr){
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void menuRenderTilePit(int x,int y,int xt,int yt,u32 color) {
|
||||||
|
render16b(x+8,y+8,xt+48,yt,0,color);
|
||||||
|
|
||||||
|
renderb(x, y, xt, yt, 0,color);
|
||||||
|
renderb(x+24,y, xt+8, yt, 0,color);
|
||||||
|
renderb(x, y+24,xt, yt+8,0,color);
|
||||||
|
renderb(x+24,y+24,xt+8, yt+8,0,color);
|
||||||
|
|
||||||
|
renderb(x+8, y, xt+16,yt, 0,color);
|
||||||
|
renderb(x+16,y, xt+24,yt, 0,color);
|
||||||
|
renderb(x+8, y+24,xt+16,yt+8,0,color);
|
||||||
|
renderb(x+16,y+24,xt+24,yt+8,0,color);
|
||||||
|
|
||||||
|
renderb(x, y+8, xt+32,yt, 0,color);
|
||||||
|
renderb(x, y+16,xt+32,yt, 0,color);
|
||||||
|
renderb(x+24,y+8, xt+40,yt, 0,color);
|
||||||
|
renderb(x+24,y+16,xt+40,yt, 0,color);
|
||||||
|
}
|
||||||
|
|
|
@ -5,3 +5,5 @@
|
||||||
|
|
||||||
void renderMenu(int menu,int xscr,int yscr);
|
void renderMenu(int menu,int xscr,int yscr);
|
||||||
void tickMenu(int menu);
|
void tickMenu(int menu);
|
||||||
|
|
||||||
|
void menuRenderTilePit(int x,int y,int xt,int yt,u32 color);
|
||||||
|
|
|
@ -114,20 +114,14 @@ void renderTutorialPage(bool topScreen){
|
||||||
renderButtonIcon(k_attack.input & -k_attack.input, 80, 56, 2);
|
renderButtonIcon(k_attack.input & -k_attack.input, 80, 56, 2);
|
||||||
renderc(60,68,16,160,16,8,2);//Slash
|
renderc(60,68,16,160,16,8,2);//Slash
|
||||||
|
|
||||||
render16b(12,20,16,80,0,grassColor[0]);// grass pit
|
menuRenderTilePit(12,20,112,16,grassColor);// grass pit
|
||||||
render16b(12+16,20,32,80,0,grassColor[0]);
|
|
||||||
render16b(12,20+16,48,80,0,grassColor[0]);
|
|
||||||
render16b(12+16,20+16,64,80,0,grassColor[0]);
|
|
||||||
render16(12+8,20+4,0,16,0);//Tree
|
render16(12+8,20+4,0,16,0);//Tree
|
||||||
renderc(12+9,20+14,16,160,16,8,0);//Slash
|
renderc(12+9,20+14,16,160,16,8,0);//Slash
|
||||||
render(12+9+4,20+14,192,144,0);//Axe
|
render(12+9+4,20+14,192,144,0);//Axe
|
||||||
render16(12+9,20+18,16,112,0);//Player-up
|
render16(12+9,20+18,16,112,0);//Player-up
|
||||||
|
|
||||||
render16b(122,62,16,80,0,sandColor[0]);// sand pit
|
menuRenderTilePit(122,62,112,16,sandColor);// sand pit
|
||||||
render16b(122+16,62,32,80,0,sandColor[0]);
|
render16b(130,70,176,16,0,0xFF383838);// hole
|
||||||
render16b(122,62+16,48,80,0,sandColor[0]);
|
|
||||||
render16b(122+16,62+16,64,80,0,sandColor[0]);
|
|
||||||
render16b(130,70,0,96,0,0xFF383838);// hole
|
|
||||||
render16(116,70,48,112,0);//Player-right
|
render16(116,70,48,112,0);//Player-right
|
||||||
renderb(136,76,16,152,0,0xFF8197AF);// Dirt item
|
renderb(136,76,16,152,0,0xFF8197AF);// Dirt item
|
||||||
renderc(128,70,40,160,8,16,0);//Slash
|
renderc(128,70,40,160,8,16,0);//Slash
|
||||||
|
@ -147,7 +141,7 @@ void renderTutorialPage(bool topScreen){
|
||||||
renderButtonIcon(biasedCirclePad(k_down.input), 44, 125, 1);
|
renderButtonIcon(biasedCirclePad(k_down.input), 44, 125, 1);
|
||||||
break;
|
break;
|
||||||
case 3: // Furniture
|
case 3: // Furniture
|
||||||
sf2d_draw_rectangle(64, 48, 192, 32, grassColor[0]);
|
sf2d_draw_rectangle(64, 48, 192, 32, grassColor);
|
||||||
renderc(32,24,64,128,96,16,0);//Furniture entities
|
renderc(32,24,64,128,96,16,0);//Furniture entities
|
||||||
|
|
||||||
renderFurniture(ITEM_WORKBENCH, 50,60);
|
renderFurniture(ITEM_WORKBENCH, 50,60);
|
||||||
|
@ -186,14 +180,14 @@ void renderTutorialPage(bool topScreen){
|
||||||
render(76,48,40,152,0); // Seeds
|
render(76,48,40,152,0); // Seeds
|
||||||
|
|
||||||
sf2d_draw_rectangle(216, 80, 32, 32, dirtColor[1]); // Dirt color for grass
|
sf2d_draw_rectangle(216, 80, 32, 32, dirtColor[1]); // Dirt color for grass
|
||||||
render16b(108, 40, 0, 80, 0, grassColor[0]); // Grass
|
render16b(108, 40, 112, 16, 0, grassColor); // Grass
|
||||||
render16(124, 40,144,0,0); // Farm Tile
|
render16(124, 40,144,0,0); // Farm Tile
|
||||||
render16(108,54,16,112,0); // Player (Up)
|
render16(108,54,16,112,0); // Player (Up)
|
||||||
renderc(108,50,16,160,16,8,0); // Slash (Up)
|
renderc(108,50,16,160,16,8,0); // Slash (Up)
|
||||||
render(112,48,72,144,0); // Gem Hoe
|
render(112,48,72,144,0); // Gem Hoe
|
||||||
|
|
||||||
sf2d_draw_rectangle(112, 156, 32, 32, dirtColor[1]); // Dirt color for grass
|
sf2d_draw_rectangle(112, 156, 32, 32, dirtColor[1]); // Dirt color for grass
|
||||||
render16b(56, 78, 0, 80, 0, grassColor[0]); // Grass
|
render16b(56, 78, 112, 16, 0, grassColor); // Grass
|
||||||
sf2d_draw_rectangle(80, 156, 32, 32, dirtColor[1]); // Dirt color
|
sf2d_draw_rectangle(80, 156, 32, 32, dirtColor[1]); // Dirt color
|
||||||
render16b(40, 78, 0, 0, 0, 0xFF8F8FA8); // Dirt Dots
|
render16b(40, 78, 0, 0, 0, 0xFF8F8FA8); // Dirt Dots
|
||||||
render(44, 82, 40,152,0); // Seeds
|
render(44, 82, 40,152,0); // Seeds
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "Render.h"
|
#include "Render.h"
|
||||||
|
#include "Menu.h"
|
||||||
|
|
||||||
extern u8 pageNum;
|
extern u8 pageNum;
|
||||||
extern u8 maxPageNum;
|
extern u8 maxPageNum;
|
||||||
|
|
515
source/Render.c
515
source/Render.c
|
@ -256,142 +256,6 @@ void renderFrame(int x1, int y1, int x2, int y2, u32 bgColor) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderDotsWithColor(int val, int x, int y, u8 bits, u32 color) {
|
|
||||||
switch (val) {
|
|
||||||
case 3:
|
|
||||||
renderb(x, y, 0, 0, bits, color);
|
|
||||||
return;
|
|
||||||
case 5:
|
|
||||||
renderb(x + 8, y, 8, 0, bits, color);
|
|
||||||
return;
|
|
||||||
case 7:
|
|
||||||
renderbc(x, y, 0, 0, 16, 8, bits, color);
|
|
||||||
return;
|
|
||||||
case 10:
|
|
||||||
renderb(x, y + 8, 0, 8, bits, color);
|
|
||||||
return;
|
|
||||||
case 11:
|
|
||||||
renderbc(x, y, 0, 0, 8, 16, bits, color);
|
|
||||||
return;
|
|
||||||
case 12:
|
|
||||||
renderb(x + 8, y + 8, 8, 8, bits, color);
|
|
||||||
return;
|
|
||||||
case 13:
|
|
||||||
renderbc(x + 8, y, 8, 0, 8, 16, bits, color);
|
|
||||||
return;
|
|
||||||
case 14:
|
|
||||||
renderbc(x, y + 8, 0, 8, 16, 8, bits, color);
|
|
||||||
return;
|
|
||||||
case 15:
|
|
||||||
render16b(x, y, 0, 0, bits, color);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void renderRockDotsWithColor(int val, int x, int y, u32 color) {
|
|
||||||
switch (val) {
|
|
||||||
case 208:
|
|
||||||
render16b(x, y, 0, 0, 0, color);
|
|
||||||
return;
|
|
||||||
case 16:
|
|
||||||
renderb(x + 8, y + 8, 8, 8, 0, color);
|
|
||||||
return;
|
|
||||||
case 32:
|
|
||||||
renderb(x, y + 8, 0, 8, 0, color);
|
|
||||||
return;
|
|
||||||
case 48:
|
|
||||||
renderb(x, y + 8, 0, 8, 0, color);
|
|
||||||
return;
|
|
||||||
case 64:
|
|
||||||
renderb(x, y, 0, 0, 0, color);
|
|
||||||
return;
|
|
||||||
case 80:
|
|
||||||
renderbc(x, y, 0, 0, 8, 16, 0, color);
|
|
||||||
return;
|
|
||||||
case 96:
|
|
||||||
renderbc(x + 8, y, 8, 0, 8, 16, 0, color);
|
|
||||||
return;
|
|
||||||
case 112:
|
|
||||||
renderbc(x, y + 8, 0, 8, 16, 8, 0, color);
|
|
||||||
return;
|
|
||||||
case 128:
|
|
||||||
renderbc(x, y, 0, 0, 16, 8, 0, color);
|
|
||||||
return;
|
|
||||||
case 144:
|
|
||||||
renderb(x, y + 8, 0, 8, 0, color);
|
|
||||||
renderbc(x + 8, y, 8, 0, 8, 16, 0, color);
|
|
||||||
return;
|
|
||||||
case 160:
|
|
||||||
renderb(x, y, 0, 0, 0, color);
|
|
||||||
renderbc(x + 8, y, 8, 0, 8, 16, 0, color);
|
|
||||||
return;
|
|
||||||
case 176:
|
|
||||||
renderb(x + 8, y, 8, 0, 0, color);
|
|
||||||
renderbc(x, y, 0, 0, 8, 16, 0, color);
|
|
||||||
return;
|
|
||||||
case 192:
|
|
||||||
renderb(x + 8, y + 8, 8, 8, 0, color);
|
|
||||||
renderbc(x, y, 0, 0, 8, 16, 0, color);
|
|
||||||
return;
|
|
||||||
case 4112:
|
|
||||||
renderbc(x, y, 0, 0, 8, 16, 0, color);
|
|
||||||
return;
|
|
||||||
case 4128:
|
|
||||||
renderbc(x, y + 8, 0, 8, 8, 16, 0, color);
|
|
||||||
return;
|
|
||||||
case 4192:
|
|
||||||
renderb(x, y, 0, 0, 0, color);
|
|
||||||
return;
|
|
||||||
case 8192:
|
|
||||||
renderb(x, y + 8, 0, 8, 0, color);
|
|
||||||
return;
|
|
||||||
case 8208:
|
|
||||||
renderb(x + 8, y + 8, 8, 8, 0, color);
|
|
||||||
return;
|
|
||||||
case 8224:
|
|
||||||
renderb(x + 8, y + 8, 8, 8, 0, color);
|
|
||||||
return;
|
|
||||||
case 8240:
|
|
||||||
renderb(x + 8, y, 8, 0, 0, color);
|
|
||||||
return;
|
|
||||||
case 8256:
|
|
||||||
renderb(x, y + 8, 0, 8, 0, color);
|
|
||||||
return;
|
|
||||||
case 8272:
|
|
||||||
renderb(x + 8, y, 8, 0, 0, color);
|
|
||||||
return;
|
|
||||||
case 8288:
|
|
||||||
renderb(x, y, 0, 0, 0, color);
|
|
||||||
return;
|
|
||||||
case 8304:
|
|
||||||
renderb(x + 8, y, 8, 0, 0, color);
|
|
||||||
renderb(x, y + 8, 0, 8, 0, color);
|
|
||||||
return;
|
|
||||||
case 8320:
|
|
||||||
renderbc(x + 8, y, 8, 0, 8, 16, 0, color);
|
|
||||||
return;
|
|
||||||
case 8336:
|
|
||||||
renderbc(x, y, 0, 0, 8, 16, 0, color);
|
|
||||||
return;
|
|
||||||
case 8352:
|
|
||||||
renderb(x, y, 0, 0, 0, color);
|
|
||||||
renderb(x + 8, y + 8, 8, 8, 0, color);
|
|
||||||
return;
|
|
||||||
case 8368:
|
|
||||||
renderb(x + 8, y, 8, 0, 0, color);
|
|
||||||
return;
|
|
||||||
case 8384:
|
|
||||||
renderb(x, y + 8, 0, 8, 0, color);
|
|
||||||
return;
|
|
||||||
case 8400:
|
|
||||||
renderb(x, y, 0, 0, 0, color);
|
|
||||||
return;
|
|
||||||
case 8416:
|
|
||||||
renderb(x + 8, y + 8, 8, 8, 0, color);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void bakeLights() {
|
void bakeLights() {
|
||||||
playerLightBake = sf2d_create_texture(64, 64, TEXFMT_RGBA8, SF2D_PLACE_RAM);
|
playerLightBake = sf2d_create_texture(64, 64, TEXFMT_RGBA8, SF2D_PLACE_RAM);
|
||||||
lanternLightBake = sf2d_create_texture(128, 128, TEXFMT_RGBA8,
|
lanternLightBake = sf2d_create_texture(128, 128, TEXFMT_RGBA8,
|
||||||
|
@ -495,66 +359,94 @@ void bakeLight(sf2d_texture* texture, int x, int y, int r) {
|
||||||
sf2d_texture_tile32(texture);
|
sf2d_texture_tile32(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 checkSurrTiles8(int xt, int yt, int id) {
|
bool tu = false;
|
||||||
u8 vt = 0;
|
bool td = false;
|
||||||
if (getTile(xt, yt - 1) == id)
|
bool tl = false;
|
||||||
vt |= 1;
|
bool tr = false;
|
||||||
if (getTile(xt - 1, yt) == id)
|
|
||||||
vt |= 2;
|
bool tul = false;
|
||||||
if (getTile(xt + 1, yt) == id)
|
bool tur = false;
|
||||||
vt |= 4;
|
bool tdl = false;
|
||||||
if (getTile(xt, yt + 1) == id)
|
bool tdr = false;
|
||||||
vt |= 8;
|
|
||||||
if (getTile(xt - 1, yt - 1) == id)
|
void renderDotsWithColor(int x, int y, u8 bits1, u8 bits2, u8 bits3, u8 bits4, u32 color) {
|
||||||
vt |= 16;
|
if(tu && tl) renderb(x, y, 0, 0, bits1, color);
|
||||||
if (getTile(xt + 1, yt - 1) == id)
|
if(tu && tr) renderb(x + 8, y, 8, 0, bits2, color);
|
||||||
vt |= 32;
|
if(td && tl) renderb(x, y + 8, 0, 8, bits3, color);
|
||||||
if (getTile(xt - 1, yt + 1) == id)
|
if(td && tr) renderb(x + 8, y + 8, 8, 8, bits4, color);
|
||||||
vt |= 64;
|
}
|
||||||
if (getTile(xt + 1, yt + 1) == id)
|
|
||||||
vt |= 128;
|
void resetSurrTiles() {
|
||||||
return vt;
|
tu = false;
|
||||||
}
|
td = false;
|
||||||
u8 checkSurrTiles4(int xt, int yt, int id) {
|
tl = false;
|
||||||
u8 vt = 0;
|
tr = false;
|
||||||
if (getTile(xt, yt - 1) == id)
|
|
||||||
vt |= 1;
|
tul = false;
|
||||||
if (getTile(xt - 1, yt) == id)
|
tur = false;
|
||||||
vt |= 2;
|
tdl = false;
|
||||||
if (getTile(xt + 1, yt) == id)
|
tdr = false;
|
||||||
vt |= 4;
|
}
|
||||||
if (getTile(xt, yt + 1) == id)
|
|
||||||
vt |= 8;
|
void checkSurrTiles8(int xt, int yt, int id) {
|
||||||
return vt;
|
if (getTile(xt, yt - 1) == id)
|
||||||
|
tu = true;
|
||||||
|
if (getTile(xt - 1, yt) == id)
|
||||||
|
tl = true;
|
||||||
|
if (getTile(xt + 1, yt) == id)
|
||||||
|
tr = true;
|
||||||
|
if (getTile(xt, yt + 1) == id)
|
||||||
|
td = true;
|
||||||
|
if (getTile(xt - 1, yt - 1) == id)
|
||||||
|
tul = true;
|
||||||
|
if (getTile(xt + 1, yt - 1) == id)
|
||||||
|
tur = true;
|
||||||
|
if (getTile(xt - 1, yt + 1) == id)
|
||||||
|
tdl = true;
|
||||||
|
if (getTile(xt + 1, yt + 1) == id)
|
||||||
|
tdr = true;
|
||||||
|
}
|
||||||
|
void checkSurrTiles4(int xt, int yt, int id) {
|
||||||
|
if (getTile(xt, yt - 1) == id)
|
||||||
|
tu = true;
|
||||||
|
if (getTile(xt - 1, yt) == id)
|
||||||
|
tl = true;
|
||||||
|
if (getTile(xt + 1, yt) == id)
|
||||||
|
tr = true;
|
||||||
|
if (getTile(xt, yt + 1) == id)
|
||||||
|
td = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 v = 0;
|
|
||||||
u8 tData = 0;
|
u8 tData = 0;
|
||||||
void renderTile(int i, int x, int y) {
|
void renderTile(int i, int x, int y) {
|
||||||
int age = 0;
|
int age = 0;
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case TILE_GRASS:
|
case TILE_GRASS:
|
||||||
v = checkSurrTiles4(x >> 4, y >> 4, TILE_GRASS)
|
checkSurrTiles4(x >> 4, y >> 4, TILE_GRASS);
|
||||||
| checkSurrTiles4(x >> 4, y >> 4, TILE_TREE)
|
checkSurrTiles4(x >> 4, y >> 4, TILE_TREE);
|
||||||
| checkSurrTiles4(x >> 4, y >> 4, TILE_FLOWER)
|
checkSurrTiles4(x >> 4, y >> 4, TILE_FLOWER);
|
||||||
| checkSurrTiles4(x >> 4, y >> 4, TILE_SAPLING_TREE);
|
checkSurrTiles4(x >> 4, y >> 4, TILE_SAPLING_TREE);
|
||||||
render16b(x, y, grassTable[v], 80, 0, grassColor[0]);
|
|
||||||
renderDotsWithColor(v, x, y, 0, grassColor[1]);
|
renderConnectedTile4(x, y, 112, 16, grassColor);
|
||||||
break;
|
break;
|
||||||
case TILE_TREE:
|
case TILE_TREE:
|
||||||
renderTile(TILE_GRASS, x, y);
|
renderTile(TILE_GRASS, x, y);
|
||||||
render16(x, y, treeTable[checkSurrTiles8(x >> 4, y >> 4, TILE_TREE)],
|
|
||||||
16, 0);
|
checkSurrTiles8(x >> 4, y >> 4, TILE_TREE);
|
||||||
|
|
||||||
|
render(x, y, 0+((tu && tl && tul) ? 16 : 0), 16, 0);
|
||||||
|
render(x+8, y, 8+((tu && tr && tur) ? 16 : 0), 16, 0);
|
||||||
|
render(x, y+8, 0+((td && tl && tdl) ? 16 : 0), 24, 0);
|
||||||
|
render(x+8, y+8, 8+((td && tr && tdr) ? 16 : 0), 24, 0);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case TILE_ROCK:
|
case TILE_ROCK:
|
||||||
v = checkSurrTiles8(x >> 4, y >> 4, TILE_ROCK);
|
checkSurrTiles8(x >> 4, y >> 4, TILE_ROCK);
|
||||||
render16s(x, y, rockTable[v] + 8192, 0, rockColor[0]);
|
renderConnectedTile8(x, y, 32, 16, rockColor[0]);
|
||||||
renderRockDotsWithColor(rockTable[v], x, y, rockColor[1]);
|
|
||||||
break;
|
break;
|
||||||
case TILE_HARDROCK:
|
case TILE_HARDROCK:
|
||||||
v = checkSurrTiles8(x >> 4, y >> 4, TILE_HARDROCK);
|
checkSurrTiles8(x >> 4, y >> 4, TILE_HARDROCK);
|
||||||
render16s(x, y, rockTable[v] + 8192, 0, rockColor[2]);
|
renderConnectedTile8(x, y, 32, 16, rockColor[2]);
|
||||||
renderRockDotsWithColor(rockTable[v], x, y, rockColor[3]);
|
|
||||||
break;
|
break;
|
||||||
case TILE_DIRT: // render dots.
|
case TILE_DIRT: // render dots.
|
||||||
if (currentLevel > 1)
|
if (currentLevel > 1)
|
||||||
|
@ -563,32 +455,36 @@ void renderTile(int i, int x, int y) {
|
||||||
render16b(x, y, 0, 0, 0, 0xFF8F8FA8);
|
render16b(x, y, 0, 0, 0, 0xFF8F8FA8);
|
||||||
break;
|
break;
|
||||||
case TILE_SAND:
|
case TILE_SAND:
|
||||||
v = checkSurrTiles4(x >> 4, y >> 4, TILE_SAND)
|
checkSurrTiles4(x >> 4, y >> 4, TILE_SAND);
|
||||||
| checkSurrTiles4(x >> 4, y >> 4, TILE_CACTUS)
|
checkSurrTiles4(x >> 4, y >> 4, TILE_CACTUS);
|
||||||
| checkSurrTiles4(x >> 4, y >> 4, TILE_SAPLING_CACTUS);
|
checkSurrTiles4(x >> 4, y >> 4, TILE_SAPLING_CACTUS);
|
||||||
render16b(x, y, grassTable[v], 80, 0, sandColor[0]);
|
|
||||||
renderDotsWithColor(v, x, y, 0, sandColor[1]);
|
renderConnectedTile4(x, y, 112, 16, sandColor);
|
||||||
break;
|
break;
|
||||||
case TILE_WATER:
|
case TILE_WATER:
|
||||||
v = checkSurrTiles4(x >> 4, y >> 4, TILE_WATER)
|
checkSurrTiles4(x >> 4, y >> 4, TILE_WATER);
|
||||||
| checkSurrTiles4(x >> 4, y >> 4, TILE_HOLE);
|
checkSurrTiles4(x >> 4, y >> 4, TILE_HOLE);
|
||||||
render16b(x, y, grassTable[v], 96, 0, waterColor[0]);
|
|
||||||
|
renderConnectedTile4(x, y, 176, 16, waterColor[0]);
|
||||||
|
|
||||||
srand((tickCount + (x / 2 - y) * 4311) / 10);
|
srand((tickCount + (x / 2 - y) * 4311) / 10);
|
||||||
renderDotsWithColor(v, x, y, rand() & 3, waterColor[1]);
|
renderDotsWithColor(x, y, rand() & 3, rand() & 3, rand() & 3, rand() & 3, waterColor[1]);
|
||||||
break;
|
break;
|
||||||
case TILE_LAVA:
|
case TILE_LAVA:
|
||||||
v = checkSurrTiles4(x >> 4, y >> 4, TILE_LAVA)
|
checkSurrTiles4(x >> 4, y >> 4, TILE_LAVA);
|
||||||
| checkSurrTiles4(x >> 4, y >> 4, TILE_HOLE);
|
checkSurrTiles4(x >> 4, y >> 4, TILE_HOLE);
|
||||||
render16b(x, y, grassTable[v], 96, 0, lavaColor[0]);
|
|
||||||
|
renderConnectedTile4(x, y, 176, 16, lavaColor[0]);
|
||||||
|
|
||||||
srand((tickCount + (x / 2 - y) * 4311) / 10);
|
srand((tickCount + (x / 2 - y) * 4311) / 10);
|
||||||
renderDotsWithColor(v, x, y, rand() & 3, lavaColor[1]);
|
renderDotsWithColor(x, y, rand() & 3, rand() & 3, rand() & 3, rand() & 3, lavaColor[1]);
|
||||||
break;
|
break;
|
||||||
case TILE_HOLE:
|
case TILE_HOLE:
|
||||||
render16b(x, y,
|
checkSurrTiles4(x >> 4, y >> 4, TILE_HOLE);
|
||||||
grassTable[checkSurrTiles4(x >> 4, y >> 4, TILE_HOLE)
|
checkSurrTiles4(x >> 4, y >> 4, TILE_WATER);
|
||||||
| checkSurrTiles4(x >> 4, y >> 4, TILE_WATER)
|
checkSurrTiles4(x >> 4, y >> 4, TILE_LAVA);
|
||||||
| checkSurrTiles4(x >> 4, y >> 4, TILE_LAVA)], 96, 0,
|
|
||||||
0xFF383838);
|
renderConnectedTile4(x, y, 176, 16, 0xFF383838);
|
||||||
break;
|
break;
|
||||||
case TILE_CACTUS:
|
case TILE_CACTUS:
|
||||||
renderTile(TILE_SAND, x, y);
|
renderTile(TILE_SAND, x, y);
|
||||||
|
@ -616,11 +512,11 @@ void renderTile(int i, int x, int y) {
|
||||||
render16b(x, y, 80, 0, 0, 0xFFDE98DF);
|
render16b(x, y, 80, 0, 0, 0xFFDE98DF);
|
||||||
break;
|
break;
|
||||||
case TILE_CLOUD:
|
case TILE_CLOUD:
|
||||||
render16b(x, y,
|
checkSurrTiles4(x >> 4, y >> 4, TILE_CLOUD);
|
||||||
grassTable[checkSurrTiles4(x >> 4, y >> 4, TILE_CLOUD)
|
checkSurrTiles4(x >> 4, y >> 4, TILE_STAIRS_DOWN);
|
||||||
| checkSurrTiles4(x >> 4, y >> 4, TILE_STAIRS_DOWN)
|
checkSurrTiles4(x >> 4, y >> 4, TILE_CLOUDCACTUS);
|
||||||
| checkSurrTiles4(x >> 4, y >> 4, TILE_CLOUDCACTUS)],
|
|
||||||
80, 0, 0xFFFFFFFF);
|
renderConnectedTile4(x, y, 64, 32, 0xFFFFFFFF);
|
||||||
break;
|
break;
|
||||||
case TILE_CLOUDCACTUS:
|
case TILE_CLOUDCACTUS:
|
||||||
renderTile(TILE_CLOUD, x, y);
|
renderTile(TILE_CLOUD, x, y);
|
||||||
|
@ -644,10 +540,49 @@ void renderTile(int i, int x, int y) {
|
||||||
render16(x, y, 160 + (age << 4), 0, 0);
|
render16(x, y, 160 + (age << 4), 0, 0);
|
||||||
break;
|
break;
|
||||||
case TILE_WOOD_WALL:
|
case TILE_WOOD_WALL:
|
||||||
render16b(x, y, grassTable[checkSurrTiles4(x >> 4, y >> 4, TILE_WOOD_WALL)], 176, 0, woodColor[0]);
|
checkSurrTiles4(x >> 4, y >> 4, TILE_WOOD_WALL);
|
||||||
|
|
||||||
|
renderConnectedTile4(x, y, 0, 32, woodColor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetSurrTiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
void renderConnectedTile4(int x, int y, u32 xTile, u32 yTile, u32 color) {
|
||||||
|
//render complete tile in one piece to reduce strain(added for o3DS)
|
||||||
|
if (tl && tr && tu && td) {
|
||||||
|
render16b(x, y, xTile+48, yTile, 0, color);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int l = (tl ? 16 : 0);
|
||||||
|
int r = (tr ? 16 : 0);
|
||||||
|
int u = (tu ? 32 : 0);
|
||||||
|
int d = (td ? 32 : 0);
|
||||||
|
|
||||||
|
renderb(x, y, xTile +l+u, yTile, 0, color);
|
||||||
|
renderb(x+8, y, xTile+8+r+u, yTile, 0, color);
|
||||||
|
renderb(x, y+8, xTile +l+d, yTile+8, 0, color);
|
||||||
|
renderb(x+8, y+8, xTile+8+r+d, yTile+8, 0, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void renderConnectedTile8(int x, int y, u32 xTile, u32 yTile, u32 color) {
|
||||||
|
//render complete tile in one piece to reduce strain(added for o3DS)
|
||||||
|
if (tl && tr && tu && td && tul && tur && tdl && tdr) {
|
||||||
|
render16b(x, y, xTile+64, yTile, 0, color);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int l = (tl ? 16 : 0);
|
||||||
|
int r = (tr ? 16 : 0);
|
||||||
|
int u = (tu ? 32 : 0);
|
||||||
|
int d = (td ? 32 : 0);
|
||||||
|
|
||||||
|
renderb(x, y, xTile +l+u+((tl && tu && tul) ? 16 : 0), yTile, 0, color);
|
||||||
|
renderb(x+8, y, xTile+8+r+u+((tr && tu && tur) ? 16 : 0), yTile, 0, color);
|
||||||
|
renderb(x, y+8, xTile +l+d+((tl && td && tdl) ? 16 : 0), yTile+8, 0, color);
|
||||||
|
renderb(x+8, y+8, xTile+8+r+d+((tr && td && tdr) ? 16 : 0), yTile+8, 0, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderZoomedMap() {
|
void renderZoomedMap() {
|
||||||
|
@ -1157,7 +1092,7 @@ void renderItemIcon(int itemID, int countLevel, int x, int y) {
|
||||||
renderb(x, y, 16, 152, 0, rockColor[1]);
|
renderb(x, y, 16, 152, 0, rockColor[1]);
|
||||||
break;
|
break;
|
||||||
case ITEM_SAND:
|
case ITEM_SAND:
|
||||||
renderb(x, y, 16, 152, 0, sandColor[0]);
|
renderb(x, y, 16, 152, 0, sandColor);
|
||||||
break;
|
break;
|
||||||
case ITEM_DIRT:
|
case ITEM_DIRT:
|
||||||
renderb(x, y, 16, 152, 0, 0xFF8197AF);
|
renderb(x, y, 16, 152, 0, 0xFF8197AF);
|
||||||
|
@ -1215,169 +1150,3 @@ void renderItemIcon(int itemID, int countLevel, int x, int y) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void defineTables() {
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
for (i = 256; i > 0; --i) {
|
|
||||||
// Creates the lookup table for the tree tile.
|
|
||||||
if ((i & 255) == 255)
|
|
||||||
treeTable[i] = 208;
|
|
||||||
else if ((i & 239) == 239)
|
|
||||||
treeTable[i] = 144;
|
|
||||||
else if ((i & 191) == 191)
|
|
||||||
treeTable[i] = 160;
|
|
||||||
else if ((i & 127) == 127)
|
|
||||||
treeTable[i] = 176;
|
|
||||||
else if ((i & 223) == 223)
|
|
||||||
treeTable[i] = 192;
|
|
||||||
else if ((i & 206) == 206)
|
|
||||||
treeTable[i] = 112;
|
|
||||||
else if ((i & 55) == 55)
|
|
||||||
treeTable[i] = 128;
|
|
||||||
else if ((i & 173) == 173)
|
|
||||||
treeTable[i] = 96;
|
|
||||||
else if ((i & 91) == 91)
|
|
||||||
treeTable[i] = 80;
|
|
||||||
|
|
||||||
else if ((i & 159) == 159)
|
|
||||||
treeTable[i] = 224;
|
|
||||||
else if ((i & 111) == 111)
|
|
||||||
treeTable[i] = 240;
|
|
||||||
|
|
||||||
else if ((i & 19) == 19)
|
|
||||||
treeTable[i] = 64;
|
|
||||||
else if ((i & 37) == 37)
|
|
||||||
treeTable[i] = 48;
|
|
||||||
else if ((i & 74) == 74)
|
|
||||||
treeTable[i] = 32;
|
|
||||||
else if ((i & 140) == 140)
|
|
||||||
treeTable[i] = 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
boolean up = i & 1
|
|
||||||
boolean left = i & 2
|
|
||||||
boolean right = i & 4
|
|
||||||
boolean down = i & 8
|
|
||||||
boolean up-left = i & 16
|
|
||||||
boolean up-right = i & 32
|
|
||||||
boolean down-left = i & 64
|
|
||||||
boolean down-right = i & 128
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (i = 256; i > 0; --i) {
|
|
||||||
// Creates the lookup table for the rock tile.
|
|
||||||
if ((i & 255) == 255)
|
|
||||||
rockTable[i] = 208;
|
|
||||||
else if ((i & 239) == 239)
|
|
||||||
rockTable[i] = 144;
|
|
||||||
else if ((i & 191) == 191)
|
|
||||||
rockTable[i] = 160;
|
|
||||||
else if ((i & 127) == 127)
|
|
||||||
rockTable[i] = 176;
|
|
||||||
else if ((i & 223) == 223)
|
|
||||||
rockTable[i] = 192;
|
|
||||||
else if ((i & 207) == 207)
|
|
||||||
rockTable[i] = 256 * 16 + 32;
|
|
||||||
else if ((i & 63) == 63)
|
|
||||||
rockTable[i] = 256 * 16 + 16;
|
|
||||||
else if ((i & 206) == 206)
|
|
||||||
rockTable[i] = 112;
|
|
||||||
else if ((i & 95) == 95)
|
|
||||||
rockTable[i] = 256 * 32 + 144;
|
|
||||||
else if ((i & 159) == 159)
|
|
||||||
rockTable[i] = 256 * 32 + 160;
|
|
||||||
else if ((i & 31) == 31)
|
|
||||||
rockTable[i] = 256 * 32 + 208;
|
|
||||||
else if ((i & 55) == 55)
|
|
||||||
rockTable[i] = 128;
|
|
||||||
else if ((i & 175) == 175)
|
|
||||||
rockTable[i] = 256 * 32 + 128;
|
|
||||||
else if ((i & 143) == 143)
|
|
||||||
rockTable[i] = 256 * 32 + 224;
|
|
||||||
else if ((i & 173) == 173)
|
|
||||||
rockTable[i] = 96;
|
|
||||||
else if ((i & 111) == 111)
|
|
||||||
rockTable[i] = 256 * 32 + 112;
|
|
||||||
else if ((i & 47) == 47)
|
|
||||||
rockTable[i] = 256 * 32 + 48;
|
|
||||||
else if ((i & 45) == 45)
|
|
||||||
rockTable[i] = 256 * 32 + 176;
|
|
||||||
else if ((i & 79) == 79)
|
|
||||||
rockTable[i] = 256 * 32 + 192;
|
|
||||||
else if ((i & 23) == 23)
|
|
||||||
rockTable[i] = 256 * 32 + 96;
|
|
||||||
else if ((i & 91) == 91)
|
|
||||||
rockTable[i] = 80;
|
|
||||||
else if ((i & 27) == 27)
|
|
||||||
rockTable[i] = 256 * 16 + 96;
|
|
||||||
else if ((i & 19) == 19)
|
|
||||||
rockTable[i] = 64;
|
|
||||||
else if ((i & 75) == 75)
|
|
||||||
rockTable[i] = 256 * 32;
|
|
||||||
else if ((i & 141) == 141)
|
|
||||||
rockTable[i] = 256 * 32 + 16;
|
|
||||||
else if ((i & 142) == 142)
|
|
||||||
rockTable[i] = 256 * 32 + 32;
|
|
||||||
else if ((i & 78) == 78)
|
|
||||||
rockTable[i] = 256 * 32 + 64;
|
|
||||||
else if ((i & 39) == 39)
|
|
||||||
rockTable[i] = 256 * 32 + 80;
|
|
||||||
else if ((i & 37) == 37)
|
|
||||||
rockTable[i] = 48;
|
|
||||||
else if ((i & 74) == 74)
|
|
||||||
rockTable[i] = 32;
|
|
||||||
else if ((i & 140) == 140)
|
|
||||||
rockTable[i] = 16;
|
|
||||||
else if ((i & 15) == 15)
|
|
||||||
rockTable[i] = 256 * 16 + 112;
|
|
||||||
else if ((i & 11) == 11)
|
|
||||||
rockTable[i] = 256 * 16 + 192;
|
|
||||||
else if ((i & 13) == 13)
|
|
||||||
rockTable[i] = 256 * 16 + 208;
|
|
||||||
else if ((i & 14) == 14)
|
|
||||||
rockTable[i] = 256 * 16 + 224;
|
|
||||||
else if ((i & 7) == 7)
|
|
||||||
rockTable[i] = 256 * 16 + 240;
|
|
||||||
else if ((i & 12) == 12)
|
|
||||||
rockTable[i] = 256 * 16 + 128;
|
|
||||||
else if ((i & 10) == 10)
|
|
||||||
rockTable[i] = 256 * 16 + 144;
|
|
||||||
else if ((i & 5) == 5)
|
|
||||||
rockTable[i] = 256 * 16 + 160;
|
|
||||||
else if ((i & 3) == 3)
|
|
||||||
rockTable[i] = 256 * 16 + 176;
|
|
||||||
else if ((i & 9) == 9)
|
|
||||||
rockTable[i] = 256 * 16;
|
|
||||||
else if ((i & 6) == 6)
|
|
||||||
rockTable[i] = 256 * 16 + 48;
|
|
||||||
else if ((i & 8) == 8)
|
|
||||||
rockTable[i] = 224;
|
|
||||||
else if ((i & 4) == 4)
|
|
||||||
rockTable[i] = 256 * 16 + 64;
|
|
||||||
else if ((i & 2) == 2)
|
|
||||||
rockTable[i] = 256 * 16 + 80;
|
|
||||||
else if ((i & 1) == 1)
|
|
||||||
rockTable[i] = 240;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lookup table for the grass/sand tile.
|
|
||||||
grassTable[1] = 192;
|
|
||||||
grassTable[2] = 160;
|
|
||||||
grassTable[3] = 64;
|
|
||||||
grassTable[4] = 144;
|
|
||||||
grassTable[5] = 48;
|
|
||||||
grassTable[6] = 224;
|
|
||||||
grassTable[7] = 128;
|
|
||||||
grassTable[8] = 176;
|
|
||||||
grassTable[9] = 240;
|
|
||||||
grassTable[10] = 32;
|
|
||||||
grassTable[11] = 80;
|
|
||||||
grassTable[12] = 16;
|
|
||||||
grassTable[13] = 96;
|
|
||||||
grassTable[14] = 112;
|
|
||||||
grassTable[15] = 208;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ void render16s(s32 xp, s32 yp, u32 tile, u8 bits, u32 color);
|
||||||
void renderTitle(int x, int y);
|
void renderTitle(int x, int y);
|
||||||
void renderFrame(int x1, int y1, int x2, int y2, u32 bgColor);
|
void renderFrame(int x1, int y1, int x2, int y2, u32 bgColor);
|
||||||
void renderTile(int i, int x, int y);
|
void renderTile(int i, int x, int y);
|
||||||
|
void renderConnectedTile4(int x, int y, u32 xTile, u32 yTile, u32 color);
|
||||||
|
void renderConnectedTile8(int x, int y, u32 xTile, u32 yTile, u32 color);
|
||||||
void renderBackground(int xScroll, int yScroll);
|
void renderBackground(int xScroll, int yScroll);
|
||||||
void renderMenuBackground(int xScroll, int yScroll); //Renders the darkness
|
void renderMenuBackground(int xScroll, int yScroll); //Renders the darkness
|
||||||
void renderButtonIcon(u32 icon, int x, int y, float scale);
|
void renderButtonIcon(u32 icon, int x, int y, float scale);
|
||||||
|
@ -61,5 +63,3 @@ void renderItemStuffWithText(int itemID, int itemCL, bool onlyOne, int x, int y)
|
||||||
void renderItemWithTextCentered(Item* item, int width, int y);
|
void renderItemWithTextCentered(Item* item, int width, int y);
|
||||||
void renderItemIcon(int itemID, int countLevel, int x, int y);
|
void renderItemIcon(int itemID, int countLevel, int x, int y);
|
||||||
void renderItemIcon2(int itemID, int countLevel, int x, int y, int z);
|
void renderItemIcon2(int itemID, int countLevel, int x, int y, int z);
|
||||||
|
|
||||||
void defineTables();
|
|
||||||
|
|
|
@ -38,6 +38,22 @@ void updateMusic(int lvl) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void loadSounds() {
|
||||||
|
loadSound(&snd_playerHurt, "resources/playerhurt.raw");
|
||||||
|
loadSound(&snd_playerDeath, "resources/playerdeath.raw");
|
||||||
|
loadSound(&snd_monsterHurt, "resources/monsterhurt.raw");
|
||||||
|
loadSound(&snd_test, "resources/test.raw");
|
||||||
|
loadSound(&snd_pickup, "resources/pickup.raw");
|
||||||
|
loadSound(&snd_bossdeath, "resources/bossdeath.raw");
|
||||||
|
loadSound(&snd_craft, "resources/craft.raw");
|
||||||
|
|
||||||
|
loadSound(&music_menu, "resources/music/menu.raw");
|
||||||
|
loadSound(&music_floor0, "resources/music/floor0.raw");
|
||||||
|
loadSound(&music_floor1, "resources/music/floor1.raw");
|
||||||
|
loadSound(&music_floor23, "resources/music/floor2_3.raw");
|
||||||
|
loadSound(&music_floor4, "resources/music/floor4.raw");
|
||||||
|
}
|
||||||
|
|
||||||
void freeSounds(){
|
void freeSounds(){
|
||||||
linearFree(snd_playerHurt.buffer);
|
linearFree(snd_playerHurt.buffer);
|
||||||
linearFree(snd_playerDeath.buffer);
|
linearFree(snd_playerDeath.buffer);
|
||||||
|
|
|
@ -16,6 +16,7 @@ void playSound(Sound snd);
|
||||||
void playMusic(Sound snd);
|
void playMusic(Sound snd);
|
||||||
void updateMusic(int lvl);
|
void updateMusic(int lvl);
|
||||||
|
|
||||||
|
void loadSounds();
|
||||||
void freeSounds();
|
void freeSounds();
|
||||||
|
|
||||||
Sound snd_playerHurt;
|
Sound snd_playerHurt;
|
||||||
|
|
|
@ -171,20 +171,7 @@ int main() {
|
||||||
font = sfil_load_PNG_buffer(Font_png, SF2D_PLACE_RAM);
|
font = sfil_load_PNG_buffer(Font_png, SF2D_PLACE_RAM);
|
||||||
bottombg = sfil_load_PNG_buffer(bottombg_png, SF2D_PLACE_RAM);
|
bottombg = sfil_load_PNG_buffer(bottombg_png, SF2D_PLACE_RAM);
|
||||||
|
|
||||||
loadSound(&snd_playerHurt, "resources/playerhurt.raw");
|
loadSounds();
|
||||||
loadSound(&snd_playerDeath, "resources/playerdeath.raw");
|
|
||||||
loadSound(&snd_monsterHurt, "resources/monsterhurt.raw");
|
|
||||||
loadSound(&snd_test, "resources/test.raw");
|
|
||||||
loadSound(&snd_pickup, "resources/pickup.raw");
|
|
||||||
loadSound(&snd_bossdeath, "resources/bossdeath.raw");
|
|
||||||
loadSound(&snd_craft, "resources/craft.raw");
|
|
||||||
|
|
||||||
loadSound(&music_menu, "resources/music/menu.raw");
|
|
||||||
loadSound(&music_floor0, "resources/music/floor0.raw");
|
|
||||||
loadSound(&music_floor1, "resources/music/floor1.raw");
|
|
||||||
loadSound(&music_floor23, "resources/music/floor2_3.raw");
|
|
||||||
loadSound(&music_floor4, "resources/music/floor4.raw");
|
|
||||||
|
|
||||||
playMusic(music_menu);
|
playMusic(music_menu);
|
||||||
|
|
||||||
bakeLights();
|
bakeLights();
|
||||||
|
@ -244,7 +231,6 @@ int main() {
|
||||||
|
|
||||||
tickCount = 0;
|
tickCount = 0;
|
||||||
initRecipes();
|
initRecipes();
|
||||||
defineTables();
|
|
||||||
while (aptMainLoop()) {
|
while (aptMainLoop()) {
|
||||||
++tickCount;
|
++tickCount;
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
|
|
Loading…
Add table
Reference in a new issue