From c99987bce4a946ad9a22cef8ecd170700ea2db6a Mon Sep 17 00:00:00 2001 From: Samuel Walker Date: Sun, 1 Sep 2024 09:00:05 -0600 Subject: [PATCH] did stuff --- src/main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index ac7559e..6cc78c2 100644 --- a/src/main.c +++ b/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);