did stuff
This commit is contained in:
parent
63c919d17d
commit
c99987bce4
13
src/main.c
13
src/main.c
@ -13,6 +13,7 @@
|
||||
#define SCREEN_TILES_Y 28
|
||||
#define TILE_EMPTY 0
|
||||
#define TILE_FILLED 1
|
||||
#define TILE_GREEN 4
|
||||
#define MAP_WIDTH 10
|
||||
#define MAP_HEIGHT 10
|
||||
#define WALL_HEIGHT_SCALE FIX16(1)
|
||||
@ -141,11 +142,13 @@ void castRay(s16 angle, s16 column){
|
||||
dof += 1;
|
||||
}
|
||||
}
|
||||
u8 tile = TILE_FILLED;
|
||||
fix16 shortestDist = distH;
|
||||
if(distV < distH){
|
||||
shortestDist = distV;
|
||||
l.pt2.x = fix16ToInt(vx);
|
||||
l.pt2.y = fix16ToInt(vy);
|
||||
tile = TILE_GREEN;
|
||||
}else {
|
||||
l.pt2.x = fix16ToInt(hx);
|
||||
l.pt2.y = fix16ToInt(hy);
|
||||
@ -154,7 +157,7 @@ void castRay(s16 angle, s16 column){
|
||||
|
||||
//Wall height calcs
|
||||
shortestDist = fix16Sqrt(shortestDist);
|
||||
shortestDist = fix16Mul(dx, shortestDist);
|
||||
//shortestDist = fix16Mul(dx, shortestDist);
|
||||
if(shortestDist < 0){
|
||||
shortestDist = -shortestDist;
|
||||
}
|
||||
@ -170,9 +173,9 @@ void castRay(s16 angle, s16 column){
|
||||
u16 tileHeight = tileBottom - tileTop + 1;
|
||||
for (int yTile = 0; yTile <= SCREEN_TILES_Y; yTile++) {
|
||||
if(yTile >= tileTop && yTile <= tileBottom){
|
||||
VDP_setTileMapXY(BG_B, TILE_ATTR_FULL(PAL1, 0, FALSE, FALSE, TILE_FILLED), column, yTile);
|
||||
VDP_setTileMapXY(BG_B, TILE_ATTR_FULL(PAL0, 0, FALSE, FALSE, tile), column, yTile);
|
||||
}else{
|
||||
VDP_setTileMapXY(BG_B, TILE_ATTR_FULL(PAL1, 0, FALSE, FALSE, TILE_EMPTY), column, yTile);
|
||||
VDP_setTileMapXY(BG_B, TILE_ATTR_FULL(PAL0, 0, FALSE, FALSE, TILE_EMPTY), column, yTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -289,6 +292,7 @@ int main() {
|
||||
SYS_disableInts();
|
||||
VDP_setPlaneSize(64, 32, TRUE);
|
||||
SYS_enableInts();
|
||||
PAL_setColor(13, RGB24_TO_VDPCOLOR(0x00ff00));
|
||||
PAL_setColor(14, RGB24_TO_VDPCOLOR(0x1c1c14));
|
||||
PAL_setColor(15, RGB24_TO_VDPCOLOR(0x17ffe8));
|
||||
VDP_setBackgroundColor(14);
|
||||
@ -296,6 +300,9 @@ int main() {
|
||||
// Initialize and upload tile data for TILE_EMPTY and TILE_FILLED
|
||||
initTileBuffer(15); // Color for TILE_FILLED
|
||||
VDP_loadTileData(tileBuffer, TILE_FILLED, 1, DMA);
|
||||
|
||||
initTileBuffer(13); // Color for TILE_FILLED
|
||||
VDP_loadTileData(tileBuffer, TILE_GREEN, 1, DMA);
|
||||
|
||||
initTileBuffer(0); // Color for TILE_EMPTY
|
||||
VDP_loadTileData(tileBuffer, TILE_EMPTY, 1, DMA);
|
||||
|
Loading…
Reference in New Issue
Block a user