mirror of
https://github.com/PoetryInCode/matrix.git
synced 2026-09-29 11:45:32 -04:00
fixed/unified formatting
This commit is contained in:
parent
d94bcdf287
commit
8ae935be78
@ -1,2 +1,5 @@
|
|||||||
[Buildset]
|
[Buildset]
|
||||||
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x0c\x00m\x00a\x00t\x00r\x00i\x00x)
|
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x0c\x00m\x00a\x00t\x00r\x00i\x00x)
|
||||||
|
|
||||||
|
[Project]
|
||||||
|
VersionControlSupport=kdevgit
|
||||||
|
|||||||
44
src/main.c
44
src/main.c
@ -35,14 +35,12 @@ int main(int argc, char **argv) {
|
|||||||
timeout(time);
|
timeout(time);
|
||||||
int maxX = COLS;
|
int maxX = COLS;
|
||||||
int maxY = LINES;
|
int maxY = LINES;
|
||||||
|
|
||||||
int initTailLen;
|
int initTailLen;
|
||||||
if(argc >= 2) {
|
if(argc >= 2) {
|
||||||
initTailLen=atoi(argv[1]);
|
initTailLen=atoi(argv[1]);
|
||||||
} else {
|
} else {
|
||||||
initTailLen=10;
|
initTailLen=10;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tailLen[maxX];
|
int tailLen[maxX];
|
||||||
|
|
||||||
for(int i=0; i<maxX; i++) {
|
for(int i=0; i<maxX; i++) {
|
||||||
@ -55,7 +53,6 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int cascade[maxX];
|
int cascade[maxX];
|
||||||
int tail[maxX];
|
int tail[maxX];
|
||||||
int jmpTail[maxX];
|
int jmpTail[maxX];
|
||||||
@ -76,48 +73,31 @@ int main(int argc, char **argv) {
|
|||||||
if(cascade[xPos]==ERR) {//make sure the stream is set to active
|
if(cascade[xPos]==ERR) {//make sure the stream is set to active
|
||||||
cascade[xPos]=startPos;
|
cascade[xPos]=startPos;
|
||||||
}
|
}
|
||||||
//---------swich to weird format-----------
|
for(int i=0; i<maxX; i++) {//move the streams up/down
|
||||||
for(int i=0; i<maxX; i++)
|
if(!pause) {
|
||||||
{//move the streams up/down
|
if(cascade[i]!=ERR) {
|
||||||
if(!pause)
|
|
||||||
{
|
|
||||||
if(cascade[i]!=ERR)
|
|
||||||
{
|
|
||||||
if(dir==DOWN) {
|
if(dir==DOWN) {
|
||||||
tail[i] = cascade[i]-tailLen[i];
|
tail[i] = cascade[i]-tailLen[i];
|
||||||
} else {
|
} else {
|
||||||
tail[i] = cascade[i]+tailLen[i];
|
tail[i] = cascade[i]+tailLen[i];
|
||||||
}
|
}
|
||||||
if(cascade[i]==limit)
|
if(cascade[i]==limit) {//check if the position is at the bottom of the screen
|
||||||
{//check if the position is at the bottom of the screen
|
|
||||||
cascade[i]=ERR;//set the position to ERR if it is at the bottom
|
cascade[i]=ERR;//set the position to ERR if it is at the bottom
|
||||||
}
|
} else {
|
||||||
else
|
if(rand()%10==1) {//check if the stream will jump
|
||||||
{
|
if(!(jmpTail[i]<=maxY)) {
|
||||||
if(rand()%10==1)
|
if(dir==DOWN) {
|
||||||
{//check if the stream will jump
|
|
||||||
if(!(jmpTail[i]<=maxY))
|
|
||||||
{
|
|
||||||
if(dir==DOWN)
|
|
||||||
{
|
|
||||||
cascade[i]=cascade[i]+rand()%8;
|
cascade[i]=cascade[i]+rand()%8;
|
||||||
jmpTail[i]=cascade[i]-tailLen[i];
|
jmpTail[i]=cascade[i]-tailLen[i];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
cascade[i]=cascade[i]-rand()%8;
|
cascade[i]=cascade[i]-rand()%8;
|
||||||
jmpTail[i]=cascade[i]+tailLen[i];
|
jmpTail[i]=cascade[i]+tailLen[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
if(dir==DOWN) {
|
||||||
{
|
|
||||||
if(dir==DOWN)
|
|
||||||
{
|
|
||||||
cascade[i]++;//increase the position
|
cascade[i]++;//increase the position
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
cascade[i]--;
|
cascade[i]--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user