# Copyright (C) 2007 Marcel Unbehaun <frostworks@gmx.de>
# Distributed under the same license as the game. See debian/copyright.
Index: titanion-0.3.dfsg1/src/abagames/ttn/bullet.d
===================================================================
--- titanion-0.3.dfsg1.orig/src/abagames/ttn/bullet.d 2007-08-29 19:46:41.000000000 +0200
+++ titanion-0.3.dfsg1/src/abagames/ttn/bullet.d 2007-08-29 19:46:43.000000000 +0200
@@ -59,7 +59,54 @@
}
}
-public class Bullet: Token!(BulletState, BulletSpec) {
+public class Token2(ST, SP): Actor {
+ protected:
+ ST state;
+ SP spec;
+
+ public void init(Object[] args) {
+ state = new ST;
+ }
+
+ public void set(SP spec, Vector pos, float deg, float speed) {
+ set(spec, pos.x, pos.y, deg, speed);
+ }
+
+ public void set(SP spec, float x, float y, float deg, float speed) {
+ this.spec = spec;
+ set(x, y, deg, speed);
+ }
+
+ public void set(float x, float y, float deg, float speed) {
+ state.clear();
+ state.pos.x = x;
+ state.pos.y = y;
+ state.deg = deg;
+ state.speed = speed;
+ spec.set(state);
+ _exists = true;
+ }
+
+ public void move() {
+ if (!spec.move(state))
+ remove();
+ }
+
+ public void remove() {
+ _exists = false;
+ spec.removed(state);
+ }
+
+ public void draw() {
+ spec.draw(state);
+ }
+
+ public Vector pos() {
+ return state.pos;
+ }
+}
+
+public class Bullet: Token2!(BulletState, BulletSpec) {
private:
public void setWaitCnt(int c) {
@@ -102,7 +149,28 @@
}
}
-public class BulletSpec: TokenSpec!(BulletState) {
+public class TokenSpec2(T) {
+ protected:
+ Field field;
+ Shape shape;
+
+ public void set(T state) {}
+ public void removed(T state) {}
+
+ public bool move(T state) {
+ return true;
+ }
+
+ public void draw(T state) {
+ with (state) {
+ Vector3 p = field.calcCircularPos(pos);
+ float cd = field.calcCircularDeg(pos.x);
+ shape.draw(p, cd, deg);
+ }
+ }
+}
+
+public class BulletSpec: TokenSpec2!(BulletState) {
private:
static const float DISAPPEAR_CNT = 300;
Player player;
Index: titanion-0.3.dfsg1/src/abagames/ttn/enemy.d
===================================================================
--- titanion-0.3.dfsg1.orig/src/abagames/ttn/enemy.d 2007-08-29 19:46:41.000000000 +0200
+++ titanion-0.3.dfsg1/src/abagames/ttn/enemy.d 2007-08-29 19:46:43.000000000 +0200
@@ -188,7 +188,54 @@
}
}
-public class Enemy: Token!(EnemyState, EnemySpec) {
+public class Token2(ST, SP): Actor {
+ protected:
+ ST state;
+ SP spec;
+
+ public void init(Object[] args) {
+ state = new ST;
+ }
+
+ public void set(SP spec, Vector pos, float deg, float speed) {
+ set(spec, pos.x, pos.y, deg, speed);
+ }
+
+ public void set(SP spec, float x, float y, float deg, float speed) {
+ this.spec = spec;
+ set(x, y, deg, speed);
+ }
+
+ public void set(float x, float y, float deg, float speed) {
+ state.clear();
+ state.pos.x = x;
+ state.pos.y = y;
+ state.deg = deg;
+ state.speed = speed;
+ spec.set(state);
+ _exists = true;
+ }
+
+ public void move() {
+ if (!spec.move(state))
+ remove();
+ }
+
+ public void remove() {
+ _exists = false;
+ spec.removed(state);
+ }
+
+ public void draw() {
+ spec.draw(state);
+ }
+
+ public Vector pos() {
+ return state.pos;
+ }
+}
+
+public class Enemy: Token2!(EnemyState, EnemySpec) {
private:
public override void init(Object[] args) {
@@ -423,7 +470,28 @@
}
}
-public class EnemySpec: TokenSpec!(EnemyState) {
+public class TokenSpec2(T) {
+ protected:
+ Field field;
+ Shape shape;
+
+ public void set(T state) {}
+ public void removed(T state) {}
+
+ public bool move(T state) {
+ return true;
+ }
+
+ public void draw(T state) {
+ with (state) {
+ Vector3 p = field.calcCircularPos(pos);
+ float cd = field.calcCircularDeg(pos.x);
+ shape.draw(p, cd, deg);
+ }
+ }
+}
+
+public class EnemySpec: TokenSpec2!(EnemyState) {
mixin StaticRandImpl;
protected:
static const float BULLET_HIT_WIDTH = 0.8f;
@@ -1464,7 +1532,7 @@
}
}
-public class TurretSpec: TokenSpec!(TurretState) {
+public class TurretSpec: TokenSpec2!(TurretState) {
mixin StaticRandImpl;
public:
static const float SPEED_RATIO = 5.0f;
Index: titanion-0.3.dfsg1/src/abagames/ttn/particle.d
===================================================================
--- titanion-0.3.dfsg1.orig/src/abagames/ttn/particle.d 2007-08-29 19:46:41.000000000 +0200
+++ titanion-0.3.dfsg1/src/abagames/ttn/particle.d 2007-08-29 19:46:43.000000000 +0200
@@ -24,7 +24,55 @@
public class ParticlePool: ActorPool!(Particle) {
}
-public class Particle: Token!(ParticleState, ParticleSpec) {
+public class Token2(ST, SP): Actor {
+ protected:
+ ST state;
+ SP spec;
+
+ public void init(Object[] args) {
+ state = new ST;
+ }
+
+ public void set(SP spec, Vector pos, float deg, float speed) {
+ set(spec, pos.x, pos.y, deg, speed);
+ }
+
+ public void set(SP spec, float x, float y, float deg, float speed) {
+ this.spec = spec;
+ set(x, y, deg, speed);
+ }
+
+ public void set(float x, float y, float deg, float speed) {
+ state.clear();
+ state.pos.x = x;
+ state.pos.y = y;
+ state.deg = deg;
+ state.speed = speed;
+ spec.set(state);
+ _exists = true;
+ }
+
+ public void move() {
+ if (!spec.move(state))
+ remove();
+ }
+
+ public void remove() {
+ _exists = false;
+ spec.removed(state);
+ }
+
+ public void draw() {
+ spec.draw(state);
+ }
+
+ public Vector pos() {
+ return state.pos;
+ }
+}
+
+
+public class Particle: Token2!(ParticleState, ParticleSpec) {
public:
static const enum Shape {
TRIANGLE, LINE, QUAD, BONUS,
@@ -153,7 +201,28 @@
}
}
-public class ParticleSpec: TokenSpec!(ParticleState) {
+public class TokenSpec2(T) {
+ protected:
+ Field field;
+ Shape shape;
+
+ public void set(T state) {}
+ public void removed(T state) {}
+
+ public bool move(T state) {
+ return true;
+ }
+
+ public void draw(T state) {
+ with (state) {
+ Vector3 p = field.calcCircularPos(pos);
+ float cd = field.calcCircularDeg(pos.x);
+ shape.draw(p, cd, deg);
+ }
+ }
+}
+
+public class ParticleSpec: TokenSpec2!(ParticleState) {
mixin StaticRandImpl;
private:
Player player;
Index: titanion-0.3.dfsg1/src/abagames/ttn/pillar.d
===================================================================
--- titanion-0.3.dfsg1.orig/src/abagames/ttn/pillar.d 2007-08-29 19:46:41.000000000 +0200
+++ titanion-0.3.dfsg1/src/abagames/ttn/pillar.d 2007-08-29 19:46:43.000000000 +0200
@@ -6,6 +6,7 @@
module abagames.ttn.pillar;
private import std.math;
+private import abagames.util.vector;
private import abagames.util.actor;
private import abagames.ttn.field;
private import abagames.ttn.token;
@@ -38,7 +39,54 @@
}
}
-public class Pillar: Token!(PillarState, PillarSpec) {
+public class Token2(ST, SP): Actor {
+ protected:
+ ST state;
+ SP spec;
+
+ public void init(Object[] args) {
+ state = new ST;
+ }
+
+ public void set(SP spec, Vector pos, float deg, float speed) {
+ set(spec, pos.x, pos.y, deg, speed);
+ }
+
+ public void set(SP spec, float x, float y, float deg, float speed) {
+ this.spec = spec;
+ set(x, y, deg, speed);
+ }
+
+ public void set(float x, float y, float deg, float speed) {
+ state.clear();
+ state.pos.x = x;
+ state.pos.y = y;
+ state.deg = deg;
+ state.speed = speed;
+ spec.set(state);
+ _exists = true;
+ }
+
+ public void move() {
+ if (!spec.move(state))
+ remove();
+ }
+
+ public void remove() {
+ _exists = false;
+ spec.removed(state);
+ }
+
+ public void draw() {
+ spec.draw(state);
+ }
+
+ public Vector pos() {
+ return state.pos;
+ }
+}
+
+public class Pillar: Token2!(PillarState, PillarSpec) {
private:
public void set(PillarSpec ps, float y, float maxY, Pillar pp, PillarShape s, float vdeg, bool outside = false) {
@@ -83,7 +131,28 @@
}
}
-public class PillarSpec:TokenSpec!(PillarState) {
+public class TokenSpec2(T) {
+ protected:
+ Field field;
+ Shape shape;
+
+ public void set(T state) {}
+ public void removed(T state) {}
+
+ public bool move(T state) {
+ return true;
+ }
+
+ public void draw(T state) {
+ with (state) {
+ Vector3 p = field.calcCircularPos(pos);
+ float cd = field.calcCircularDeg(pos.x);
+ shape.draw(p, cd, deg);
+ }
+ }
+}
+
+public class PillarSpec:TokenSpec2!(PillarState) {
private:
static const VELOCITY_Y = 0.025f;
Index: titanion-0.3.dfsg1/src/abagames/ttn/player.d
===================================================================
--- titanion-0.3.dfsg1.orig/src/abagames/ttn/player.d 2007-08-29 19:46:41.000000000 +0200
+++ titanion-0.3.dfsg1/src/abagames/ttn/player.d 2007-08-29 19:46:43.000000000 +0200
@@ -24,10 +24,57 @@
private import abagames.ttn.sound;
private import abagames.ttn.letter;
+public class Token2(ST, SP): Actor {
+ protected:
+ ST state;
+ SP spec;
+
+ public void init(Object[] args) {
+ state = new ST;
+ }
+
+ public void set(SP spec, Vector pos, float deg, float speed) {
+ set(spec, pos.x, pos.y, deg, speed);
+ }
+
+ public void set(SP spec, float x, float y, float deg, float speed) {
+ this.spec = spec;
+ set(x, y, deg, speed);
+ }
+
+ public void set(float x, float y, float deg, float speed) {
+ state.clear();
+ state.pos.x = x;
+ state.pos.y = y;
+ state.deg = deg;
+ state.speed = speed;
+ spec.set(state);
+ _exists = true;
+ }
+
+ public void move() {
+ if (!spec.move(state))
+ remove();
+ }
+
+ public void remove() {
+ _exists = false;
+ spec.removed(state);
+ }
+
+ public void draw() {
+ spec.draw(state);
+ }
+
+ public Vector pos() {
+ return state.pos;
+ }
+}
+
/**
* Player and shots.
*/
-public class Player: Token!(PlayerState, PlayerSpec) {
+public class Player: Token2!(PlayerState, PlayerSpec) {
private:
Vector hitOffset;
@@ -300,7 +347,28 @@
}
}
-public class PlayerSpec: TokenSpec!(PlayerState) {
+public class TokenSpec2(T) {
+ protected:
+ Field field;
+ Shape shape;
+
+ public void set(T state) {}
+ public void removed(T state) {}
+
+ public bool move(T state) {
+ return true;
+ }
+
+ public void draw(T state) {
+ with (state) {
+ Vector3 p = field.calcCircularPos(pos);
+ float cd = field.calcCircularDeg(pos.x);
+ shape.draw(p, cd, deg);
+ }
+ }
+}
+
+public class PlayerSpec: TokenSpec2!(PlayerState) {
mixin StaticRandImpl;
public:
static const float BASE_SPEED = 0.15f;
@@ -768,7 +836,7 @@
}
}
-public class Shot: Token!(ShotState, ShotSpec) {
+public class Shot: Token2!(ShotState, ShotSpec) {
private:
public void setParent(Shot s) {
@@ -788,7 +856,7 @@
}
}
-public class ShotSpec: TokenSpec!(ShotState) {
+public class ShotSpec: TokenSpec2!(ShotState) {
private:
EnemyPool enemies;
BulletPool bullets;
Index: titanion-0.3.dfsg1/src/abagames/ttn/screen.d
===================================================================
--- titanion-0.3.dfsg1.orig/src/abagames/ttn/screen.d 2007-08-29 19:46:41.000000000 +0200
+++ titanion-0.3.dfsg1/src/abagames/ttn/screen.d 2007-08-29 19:46:43.000000000 +0200
@@ -21,7 +21,7 @@
Field field;
protected void setIcon() {
- SDL_WM_SetIcon(SDL_LoadBMP(ICON_FILE_NAME), null);
+// SDL_WM_SetIcon(SDL_LoadBMP(ICON_FILE_NAME), null);
}
protected void init() {
Index: titanion-0.3.dfsg1/src/abagames/util/rand.d
===================================================================
--- titanion-0.3.dfsg1.orig/src/abagames/util/rand.d 2007-08-29 19:46:41.000000000 +0200
+++ titanion-0.3.dfsg1/src/abagames/util/rand.d 2007-08-29 19:46:43.000000000 +0200
@@ -176,14 +176,14 @@
void next_state()
{
- uint *p=state;
+ uint *p=state.ptr;
/* if init_genrand() has not been called, */
/* a default initial seed is used */
if (initf==0) init_genrand(5489UL);
left = N;
- next = state;
+ next = state.ptr;
for (int j=N-M+1; --j; p++)
*p = p[M] ^ TWIST(p[0], p[1]);
Index: titanion-0.3.dfsg1/src/abagames/util/sdl/texture.d
===================================================================
--- titanion-0.3.dfsg1.orig/src/abagames/util/sdl/texture.d 2007-08-29 19:46:41.000000000 +0200
+++ titanion-0.3.dfsg1/src/abagames/util/sdl/texture.d 2007-08-29 19:46:43.000000000 +0200
@@ -103,13 +103,13 @@
}
glBindTexture(GL_TEXTURE_2D, num + ti);
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, panelWidth, panelHeight,
- GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+ GL_RGBA, GL_UNSIGNED_BYTE, pixels.ptr);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
if (maskColor != 0xffffffffu) {
glBindTexture(GL_TEXTURE_2D, maskNum + ti);
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, panelWidth, panelHeight,
- GL_RGBA, GL_UNSIGNED_BYTE, maskPixels);
+ GL_RGBA, GL_UNSIGNED_BYTE, maskPixels.ptr);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}
Index: titanion-0.3.dfsg1/import/opengl.d
===================================================================
--- titanion-0.3.dfsg1.orig/import/opengl.d 2007-08-29 19:46:46.000000000 +0200
+++ titanion-0.3.dfsg1/import/opengl.d 2007-08-29 19:46:56.000000000 +0200
@@ -1116,7 +1116,7 @@
/*************************************************************/
void /*APIENTRY*/glAccum (GLenum op, GLfloat value);
-void /*APIENTRY*/glAlphaFunc (GLenum func, GLclampf ref);
+void /*APIENTRY*/glAlphaFunc (GLenum func, GLclampf ref_);
GLboolean /*APIENTRY*/glAreTexturesResident (GLsizei n, GLuint *textures, GLboolean *residences);
void /*APIENTRY*/glArrayElement (GLint i);
void /*APIENTRY*/glBegin (GLenum mode);
@@ -1369,7 +1369,7 @@
void /*APIENTRY*/glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
void /*APIENTRY*/glSelectBuffer (GLsizei size, GLuint *buffer);
void /*APIENTRY*/glShadeModel (GLenum mode);
-void /*APIENTRY*/glStencilFunc (GLenum func, GLint ref, GLuint mask);
+void /*APIENTRY*/glStencilFunc (GLenum func, GLint ref_, GLuint mask);
void /*APIENTRY*/glStencilMask (GLuint mask);
void /*APIENTRY*/glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
void /*APIENTRY*/glTexCoord1d (GLdouble s);