Przeglądaj źródła

Added zoom factor for visual trip

Eiyeron 12 lat temu
rodzic
commit
f6174d9cce
5 zmienionych plików z 9 dodań i 334 usunięć
  1. 4 4
      hexagon.c
  2. 0 166
      hexagon.dlr
  3. 0 160
      hexagon.dlw
  4. 4 3
      struct.h
  5. 1 1
      wall.c

+ 4 - 4
hexagon.c

@@ -14,7 +14,7 @@
 //oriented angle between the player and the horizontal axis
 int player_angle=0;
 
-Camera cam = {64, 32, 0, 0};
+Camera cam = {64, 32, 0, 0, 0};
 
 //linked list of obstacles
 //at the moment, there is only a list, but at term, we should be using the lists from the Line struct. (And thus remove the "line" member from the Wall struct
@@ -159,15 +159,15 @@ void drawPlayer()
     for(i = 0; i<6; ++i)
     {
         int angle = i *60;
-        x[i] = 8.*cos(PI * (angle + cam.angle)/180.) + cam.cX;
-        y[i] = 8.*sin(PI * (angle + cam.angle)/180.) + cam.cY;
+        x[i] = (8. + cam.zoom)*cos(PI * (angle + cam.angle)/180.) + cam.cX;
+        y[i] = (8. + cam.zoom)*sin(PI * (angle + cam.angle)/180.) + cam.cY;
     }
 
 	//draw the aforementionned circle, depending on the camera's center
     //ML_filled_circle(cam.cX, cam.cY, 6, BLACK);
 	ML_polygone(x, y, 6, BLACK);
 	//draw the player. At such a low scale, it was impossible to draw a rotating triangle, so its a radius 1 circle instead.
-    ML_filled_circle(9*cos( PI*(player_angle + cam.angle)/180) + cam.cX, 9*sin( PI*(player_angle+cam.angle)/180) + cam.cY, 1, BLACK);
+    ML_filled_circle((9. + cam.zoom)*cos( PI*(player_angle + cam.angle)/180) + cam.cX, (9. + cam.zoom)*sin( PI*(player_angle+cam.angle)/180) + cam.cY, 1, BLACK);
 
 }
 

+ 0 - 166
hexagon.dlr

@@ -1,166 +0,0 @@
-[DLSimRunSpace]
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\hexagon.c
-Line=45
-Flags=00001012
-Sublevel=1
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\hexagon.c
-Line=25
-Flags=00001012
-Sublevel=1
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\hexagon.c
-Line=29
-Flags=00001012
-Sublevel=1
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\hexagon.c
-Line=29
-Flags=00001012
-Sublevel=2
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\hexagon.c
-Line=31
-Flags=00001012
-Sublevel=1
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\MonochromeLib.c
-Line=265
-Flags=00001012
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\MonochromeLib.c
-Line=281
-Flags=00001012
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\MonochromeLib.c
-Line=276
-Flags=00001012
-Sublevel=1
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\MonochromeLib.c
-Line=276
-Flags=00001012
-Sublevel=2
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\MonochromeLib.c
-Line=261
-Flags=00001012
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\hexagon.c
-Line=25
-Flags=00001012
-Sublevel=2
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\hexagon.c
-Line=45
-Flags=00001012
-Sublevel=2
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\hexagon.c
-Line=31
-Flags=00001012
-Sublevel=2
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\hexagon.c
-Line=40
-Flags=00001012
-Sublevel=1
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\wall.c
-Line=119
-Flags=00001012
-Sublevel=1
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\wall.c
-Line=121
-Flags=00001012
-
-[Breakpoint]
-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
-Line=40
-Flags=00001012
-Sublevel=2
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\wall.c
-Line=172
-Flags=00001012
-Sublevel=1
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\wall.c
-Line=119
-Flags=00001012
-Sublevel=2
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\wall.c
-Line=172
-Flags=00001012
-Sublevel=2
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\wall.c
-Line=175
-Flags=00001012
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\wall.c
-Line=165
-Flags=00001012
-Sublevel=1
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\wall.c
-Line=165
-Flags=00001012
-Sublevel=2
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\wall.c
-Line=177
-Flags=00001012
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\wall.c
-Line=164
-Flags=00001012
-
-[Breakpoint]
-File=C:\Users\Florian\GIT\Super-Hexagon-Casio\hexagon.c
-Line=146
-Flags=00001012
-
-[Breakpoint]
-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

