fixed (sorta)
This commit is contained in:
parent
a8eb642e9b
commit
bf9f03c963
17
src/main.c
17
src/main.c
@ -163,8 +163,12 @@ if (wallBottom >= SCREEN_HEIGHT) wallBottom = SCREEN_HEIGHT - 1;
|
||||
u16 tileTop = wallTop / TILE_HEIGHT;
|
||||
u16 tileBottom = wallBottom / TILE_HEIGHT;
|
||||
u16 tileHeight = tileBottom - tileTop + 1;
|
||||
for (int yTile = tileTop; yTile <= tileBottom; yTile++) {
|
||||
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);
|
||||
}else{
|
||||
VDP_setTileMapXY(BG_B, TILE_ATTR_FULL(PAL1, 0, FALSE, FALSE, TILE_EMPTY), column, yTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,6 +208,7 @@ void mapscan() {
|
||||
void clearScreenWithTile(u16 tileIndex) {
|
||||
// Fill the entire screen with the background tile
|
||||
VDP_fillTileMapRect(BG_A, TILE_ATTR_FULL(PAL1, 0, FALSE, FALSE, tileIndex), 0, 0, SCREEN_TILES_X, SCREEN_TILES_Y);
|
||||
//VDP_fillTileMapRect(BG_B, TILE_ATTR_FULL(PAL1, 0, FALSE, FALSE, tileIndex), 0, 0, SCREEN_TILES_X, SCREEN_TILES_Y);
|
||||
}
|
||||
|
||||
void drawMap() {
|
||||
@ -220,16 +225,22 @@ void render() {
|
||||
s16 castStart = angle - 20;
|
||||
if(angle >= 360) angle = angle - 360;
|
||||
if(angle < 0) angle = 360 + angle;
|
||||
if(castStart >= 360) castStart = castStart - 360;
|
||||
if(castStart < 0) castStart = 360 + castStart;
|
||||
|
||||
for(int i = 0; i < 40; i++){
|
||||
castRay(castStart + i, i);
|
||||
s16 cast = castStart+i;
|
||||
if(cast >= 360) cast = cast - 360;
|
||||
if(cast < 0) cast = 360 + cast;
|
||||
castRay(cast, i);
|
||||
//VDP_waitVSync();
|
||||
}
|
||||
//drawMap();
|
||||
VDP_setTextPlane(BG_B);
|
||||
VDP_setTextPalette(2);
|
||||
VDP_showFPS(1);
|
||||
char debugCastText[20];
|
||||
sprintf(debugCastText, "Cast: %d", castStart);
|
||||
sprintf(debugCastText, "Cast: %03d", castStart);
|
||||
VDP_drawText(debugCastText, 20, 2);
|
||||
angle = angle + 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user