Mercurial > sdl-ios-xcode
comparison Xcode/TemplatesForXcode/SDL OpenGL Application/atlantis/swim.c @ 2220:4d2d0548f5b2
Don't run indent on the Xcode templates
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 11 Aug 2007 18:51:12 +0000 |
parents | 59a667370c57 |
children |
comparison
equal
deleted
inserted
replaced
2219:f6099efa3f0b | 2220:4d2d0548f5b2 |
---|---|
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 += | 60 fish->x += WHALESPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD); |
61 WHALESPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD); | 61 fish->y += WHALESPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD); |
62 fish->y += | |
63 WHALESPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD); | |
64 fish->z += WHALESPEED * fish->v * sin(fish->theta / RAD); | 62 fish->z += WHALESPEED * fish->v * sin(fish->theta / RAD); |
65 } | 63 } |
66 | 64 |
67 void | 65 void |
68 SharkPilot(fishRec * fish) | 66 SharkPilot(fishRec * fish) |
152 if ((fish->v > 1.0) && (!fish->spurt)) { | 150 if ((fish->v > 1.0) && (!fish->spurt)) { |
153 fish->v -= 0.05; | 151 fish->v -= 0.05; |
154 } | 152 } |
155 } | 153 } |
156 | 154 |
157 fish->x += | 155 fish->x += SHARKSPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD); |
158 SHARKSPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD); | 156 fish->y += SHARKSPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD); |
159 fish->y += | |
160 SHARKSPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD); | |
161 fish->z += SHARKSPEED * fish->v * sin(fish->theta / RAD); | 157 fish->z += SHARKSPEED * fish->v * sin(fish->theta / RAD); |
162 } | 158 } |
163 | 159 |
164 void | 160 void |
165 SharkMiss(int i) | 161 SharkMiss(int i) |