+ 0 - 160
hexagon.dlw

@@ -1,160 +0,0 @@
-[DLSimWorkSpace]
-
-[_1]
-Type=5
-Order=0
-Top=495
-Left=1485
-Height=4740
-Width=5565
-State=0
-Flags=00000020
-Setting=124:1:MonochromeLib.c
-OptionA=0
-
-[_2]
-Type=1
-Order=1
-Top=150
-Left=10950
-Height=4740
-Width=5535
-State=0
-Flags=00000001
-OptionA=15
-OptionB=15
-
-[_3]
-Type=6
-Order=2
-Top=4740
-Left=7800
-Height=6390
-Width=5535
-State=0
-Flags=00000001
-OptionA=0
-
-[_4]
-Type=7
-Order=11
-Top=5280
-Left=13980
-Height=3165
-Width=5565
-State=16
-Flags=00000000
-OptionA=0
-
-[_5]
-Type=8
-Order=5
-Top=450
-Left=14730
-Height=3225
-Width=5580
-State=0
-Flags=00000000
-OptionA=0
-
-[_6]
-Type=3
-Order=13
-Top=0
-Left=10788
-Height=6348
-Width=2232
-State=16
-Flags=00000000
-OptionA=0
-
-[_7]
-Type=2
-Order=12
-Top=6348
-Left=7800
-Height=3588
-Width=5220
-State=16
-Flags=00000000
-OptionA=0
-
-[_8]
-Type=17
-Order=7
-Top=15
-Left=-15
-Height=11115
-Width=2235
-State=0
-Flags=00000000
-OptionA=0
-
-[_9]
-Type=15
-Order=3
-Top=30
-Left=2130
-Height=6915
-Width=9915
-State=0
-Flags=00000000
-OptionA=0
-
-[_10]
-Type=14
-Order=10
-Top=1320
-Left=1320
-Height=6810
-Width=16890
-State=16
-Flags=00000020
-OptionA=0
-
-[_11]
-Type=13
-Order=9
-Top=2250
-Left=2250
-Height=7560
-Width=17535
-State=16
-Flags=00000020
-OptionA=0
-
-[_32]
-Type=16
-Order=6
-Top=2940
-Left=2370
-Height=4590
-Width=5595
-State=0
-Flags=00000020
-Setting=162:1:hexagon.c
-OptionA=0
-
-[_33]
-Type=16
-Order=8
-Top=2970
-Left=2970
-Height=3000
-Width=3915
-State=1
-Flags=00000020
-Setting=1:1:MonochromeLib.c
-OptionA=0
-
-[_34]
-Type=16
-Order=4
-Top=3600
-Left=5985
-Height=6885
-Width=17190
-State=0
-Flags=00000020
-Setting=116:1:wall.c
-OptionA=0

+ 4 - 3
struct.h

@@ -24,13 +24,13 @@ struct Level{
 
 	//for the camera rotation
 	int change_interval; //5 seconds most of the time, but who knows...
-	int change_precision //to add a bit of randomness to the intervals
+	int change_precision; //to add a bit of randomness to the intervals
 	float change_probability; //sometimes, there can be no change at all
-	
+
 	float max_speed;
 	float min_speed;
 
-	float fast_spin_probability; //very low, sometimes there is a slightly faster spin for one second, then a normal spin. This is the number that allow us to generate it
+	float fast_spin_probability; //very low, there sometimes is a slightly faster spin for one second, then a normal spin. This is the number that allow us to generate it
 };
 
 //the camera is defined by its center
@@ -40,6 +40,7 @@ struct Camera{
     int cX;
     int cY;
     int angle;
+    unsigned float zoom;
 
     float speed;
 };

+ 1 - 1
wall.c

@@ -103,7 +103,7 @@ void show(Wall *list, Camera *cam)
 				const float sin1 = sin(angle);
 				const float sin2 = sin(angle + PI/3);
 				int i,j, x, y;
-				float dist = tmp->d - tmp->h;
+				float dist = tmp->d - tmp->h + cam.zoom;
 				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);