瀏覽代碼

Merge branch 'zoom' into REFACTOR

Conflicts:
	hexagon.c
	struct.h
Adrien Boucaud 12 年之前
父節點
當前提交
a7ead97bbc
共有 6 個文件被更改,包括 9 次插入335 次删除
  1. 3 4
      draw_states.c
  2. 0 2
      hexagon.c
  3. 0 166
      hexagon.dlr
  4. 0 160
      hexagon.dlw
  5. 5 2
      struct.h
  6. 1 1
      wall.c

+ 3 - 4
draw_states.c

@@ -36,16 +36,15 @@ void drawPlayer(Camera *cam, int player_angle)
     for(i = 0; i<6; ++i)
     {
         angle = i *60;
-
-        x[i] = 8.0*cos(PI * (angle + cam->angle)/180.0) + cam->cX;
-        y[i] = 8.0*sin(PI * (angle + cam->angle)/180.0) + 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 - 2
hexagon.c

@@ -7,7 +7,6 @@
 #include "syscall.h"
 #include "states.h"
 
-
 int AddIn_main(int isAppli, unsigned short OptionNum)
 {
     Game_Data data;
@@ -47,7 +46,6 @@ int AddIn_main(int isAppli, unsigned short OptionNum)
     return 1;
 }
 
-
 #pragma section _BR_Size
 unsigned long BR_Size;
 #pragma section

+ 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

+ 5 - 2
struct.h

@@ -15,6 +15,7 @@
 
 //macros
 #define abs(x) x>0 ? x : -x
+
 typedef enum {PATTERN} Pattern_Enum;
 typedef struct Camera Camera;
 typedef struct Wall Wall;
@@ -26,17 +27,18 @@ typedef enum {GAME, MENU, TITLE, GAME_OVER} State;
 struct Level{
 	//for the level generation
 	Pattern_Enum available_patterns[32][32];
+
 	int nb_patterns;
 
 	//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
 	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
@@ -46,6 +48,7 @@ struct Camera{
     int cX;
     int cY;
     int angle;
+    unsigned float zoom;
 
     float speed;
 };

+ 1 - 1
wall.c

@@ -103,7 +103,7 @@ void drawWalls(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);