Added some info to display

This commit is contained in:
Samuel Walker 2024-08-30 20:33:43 -06:00
parent 9a86ae4479
commit 86374384df

View File

@ -31,6 +31,34 @@ void castRay(s16 angle){
fix16 dx = cosFix16(ind);
fix16 tan = FIX16(0);
if(dx != 0) tan = fix16Div(dy, dx);
char str[9];
sprintf(str, "Ang: %4d", angle);
BMP_drawText(str, 20, 0);
char str2[13];
bool neg = false;
fix16 nsin = dy;
if (dy < 0){
neg = true;
nsin = 0 - nsin;
}
sprintf(str2, "Sin: %s%3d.%03d", neg ? "-" : " ", nsin >> FIX16_FRAC_BITS, 1000*fix16Frac(nsin)/(1<<FIX16_FRAC_BITS));
BMP_drawText(str2, 20, 1);
neg = false;
fix16 ncos = dx;
if (dx < 0){
neg = true;
ncos = 0 - ncos;
}
sprintf(str2, "Cos: %s%3d.%03d", neg ? "-" : " ", ncos >> FIX16_FRAC_BITS, 1000*fix16Frac(ncos)/(1<<FIX16_FRAC_BITS));
BMP_drawText(str2, 20, 2);
neg = false;
fix16 ntan = tan;
if (tan < 0){
neg = true;
ntan = 0 - ntan;
}
sprintf(str2, "Tan: %s%3d.%03d", neg ? "-" : " ", ntan >> FIX16_FRAC_BITS, 1000*fix16Frac(ntan)/(1<<FIX16_FRAC_BITS));
BMP_drawText(str2, 20, 3);
fix16 aTan = FIX16(0);
if(tan != 0) aTan = fix16Div(FIX16(-1), tan);
s16 tanInt = fix16ToInt(fix16Mul(aTan, FIX16(100)));
@ -152,15 +180,15 @@ void render(){
mapscan();
if(angle >= 360) angle = angle - 360;
if(angle < 0) angle = 360 + angle;
castRay(angle-20);
BMP_drawLine(&l);
castRay(angle-10);
BMP_drawLine(&l);
//castRay(angle-20);
//BMP_drawLine(&l);
//castRay(angle-10);
//BMP_drawLine(&l);
castRay(angle);
BMP_drawLine(&l);
castRay(angle+10);
BMP_drawLine(&l);
castRay(angle+20);
//BMP_drawLine(&l);
//castRay(angle+10);
//BMP_drawLine(&l);
//castRay(angle+20);
BMP_drawLine(&l);
BMP_showFPS(0);