projectL_1001/ 0000755 0000000 0000000 00000000000 10740417365 012006 5 ustar root root projectL_1001/lib/ 0000755 0000000 0000000 00000000000 10740417365 012554 5 ustar root root projectL_1001/music/ 0000755 0000000 0000000 00000000000 10740417365 013126 5 ustar root root projectL_1001/se/ 0000755 0000000 0000000 00000000000 10740417365 012415 5 ustar root root projectL_1001/build.xml 0000644 0000000 0000000 00000004554 10537067164 013641 0 ustar root root
projectL_1001/src/ 0000755 0000000 0000000 00000000000 10557123226 012571 5 ustar root root projectL_1001/src/br/ 0000755 0000000 0000000 00000000000 10740417365 013200 5 ustar root root projectL_1001/src/br/append.d 0000644 0000000 0000000 00000006027 10534363270 014615 0 ustar root root module br.append;
private import opengl;
private import util.key;
private import util.shape;
private import br.mainloop;
private import util.vector;
private import util.matrix;
private import std.math;
private import br.ship;
private import br.enemy;
private import br.gamemanager;
private import util.particle;
private import util.parts;
private import util.log;
public class Append:Parts{
private:
int vanishCount;
bool parentExist;
public this(Shape shape ,double size ,double R = 1.0,double G = 1.0 ,double B = 1.0,double alpha = 1.0 ,Matrix poseBase = new Matrix()){
this.shape = cast(Shape)shape.clone();
drawing = WIRE;
this.size = size;
setPoseBase(poseBase);
// appendManager.add(this);
this.R = R;
this.G = G;
this.B = B;
this.alpha = alpha;
parentExist = true;
}
public void setCollision(double collisionSize){
collisionManager.add(this, collisionManager.kind.SHIP ,2);
collisionManager.add(this, collisionManager.kind.SWORD ,2);
this.collisionRange = collisionSize;
drawing = POLYGON | WIRE;
}
public void move(){
super.move();
if(parentExist & (parent is null || parent.exists == false)){
parentExist = false;
vanishCount = 5;
}
if(parentExist == false){
vanishCount --;
if(vanishCount < 0)destroy();
}
}
public void destroy(){
super.destroy();
makeParticle(shape, size ,WIRE ,rpos ,new Vector3() ,rpose ,R ,G ,B ,alpha);
}
}
/+
public class BaseOfWing:Parts{
private{
static float[][] a =
[
[-0.2 ,0 ,0.2 ],
[-0.2 ,0 ,0.2 ]
];
static float[][] b =
[
[0 ,0.5 ,0 ],
[0 ,1.0 ,0 ]
];
}
public this(){
shape = BaseOfWing1.getShape();//new SH_Pole(a,b,4);
drawing = WIRE;
size = 30;
}
}
public class Wing:Parts{
private{
static float[][] a =
[
[-1.0 ,-0.5 ,1.0 ],
];
static float[][] b =
[
[0 ,0.5 ,0 ]
];
}
public this(){
/*
Shape shape1 = new SH_Pole(a,b,4);
Shape shape2 = cast(SH_Pole)shape1.clone();
shape1.translate(new Vector3(0.1 ,0 ,0));
shape2.translate(new Vector3(-0.1 ,0 ,0));
shape = shape1 + shape2;
*/
shape = Wing1.getShape();//new SH_Pole(a,b,4);
//shape.translate(new Vector3(1.0 ,0 ,0));
drawing = WIRE;
size = 20;
}
}
public class Tail:Parts{
private{
static float[][] a =
[
[-1.0 ,-0.5 ,1.0 ],
];
static float[][] b =
[
[0 ,0.5 ,0 ]
];
}
public this(){
shape = Tail1.getShape();//new SH_Pole(a,b,4);
drawing = WIRE;
size = 20;
}
}
public class Head:Parts{
private{
static float[] a =
[-1.0 ,-0.5 ,1.0 ,-0.5 ]
;
static float[] b =
[0 ,0.5 ,0 ,-0.5 ]
;
static float[] z =
[-0.5 ,0 ,0.5];
static float[] scale =
[0.3 ,1.0 ,0.3];
}
public this(){
shape = Head1.getShape();//new SH_Pot(a,b,z,scale);
drawing = WIRE;
size = 30;
}
}
+/ projectL_1001/src/br/gamemanager.d 0000644 0000000 0000000 00000061470 10542750232 015612 0 ustar root root module br.gamemanager;
private import opengl;
private import SDL;
private import SDL_mixer;
private import std.string;
private import std.math;
private import util.key;
private import util.vector;
private import util.matrix;
private import util.rand;
private import util.collision;
private import util.animation;
private import util.parts;
private import util.particle;
private import util.timer;
private import util.log;
private import util.record;
private import util.ascii;
private import br.append;
private import br.ship;
private import br.blast;
private import br.mainloop;
private import br.enemy;
private import br.screen;
private import br.stage;
private import br.background;
private import br.sound;
private import br.prefmanager;
public Ship ship;
public Rand rand;
public Screen screen;
//public Blast blast;
public CollisionManager collisionManager;
public PartsManager shipManager;
public PartsManager enemyManager;
public PartsManager bulletManager;
public PartsManager ringManager;
//public PartsManager appendManager;
public BackGround background;
private const int MAXSHIP = 10;
private const int DEFAULTSTAGE = 1;
private GameManager gameManager;
private GameState inGameState;
private GameState inResultState;
private GameState inMissState;
private GameState inTitleState;
private GameState inEnding1State;
private GameState inEnding2State;
private int stageNum;
private Stage stage;
private int totalTime;
private int lapTime;
private int restShip;
public bool pressingA;
public class GameManager{
public:
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_BPP = 0;
/*
static int g_videoFlags = SDL_SWSURFACE|SDL_OPENGL;
// const SDL_VideoInfo* info = NULL;
SDL_Surface *gScreenSurface;
*/
//int screen_width;
//int screen_height;
//int screen_bpp;
static int count;
private:
GameState state;
GameState nextState;
//Parts[10] append;
Key key;
public this(Key key){
this.key = key;
gameManager = this;
}
public void start(){
rand = new Rand();
screen = new Screen();
// blast = new Blast();
partsManager = new PartsManager(512);
shipManager = new PartsManager(10);
enemyManager = new PartsManager(128);
bulletManager = new PartsManager(512);
ringManager = new PartsManager(64);
// appendManager = new PartsManager(128);
blastManager = new BlastManager(128);
particleManager = new ParticleManager(2048);
// animationManager = new AnimationManager(64);
collisionManager = new CollisionManager(1024);
collisionManager.clear();
ship = new Ship(key,0 ,0);//screen.width / 2,screen.height / 2);
background = new BackGround();
// record = new Record(Stage.MAXSTAGE ,3);
if(prefManager.prefData.fullScreen){
screen.toggleFullScreen();
}
nosound(prefManager.prefData.nosound);
count = 0;
totalTime = 0;
lapTime = 0;
Sound_init();
/*
Mix_OpenAudio(22050,AUDIO_S16,2,4096);
chunk_slash = Mix_LoadWAV("se/hit_s02.wav");
chunk_defend = Mix_LoadWAV("se/metal34_a.wav");
chunk_bomb = Mix_LoadWAV("se/bom13_c.wav");
chunk_beep = Mix_LoadWAV("se/beep00.wav");
chunk_warning = Mix_LoadWAV("se/emergency.wav");
chunk_reverse = Mix_LoadWAV("se/hit_s03_a.wav");
if(Mix_OpenAudio(22050,AUDIO_S16,2,4096) < 0)return ;
music1 = Mix_LoadMUS("music/FREQ_loop005.ogg");
music2 = Mix_LoadMUS("music/FREQ_loop004.ogg");
*/
inGameState = new InGameState();
inResultState = new InResultState();
inMissState = new InMissState();
inTitleState = new InTitleState();
inEnding1State = new InEnding1State();
inEnding2State = new InEnding2State();
state = inTitleState;
state.start();
nextState = null;
pressingA = true;
/*
if (Mix_PlayMusic(music, -1) != 0) {
throw new Error("Couldn't play music");
}
*/
}
public void move(){
state.move();
if(nextState !is null){
state = nextState;
state.start();
nextState = null;
}
count ++;
}
public void returnPushed(){
setNextState("titleState");
}
public void setNextState(char[] name){
switch(name){
case "gameState":nextState = inGameState;break;
case "resultState":nextState = inResultState;break;
case "missState":nextState = inMissState;break;
case "titleState":nextState = inTitleState;break;
case "ending1State":nextState = inEnding1State;break;
case "ending2State":nextState = inEnding2State;break;
default:break;
}
}
public void draw(){
// glClear(GL_DEPTH_BUFFER_BIT);
state.draw();
}
public void clear(){
shipManager.clear();
enemyManager.clear();
bulletManager.clear();
ringManager.clear();
partsManager.clear();
// animationManager.clear();
shipManager.clear();
enemyManager.clear();
bulletManager.clear();
collisionManager.clear();
}
public void close(){
clear();
Sound_free();
Mix_CloseAudio();
}
}
private bool setStage(int num){
bool game = true;
stageNum = 1;
if(num <= Stage.MAXSTAGE)stageNum = num;
else{
stageNum = 9;
game = false;
}
stage = getStage(stageNum);
stage.goback();
if(stage !is null)Sound_PlayMusic(stage.music);
return game;
}
private Stage getStage(int num){
Stage stage;
switch(num){
case 1:stage = new Stage1();break;
case 2:stage = new Stage2();break;
case 3:stage = new Stage3();break;
case 4:stage = new Stage4();break;
case 5:stage = new Stage5();break;
case 6:stage = new Stage6();break;
case 7:stage = new Stage7();break;
case 8:stage = new Stage8();break;
case 9:stage = new Ending();break;
default:stage = null;
}
return stage;
}
public abstract class GameState{
protected:
// bool _end;
public void start();
public void move();
public void draw();
// public bool end();
public char[] name();
}
public class InGameState:GameState{
private:
int count;
const char[] _name = "gameState";
public this(){
}
public void start(){
count = 0;
// timer = 0;
// _end = false;
}
public void move(){
collisionManager.collisionDetect();
if(stage.cleared){
// stageNum ++;
gameManager.setNextState("resultState");
// _end = true;
}
if((cast(Ship)ship).slow){
if(count % 2==0){
blastManager.run();
partsManager.move();
/*
shipManager.move();
enemyManager.move();
bulletManager.move();
ringManager.move();
*/
// appendManager.move();
// animationManager.run();
stage.run();
background.move();
particleManager.run();
// timer++;
}else shipManager.move();
}else{
blastManager.run();
partsManager.move();
// shipManager.move();
/*
enemyManager.move();
bulletManager.move();
ringManager.move();
// appendManager.move();
*/
// animationManager.run();
stage.run();
background.move();
particleManager.run();
// timer++;
}
if(ship.miss){
gameManager.setNextState("missState");
ship.miss = false;
}
count ++;
lapTime ++;
totalTime ++;
}
public void draw(){
screen.setProjection();
glPushMatrix();
background.draw();
partsManager.draw();
/*
shipManager.draw();
enemyManager.draw();
bulletManager.draw();
ringManager.draw();
// appendManager.draw();
*/
particleManager.draw();
blastManager.draw();
// if(blast.exists)blast.draw();
screen.setModelView();
asciiR = 1.0;asciiG =0.88;asciiB = 0.7;
drawTimer(lapTime ,60 ,-268 ,0.6);
drawTimer(totalTime ,200 ,-260);
stage.draw();
// drawString("ready to destroy the warp hole" ,-300 ,-100 ,5 ,10);
/*
drawAlphabet('n' ,-350 ,50 );
drawAlphabet('e' ,-320 ,50 );
drawAlphabet('w' ,-290 ,50 );
*/
/*
drawAlphabet('p' ,0 ,20 ,1.0);
drawAlphabet('r' ,30 ,20 ,1.0);
drawAlphabet('o' ,60 ,20 ,1.0);_________
drawAlphabet('j' ,90 ,20 ,1.0);
drawAlphabet('e' ,120 ,20 ,1.0);
drawAlphabet('c' ,150 ,20 ,1.0);
drawAlphabet('t' ,180 ,20 ,1.0);
drawAlphabet('l' ,220 ,20 ,1.0);
*/
// drawNumber((count / 60) % 10 ,300 ,-260);
// drawColon(320 ,-260);
glPopMatrix();
}
/*
public bool end(){
return _end;
}
*/
public char[] name(){
return _name;
}
}
public class InResultState:GameState{
private:
int count;
int lapRank ,totalRank;
protected const char[] _name = "resultState";
public this(){
lapRank = -1;
totalRank = -1;
}
public void start(){
count = 0;
// _end = false;
lapRank = prefManager.prefData.record.updateLapRecord(stageNum-1 ,lapTime);
totalRank = prefManager.prefData.record.updateTotalRecord(stageNum-1 ,totalTime);
Stage next = getStage(stageNum+1);
// Log_write(stageNum + 1);
// Log_write(Sound_PlayingMusic);
// if(next !is null)Log_write(next.music);
// Log_write(next.music);
// Log_write(Sound_PlayingMusic);
if(next !is null){
if(next.music != Sound_PlayingMusic && Sound_PlayingMusic != -1){
Sound_FadeOutMusic(2000);
}
}
}
public void move(){
if(240 < count){
// _end = true;
lapTime = 0;
if(setStage(stageNum + 1))gameManager.setNextState("gameState");
else gameManager.setNextState("ending1State");
}
if((cast(Ship)ship).sword){
if(count % 2==0){
blastManager.run();
partsManager.move();
/*
shipManager.move();
enemyManager.move();
bulletManager.move();
ringManager.move();
*/
// appendManager.move();
background.move();
particleManager.run();
}else shipManager.move();
}else{
/*
shipManager.move();
enemyManager.move();
bulletManager.move();
ringManager.move();
*/
// appendManager.move();
blastManager.run();
partsManager.move();
// stage.run();
background.move();
particleManager.run();
// timer++;
}
count ++;
}
public void draw(){
screen.setProjection();
background.draw();
/*
shipManager.draw();
enemyManager.draw();
bulletManager.draw();
ringManager.draw();
// appendManager.draw();
*/
partsManager.draw();
particleManager.draw();
blastManager.draw();
screen.setModelView();
/*
for(int i=0;i 4930){
// stageNum ++;
gameManager.setNextState("titleState");
// _end = true;
}
int button = gameManager.key.getButtonState();
if(((button & gameManager.key.Button.A) == 0)){
pressingA = false;
if(count % 2==0){
timer++;
}
}else{
pressingA = true;
timer++;
}
count ++;
}
public void draw(){
screen.setProjection();
glPushMatrix();
screen.setModelView();
drawStaffRoll();
glPopMatrix();
}
public void drawStaffRoll(){
asciiR = 1.0;asciiG = 1.0;asciiB = 0.9;asciiAlpha=1.0;
int y;
y=timer*2 - 330;asciiAlpha = (300.0 - abs(y)) / 300.0;
if(-330 < y && y < 330)drawStringCenter("projectL staff" ,y);
y=timer*2 - 930;asciiAlpha = (300.0 - abs(y)) / 300.0;
if(-330 < y && y < 330)drawStringCenter("all" ,y);
y=timer*2 - 1030;asciiAlpha = (300.0 - abs(y)) / 300.0;
if(-330 < y && y < 330)drawStringCenter("hiz" ,y);
y=timer*2 - 1630;asciiAlpha = (300.0 - abs(y)) / 300.0;
if(-330 < y && y < 330)drawStringCenter("inspired by" ,y);
y=timer*2 - 1730;asciiAlpha = (300.0 - abs(y)) / 300.0;
if(-330 < y && y < 330)drawStringCenter("project N" ,y);
y=timer*2 - 1790;asciiAlpha = (300.0 - abs(y)) / 300.0;
if(-330 < y && y < 330)drawStringCenter("developed by D.K" ,y);
y=timer*2 - 2390;asciiAlpha = (300.0 - abs(y)) / 300.0;
if(-330 < y && y < 330)drawStringCenter("adviced by" ,y);
y=timer*2 - 2490;asciiAlpha = (300.0 - abs(y)) / 300.0;
if(-330 < y && y < 330)drawStringCenter("D.K" ,y);
y=timer*2 - 2550;asciiAlpha = (300.0 - abs(y)) / 300.0;
if(-330 < y && y < 330)drawStringCenter("and gamehell 2000" ,y);
y=timer*2 - 3150;asciiAlpha = (300.0 - abs(y)) / 300.0;
if(-330 < y && y < 330)drawStringCenter("sound materials" ,y);
y=timer*2 - 3250;asciiAlpha = (300.0 - abs(y)) / 300.0;
if(-330 < y && y < 330)drawStringCenter("B.P.M" ,y);
y=timer*2 - 3310;asciiAlpha = (300.0 - abs(y)) / 300.0;
if(-330 < y && y < 330)drawStringCenter("FLESH AND BONE" ,y);
y=timer*2 - 3370;asciiAlpha = (300.0 - abs(y)) / 300.0;
if(-330 < y && y < 330)drawStringCenter("THE MATCHMAKERS" ,y);
y=timer*2 - 3430;asciiAlpha = (300.0 - abs(y)) / 300.0;
if(-330 < y && y < 330)drawStringCenter("Hanac200x" ,y);
y=cast(int)fmin(0.0 ,timer*2.0 - 4030.0);asciiAlpha = (300.0 - abs(y)) / 300.0;
if(timer*2 > 4810)asciiAlpha = 1.0 -(timer*2.0 -4810.0) /120.0;
if(-330 < y && y < 330)drawStringCenter("THANKS FOR YOUR PLAYING" ,y);
}
public char[] name(){
return _name;
}
}
projectL_1001/src/br/bullet.d 0000644 0000000 0000000 00000013367 10541600004 014625 0 ustar root root module br.bullet;
private import util.parts;
private import util.shape;
private import util.vector;
private import util.matrix;
private import util.log;
private import util.particle;
private import util.basis;
private import br.gamemanager;
private import br.blast;
private import std.math;
private import SDL_mixer;
private import br.sound;
public class Bullet:Parts{
private bool inStage;
public this(bool breakable){
collisionManager.add(this ,collisionManager.kind.SHIP ,2);
bulletManager.add(this);
if(breakable){
collisionManager.add(this, collisionManager.kind.LASER ,2);
R = 160.0 / 255.0;
G = 247.0 / 255.0;
B = 150.0 / 255.0;
}else{
R = 245.0 / 255.0;
G = 104.0 / 255.0;
B = 110.0 / 255.0;
}
inStage = false;
drawing = POLYGON | WIRE;
alpha = 1.6;
}
public void addChild(inout Parts child,char[] name, double dist = 0.1, int childKind = NORMAL, Matrix link = null ,Matrix pose = null){
super.addChild(child ,name ,dist ,childKind ,link ,pose);
bulletManager.add(child);
}
public void move(){
super.move();
if((rpos.y+size < screen.GAME_DOWN || screen.GAME_UP < rpos.y-size ||
screen.GAME_RIGHT < rpos.x-size || rpos.x+size < screen.GAME_LEFT
)){
if(inStage || 300 < cnt )vanish();
}else inStage = true;
if(screen.GAME_NEAR < rpos.z - size || rpos.z + size < screen.GAME_FAR){
vanish();
}
}
public void destroy(){
super.destroy();
new SmallBlast(rpos.x ,rpos.y ,30 ,30 ,5.0 ,90 ,R ,G ,B ,0.02);
// makeParticle(shape, size ,WIRE ,rpos ,new Vector3() ,rpose ,R ,G ,B ,alpha * 0.5);
makeSimpleParticle(2 ,size ,WIRE ,rpos ,R ,G ,B ,alpha * 0.5);
}
public override void reportCollision(int kind){
destroy();
Sound_PlaySe(se_kind.REVERSE);
// Mix_PlayChannel(0, chunk_reverse, 0);
}
public void vanish(){
super.vanish();
}
}
public class StraightBullet:Bullet{
static Shape baseShape;
static float[][] a =
[
[-2.0 ,0.0 ,1.0]
];
static float[][] b =
[
[0.0 ,1.0 ,0.0]
];
double aim;
double speed;
public this(Vector3 v ,bool breakable, double aim ,double speed = 4.0){
super(breakable);
if(baseShape is null){
baseShape = new SH_Pole(a ,b ,4);
}
// setPoseBase(matRotateZ(aim / PI * 180.0));
//collisionManager.add(this ,collisionManager.kind.BULLET ,2);
shape = new SH_Pole(a ,b ,4);
size = 17;
collisionRange = 8;
this.speed = speed;
pos = cast(Vector3)v.clone();
rpos = cast(Vector3)pos.clone();
this.aim = aim;
}
public void move(){
super.move();
if(parent is null){
pos.x += speed * cos(aim);
pos.y += speed * sin(aim);
}
poseZ = aim / PI * 180.0;
}
}
public class SlowStraightBullet:StraightBullet{
public this(Vector3 v ,bool breakable, double aim){
super(v ,breakable ,aim);
speed = 1.5;
}
}
public class EBullet2:StraightBullet{
public this(Vector3 v ,bool breakable,double aim){
super(v ,breakable ,aim);
Parts b = new StraightBullet(v ,breakable ,aim);
addChild(b ,"bul" ,40 ,FOLLOW);
Parts b2 = new StraightBullet(v ,breakable, aim);
b.addChild(b2 ,"bul" ,40 ,FOLLOW);
}
}
public class Bullet3D:StraightBullet{
public this(Vector3 v ,bool breakable,double aim ,double speed){
super(v ,breakable ,aim ,speed);
}
public void move(){
if(rpos.z < -800 - 2)pos.z +=2.0;
else if(-800 + 2 < rpos.z)pos.z -= 2.0;
else {
super.move();
}
poseZ = aim / PI * 180.0;
}
}
public class Bullet3D2:Bullet{
static Shape baseShape;
static float[][] a =
[
[-1.0 ,0.0 ,1.0]
];
static float[][] b =
[
[0.0 ,1.0 ,0.0]
];
Vector3 aim;
public this(Vector3 v ,bool breakable,Vector3 aim){
super(breakable);
if(baseShape is null){
baseShape = new SH_Pole(a ,b ,4);
}
// setPoseBase(matRotateZ(aim / PI * 180.0));
//collisionManager.add(this ,collisionManager.kind.BULLET ,2);
shape = new SH_Pole(a ,b ,4);
size = 25;
collisionRange = 12;
pos = cast(Vector3)v.clone();
rpos = cast(Vector3)pos.clone();
this.aim = cast(Vector3)aim.clone();
}
public void move(){
super.move();
pos += aim;
poseZ += 1.0;
}
}
public class BendBullet:StraightBullet{
private:
double bendAim;
int bendTime;
double afSpeed;
public this(Vector3 v ,bool breakable,double aim ,double bendAim ,int bendTime,double speed = 4.0 ,double afSpeed = 4.0){
super(v ,breakable ,aim ,speed);
this.bendAim = bendAim;
this.bendTime = bendTime;
this.afSpeed = afSpeed;
}
public void move(){
super.move();
if(cnt == bendTime){
aim += bendAim;
speed = afSpeed;
}
// poseZ = aim/PI*180.0;
}
}
public class AccBullet:StraightBullet{
double maxSpeed ,accSpeed;
public this(Vector3 v ,bool breakable,double aim ,double min ,double max ,double acc){
super(v ,breakable ,aim ,min);
maxSpeed = max;
accSpeed = acc;
}
public void move(){
super.move();
if(speed < maxSpeed)speed += accSpeed;
else speed = maxSpeed;
}
}
public class HomingBullet:StraightBullet{
private:
double dAim;
// int bendTime;
// double afSpeed;
public this(Vector3 v ,bool breakable,double aim ,double dAim = PI / 90.0,double speed = 4.0 ,int num = 1){
super(v ,breakable ,aim ,speed);
this.dAim = dAim;
num--;
if(0