summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2022-12-21 23:10:18 +0000
committerIan C <ianc@noddybox.co.uk>2022-12-21 23:10:18 +0000
commit58dc358efe685d7657657d6362806c7e27a9cc22 (patch)
tree8bf3e8ede3a03ab1266a79b635e537e12b29f94b
parentdf449ab83c4283c86bddc5c39073c1613ef513b1 (diff)
Changed win sceen.
-rw-r--r--util.c59
1 files changed, 37 insertions, 22 deletions
diff --git a/util.c b/util.c
index 736ea47..41d09e6 100644
--- a/util.c
+++ b/util.c
@@ -103,6 +103,17 @@ double DRand()
return (double)(rand() % 1000) / 1000.0;
}
+static void Plot3D(double x, double y, double z, char glyph)
+{
+ int ix;
+ int iy;
+
+ ix = COLS/2 + x / (z / 30.0);
+ iy = LINES/2 + y / (z / 30.0);
+
+ mvaddch(iy, ix, glyph);
+}
+
void WinScreen()
{
static const char *text[] =
@@ -112,6 +123,20 @@ void WinScreen()
" # # # # # # # # # # # ##",
" # # # # # ## ## # # # #",
" # ## ## # # ## # #",
+ " ",
+ " ",
+ " ",
+ "### ### #### ### ###",
+ "# # # # # # # ",
+ "### ### ### ## ## ",
+ "# # # # # #",
+ "# # # #### ### ### ",
+ " ",
+ " ### ### ## ### ####",
+ "# # # # # # # ",
+ " ## ### #### # ### ",
+ " # # # # # # ",
+ "### # # # ### ####",
NULL,
};
@@ -119,7 +144,7 @@ void WinScreen()
typedef struct
{
- double x,y,yi;
+ double x,y,z;
} Star;
Star *star;
@@ -135,13 +160,9 @@ void WinScreen()
for(f = 0; f < NO_STAR; f++)
{
- star[f].x = rand() % COLS;
- star[f].y = rand() % LINES;
-
- do
- {
- star[f].yi = (double)(rand() % 20) / 10.0;
- } while(star[f].yi == 0);
+ star[f].x = rand() % 1000 - 500;
+ star[f].y = rand() % 1000 - 500;
+ star[f].z = rand() % 1000;
}
halfdelay(1);
@@ -152,25 +173,21 @@ void WinScreen()
{
for(f = 0; f < NO_STAR; f++)
{
- mvaddch(star[f].y, star[f].x, ' ');
+ Plot3D(star[f].y, star[f].x, star[f].z, ' ');
- star[f].y -= star[f].yi;
+ star[f].z -= 30;
- if (star[f].y < 0)
+ if (star[f].z < 0)
{
- star[f].x = rand() % COLS;
- star[f].y = LINES - 1;
-
- do
- {
- star[f].yi = (double)(rand() % 20) / 10.0;
- } while(star[f].yi == 0);
+ star[f].x = rand() % 1000 - 500;
+ star[f].y = rand() % 1000 - 500;
+ star[f].z = 1000;
}
}
for(f = 0; f < NO_STAR; f++)
{
- mvaddch(star[f].y, star[f].x, '.');
+ Plot3D(star[f].y, star[f].x, star[f].z, '.');
}
for(f = 0 ; text[f]; f++)
@@ -182,7 +199,7 @@ void WinScreen()
{
if (text[f][i] != ' ')
{
- mvaddch(f + 4, x++, text[f][i]);
+ mvaddch(f + 2, x++, text[f][i]);
}
else
{
@@ -191,8 +208,6 @@ void WinScreen()
}
}
- Centre(f + 7, "PRESS SPACE");
-
refresh();
}