diff --git a/src/main.c b/src/main.c index 0344c66..7eacb87 100644 --- a/src/main.c +++ b/src/main.c @@ -35,20 +35,23 @@ int main( int argc, char *argv[] ) { //yoinked from the internet argc is number int delay = 1000; int dosspin = 0; - + //TODO nuke bools they arnt part of the c99 standard + //here it js being stolen from curses bool gamerun = true; struct entity { int x; int y; - int xold; + int xold; //i kinda dont like tbid xold yold shit int yold; + char under_char; //the char that is under the entity so when it moves off of it it wont be erased + char under_charold; } - player = {0, 0, 0, 0}, - enemy = {24, 16, 0, 0}, - debugent_x = {0, 0, 0, 0}, - debugent_y = {0, 0, 0, 0}; + player = {0, 0, 0, 0, ' ', ' '}, + enemy = {24, 16, 0, 0, ' ', ' '}, + debugent_x = {0, 0, 0, 0, ' ', ' '}, + debugent_y = {0, 0, 0, 0, ' ', ' '}; zom_scrinit(); @@ -64,6 +67,7 @@ int main( int argc, char *argv[] ) { //yoinked from the internet argc is number if ((currenttime % 5000)==0) { player.xold = player.x; player.yold = player.y; + player.under_charold = player.under_char; enemy.xold = enemy.x; enemy.yold = enemy.y; debugent_x.xold = debugent_x.x; @@ -75,24 +79,28 @@ int main( int argc, char *argv[] ) { //yoinked from the internet argc is number case 'a': if (attempt_move(player.x, player.y, 1, 2) == 1) { player.x--; + player.under_char = readmap(player.x, player.y); } break; case 'w': if (attempt_move(player.x, player.y, 1, 1) == 1) { player.y--; + player.under_char = readmap(player.x, player.y); } break; case 'd': if (attempt_move(player.x, player.y, 1, 0) == 1) { player.x++; + player.under_char = readmap(player.x, player.y); } break; case 's': if (attempt_move(player.x, player.y, 1, 3) == 1) { player.y++; + player.under_char = readmap(player.x, player.y); } break; @@ -170,7 +178,7 @@ int main( int argc, char *argv[] ) { //yoinked from the internet argc is number break; } - zom_putcharat(player.xold, player.yold, ' '); + zom_putcharat(player.xold, player.yold, player.under_charold); zom_putcharat(player.x, player.y, '#'); zom_putcharat(debugent_x.xold, debugent_x.yold, ' '); zom_putcharat(debugent_x.x, debugent_x.y, 'X');