Mercurial > sdl-ios-xcode
comparison Xcode/TemplatesForXcode/SDL OpenGL Application/atlantis/swim.c @ 2213:59a667370c57
make indent
author | Bob Pendleton <bob@pendleton.com> |
---|---|
date | Tue, 24 Jul 2007 18:46:45 +0000 |
parents | d63e9f5944ae |
children | 4d2d0548f5b2 |
comparison
equal
deleted
inserted
replaced
2212:fdadda42d4d4 | 2213:59a667370c57 |
---|---|
33 * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. | 33 * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. |
34 * | 34 * |
35 * OpenGL(TM) is a trademark of Silicon Graphics, Inc. | 35 * OpenGL(TM) is a trademark of Silicon Graphics, Inc. |
36 */ | 36 */ |
37 #include <math.h> | 37 #include <math.h> |
38 #include <stdlib.h> /* For rand(). */ | 38 #include <stdlib.h> /* For rand(). */ |
39 #include <GLUT/glut.h> | 39 #include <GLUT/glut.h> |
40 #include "atlantis.h" | 40 #include "atlantis.h" |
41 | 41 |
42 void | 42 void |
43 FishTransform(fishRec * fish) | 43 FishTransform(fishRec * fish) |
55 | 55 |
56 fish->phi = -20.0; | 56 fish->phi = -20.0; |
57 fish->theta = 0.0; | 57 fish->theta = 0.0; |
58 fish->psi -= 0.5; | 58 fish->psi -= 0.5; |
59 | 59 |
60 fish->x += WHALESPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD); | 60 fish->x += |
61 fish->y += WHALESPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD); | 61 WHALESPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD); |
62 fish->y += | |
63 WHALESPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD); | |
62 fish->z += WHALESPEED * fish->v * sin(fish->theta / RAD); | 64 fish->z += WHALESPEED * fish->v * sin(fish->theta / RAD); |
63 } | 65 } |
64 | 66 |
65 void | 67 void |
66 SharkPilot(fishRec * fish) | 68 SharkPilot(fishRec * fish) |
150 if ((fish->v > 1.0) && (!fish->spurt)) { | 152 if ((fish->v > 1.0) && (!fish->spurt)) { |
151 fish->v -= 0.05; | 153 fish->v -= 0.05; |
152 } | 154 } |
153 } | 155 } |
154 | 156 |
155 fish->x += SHARKSPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD); | 157 fish->x += |
156 fish->y += SHARKSPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD); | 158 SHARKSPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD); |
159 fish->y += | |
160 SHARKSPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD); | |
157 fish->z += SHARKSPEED * fish->v * sin(fish->theta / RAD); | 161 fish->z += SHARKSPEED * fish->v * sin(fish->theta / RAD); |
158 } | 162 } |
159 | 163 |
160 void | 164 void |
161 SharkMiss(int i) | 165 SharkMiss(int i) |