Kaynağa Gözat

Tried to change drawing algorithm.

Eiyeron 12 yıl önce
ebeveyn
işleme
eb42d2bb81
3 değiştirilmiş dosya ile 28 ekleme ve 12 silme
  1. 7 0
      hexagon.dlr
  2. 5 5
      hexagon.dlw
  3. 16 7
      wall.c

+ 7 - 0
hexagon.dlr

@@ -96,6 +96,7 @@ Flags=00001012
 File=C:\Users\Florian\GIT\Super-Hexagon-Casio\wall.c
 Line=112
 Flags=00001012
+Sublevel=1
 
 [Breakpoint]
 File=C:\Users\Florian\GIT\Super-Hexagon-Casio\hexagon.c
@@ -157,3 +158,9 @@ Flags=00001012
 File=C:\Users\Florian\GIT\Super-Hexagon-Casio\hexagon.c
 Line=161
 Flags=00001012
+
+[Breakpoint]
+File=C:\Users\Florian\GIT\Super-Hexagon-Casio\wall.c
+Line=112
+Flags=00001012
+Sublevel=2

+ 5 - 5
hexagon.dlw

@@ -9,7 +9,7 @@ Height=4740
 Width=5565
 State=0
 Flags=00000020
-Setting=157:1:hexagon.c
+Setting=124:1:MonochromeLib.c
 OptionA=0
 
 [_2]
@@ -48,7 +48,7 @@ OptionA=0
 
 [_5]
 Type=8
-Order=4
+Order=5
 Top=450
 Left=14730
 Height=3225
@@ -125,7 +125,7 @@ OptionA=0
 
 [_32]
 Type=16
-Order=5
+Order=6
 Top=2940
 Left=2370
 Height=4590
@@ -149,12 +149,12 @@ OptionA=0
 
 [_34]
 Type=16
-Order=6
+Order=4
 Top=3600
 Left=5985
 Height=6885
 Width=17190
 State=0
 Flags=00000020
-Setting=156:5:wall.c
+Setting=116:1:wall.c
 OptionA=0

+ 16 - 7
wall.c

@@ -4,7 +4,7 @@ Wall *addWall(Wall *list, int d, int h, int id, int line)
 {
 	Wall *tmp;
 	Wall *new;
-	tmp = list;		 
+	tmp = list;
 
 	new = malloc(sizeof(Wall));
 	new->d = d;
@@ -13,7 +13,7 @@ Wall *addWall(Wall *list, int d, int h, int id, int line)
 	new->line = line;
 	new->nxt = NULL;
 
-	if(list == NULL)		
+	if(list == NULL)
 		return new;
 	else if(list != NULL)
 	{
@@ -104,12 +104,21 @@ void show(Wall *list, Camera *cam)
 		{
 			if(tmp->d + tmp->h< 64)
 			{
+
 				const float angle = PI * ((tmp->line)*60 +cam->angle) / 180;
 				const float cos1 = cos(angle);
 				const float cos2 = cos(angle + PI/3);
 				const float sin1 = sin(angle);
 				const float sin2 = sin(angle + PI/3);
-				int x[4];
+				int i,j, x, y;
+				float dist = tmp->d - tmp->h;
+				for(i = 0; i < tmp->h; ++i) {
+					if(dist <= 8) break;
+					ML_line(64 + dist*cos1, 32 + dist*sin1, 64 + dist*cos2, 32 + dist*sin2, BLACK);
+					--dist;
+
+				}
+				/*int x[4];
 				int y[4];
 				float slopes[4];
 				int i = 0;
@@ -129,7 +138,7 @@ void show(Wall *list, Camera *cam)
 				y[1]=tmp->d * sin2 + 32;
 				y[2]= (tmp->h + tmp->d) * sin2 + 32;
 				y[3]=(tmp->h + tmp->d) * sin1 + 32;
-
+				*/
 				/*slopes[0] = (y[1] - y[0])/(x[1]-x[0]);
 				slopes[1] = (y[2] - y[1])/(x[2]-x[1]);
 				slopes[2] = (y[3] - y[2])/(x[3]-x[2]);
@@ -163,8 +172,8 @@ void show(Wall *list, Camera *cam)
 							tmpInt = x[leftDotIndex];
 					}
 					for(rightDotIndex = 0; rightDotIndex == i || rightDotIndex == j || rightDotIndex == leftDotIndex; rightDotIndex ++)
-					{}						
-					
+					{}
+
 					tmpInt = i;
 					while(i <= j)
 					{
@@ -182,7 +191,7 @@ void show(Wall *list, Camera *cam)
 						x2 = x2 - (1/slopes[rightSlope]);
 						i++;
 					}*/
-				ML_filled_polygone(x, y, 4, BLACK);
+				//ML_filled_polygone(x, y, 4, BLACK);
 			}
 		}
 		tmp = tmp->nxt;