This commit is contained in:
Samuel Walker 2024-09-01 08:33:17 -06:00
parent f8481aae42
commit 63c919d17d

View File

@ -153,6 +153,7 @@ void castRay(s16 angle, s16 column){
//Wall height calcs
shortestDist = fix16Sqrt(shortestDist);
shortestDist = fix16Mul(dx, shortestDist);
if(shortestDist < 0){
shortestDist = -shortestDist;
@ -225,6 +226,8 @@ void drawMap() {
}
void render() {
l.pt1.x = x;
l.pt1.y = y;
//clearScreenWithTile(TILE_EMPTY);
s16 castStart = angle - 20;
if(angle >= 360) angle = angle - 360;
@ -246,7 +249,7 @@ void render() {
char debugCastText[20];
sprintf(debugCastText, "Cast: %03d", castStart);
VDP_drawText(debugCastText, 20, 2);
angle = angle + 1;
//angle = angle + 1;
SYS_doVBlankProcess();
@ -255,10 +258,10 @@ void render() {
void update() {
u16 joy = JOY_readJoypad(JOY_1);
if (joy & BUTTON_LEFT) {
angle -= 1;
angle -= 2;
}
if (joy & BUTTON_RIGHT) {
angle += 1;
angle += 2;
}
if (joy & BUTTON_UP) {
s16 ind = (int)((float)angle / 360.0f * 1024.0f);
@ -299,11 +302,14 @@ int main() {
l.pt1.x = 15;
l.pt1.y = 15;
x = 15;
y = 15;
l.pt2.x = 0;
l.pt2.y = 0;
while (TRUE) {
render();
update();
}
return 0;