summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/main.cpp b/main.cpp
index f301ea2..0d3a16a 100644
--- a/main.cpp
+++ b/main.cpp
@@ -55,26 +55,28 @@ class BulletPattern1 : public BulletPattern {
class BulletPattern2 : public BulletPattern {
public:
- BulletPattern2(bool reverse, unsigned int base) {
+ BulletPattern2(unsigned int base) {
num_bullets = 0;
color_r = 0;
color_g = 1;
color_b = 0;
stride = sizeof(float);
- bullets = new float[32*5];
-
- int j = 0;
- for(float i = 0; i < M_PI; i += 0.1, j++) {
- bullets[j*5] = 50.0 + sinf(!reverse ? M_PI_2 + i : M_PI - i + M_PI_2) * 9;
- bullets[j*5 + 1] = 80 + cosf(M_PI_2 + i) * 10;
- bullets[j*5 + 2] = sinf(!reverse ? M_PI_2 + i : M_PI - i + M_PI_2) / 150.0;
- bullets[j*5 + 3] = -0.01;
- bullets[j*5 + 4] = base + i * 100;
+ bullets = new float[8*32*5];
+
+ int k = 0;
+ for(int j = 0; j < 8; j++) {
+ for(float i = 0; i < M_PI; i += 0.1, k++) {
+ bullets[k*5] = 50.0 + sinf(j % 2 ? M_PI_2 + i : M_PI - i + M_PI_2) * 9;
+ bullets[k*5 + 1] = 80 + cosf(M_PI_2 + i) * 10;
+ bullets[k*5 + 2] = sinf(j % 2 ? M_PI_2 + i : M_PI - i + M_PI_2) / 150.0;
+ bullets[k*5 + 3] = -0.01;
+ bullets[k*5 + 4] = base + j * 400 + i * 100;
+ }
}
};
void update(unsigned int time, unsigned int step) {
- while(num_bullets < 32 && (unsigned int)(bullets[num_bullets*5 + 4]) < time) {
+ while(num_bullets < 256 && (unsigned int)(bullets[num_bullets*5 + 4]) < time) {
num_bullets++;
}
for(int i = 0; i < num_bullets; i++) {
@@ -131,9 +133,7 @@ int main(int, char**) {
for(int i = 0; i < 8; i++) {
patterns.push_back(new BulletPattern1(i % 2 == 1, 5000 + i * 400));
}
- for(int i = 0; i < 8; i++) {
- patterns.push_back(new BulletPattern2(i % 2 == 1, 9000 + i * 400));
- }
+ patterns.push_back(new BulletPattern2(9000));
TextureSDL texture1("foo.png");
TextureSDL texture2("foo4.png");