// // EWaving::GetVelocity // EVec4 EWaving::GetVelocity( const EVec4 &init_pos ) const { return EVec4(0,0,0,0); point_wave_s pw0 = GetWave( init_pos.x, init_pos.y, -init_pos.z, time, WAVE_BAND_NUM ); point_wave_s pw1 = GetWave( init_pos.x, init_pos.y, -init_pos.z, time + 0.1, WAVE_BAND_NUM ); EVec4 p0 = EVec4(pw0.horizontal_offset, pw0.offset, 0, 1); EVec4 p1 = EVec4(pw1.horizontal_offset, pw1.offset, 0, 1); return 0.7*(p0 - p1) / 0.1; }
static Mix_Chunk* Get_Mix_Chunk(VALUE obj) { Wave* wave = GetWave(obj); if(wave->chunk == NULL) rb_raise(eSDLError, "Wave data is already disposed"); return wave->chunk; }
// // EWaving::GetPressure // float EWaving::GetPressure( const EVec4 &pos ) const { float gx = pos.x - WAVE_GRID_OFFSET_X; float gy = pos.y - WAVE_GRID_OFFSET_Y; int ix = (int)floor(gx); // integer part int iy = (int)floor(gy); // integer part float fx = gx - floor(gx); // fractional part float fy = gy - floor(gy); // fractional part float cx = floor(pos.x) + 0.5; float cy = floor(pos.y) + 0.5; ix = clamp<int>(ix, 0, WAVE_GRID_SIZE-1); iy = clamp<int>(iy, 0, WAVE_GRID_SIZE-1); point_wave_s pw = GetWave( pos.x, pos.y, -pos.z, time ); return pw.pressure; #if 0 if (wave_grid[ix][iy].dirty) { wave_sample_s *ws = &wave_grid[ix][iy]; point_wave_s pw = GetWave( cx, cy, 0, time ); ws->zoffset = pw.offset; ws->dirty = false; rs()->GetDVScene()->DrawPoint( EVec4(cx, cy, pw.offset, 1), 0.33f, EVec4(0,0,1,1) ); } float zoffset = wave_grid[ix][iy].zoffset; float depth = -pos.z; if (pos.z>zoffset) { return 0; } else { float ps = (depth) * WATER_DENSITY * GRAVITY; float fade = (depth<0) ? 1 : exp( - 0.5f * depth ); // 'great' approximation float pd = fade * zoffset * WATER_DENSITY * GRAVITY; return ps + pd; } #endif return 0; }
//BOSS顔 void CEnemy8::Move() { Position += Velocity; //Texture = GetTexture(L"boss_kao1.png"); //if (Time % 300 == 0) //左向き if (BSST == 0){ /*if (kao == 0){ Scale = CVector(1.2f, 1, 1)*0.27f; Position = Owner->Position + CVector(0.04, 0.89f, 0); }*/ /*if (Time % 120 == 0){ Position.X -= 0.6f; Position += Velocity; }*/ if (Time % 120 == 20)Texture = GetTexture(L"boss_kao1.png"); if (Time % 120 == 40)Texture = GetTexture(L"boss_kao2.png"); if (Time % 120 == 60)Texture = GetTexture(L"boss_kao3.png"); if (Time % 120 == 80)Texture = GetTexture(L"boss_kao4.png"); if (Time % 120 == 100)Texture = GetTexture(L"boss_kao5.png"); if (Time % 120 == 120)Texture = GetTexture(L"boss_kao6.png"); Time++; } //右向き if (BSST == 1){ //Scale = CVector(1.2f, 1, 1)*0.27f; //Position = Owner->Position + CVector(-0.04, 0.89f, 0); if (Time % 120 == 20)Texture = GetTexture(L"boss_kao1R.png"); if (Time % 120 == 40)Texture = GetTexture(L"boss_kao2R.png"); if (Time % 120 == 60)Texture = GetTexture(L"boss_kao3R.png"); if (Time % 120 == 80)Texture = GetTexture(L"boss_kao4R.png"); if (Time % 120 == 100)Texture = GetTexture(L"boss_kao5R.png"); if (Time % 120 == 120)Texture = GetTexture(L"boss_kao6R.png"); Time++; } if (Type == 1) { //頭飛ばす変数 if (atama == 0){ if (Time % 420 == 0){ Color = CColor(1, 0, 0, 1); if (Time % 60 == 0)atama = 1; Time++; } } if (State == 0) { Position = Owner->Position + CVector(0, 0.59f, 0); if (atama==1){ KM = 0, State = 1; atama = 0; } } if (State == 1) {//飛んでく頭 MyShipList.Apply([&](CMover* m) { Position += Normalize(m->Position - Position)*0.04f; KM++; BOSSC = 1; if (KM == 60) State = 2; New<CEffect20>(Position); //飛んでいく頭の音(シュビビビビーン) GetWave(L"se_maoudamashii_battle02.wav")->Play(1); GetWave(L"se_maoudamashii_battle02.wav")->SetVolume(0.02f); }); } if (State == 2) {//戻ってくるスピード CVector target = Owner->Position + CVector(0, 0.59f, 0); Position += Normalize(target - Position)*0.05f; if (Length(target - Position)<0.02f) State = 0; BOSSC = 0; New<CEffect20>(Position); Color = CColor(1, 1, 1, 1); } } //BOSS顔接触時ダメージ MyShipList.Apply([&](CMover* m) { if (Length(m->Position - Position)<0.44f) { m->Life -= wp; } }); //攻撃判定透明化 if (MutekiTime1 == 0) { WeaponList.Apply([&](CMover* e) { if (Length(Position - e->Position) < 0.5f) { //Life--; MutekiTime1 = 1; MutekiTime = 1; Color.A = 0.7f; } }); if (MutekiTime1 == 1)MutekiTime1 = 0; } if (MutekiTime1 == 0) { Weapon2List.Apply([&](CMover* e) { if (Length(Position - e->Position) < 0.4f) { //Life--; MutekiTime1 = 1; MutekiTime = 1; Color.A = 0.7f; } }); if (MutekiTime1 == 1)MutekiTime1 = 0; } if (MutekiTime1 == 0) { Weapon7List.Apply([&](CMover* e) { if (Length(Position - e->Position) < 0.4f) { //Life--; MutekiTime1 = 1; MutekiTime = 1; Color.A = 0.7f; } }); if (MutekiTime1 == 1)MutekiTime1 = 0; } CHitRectangle hit; Apply(Block14List, hit); Apply(Block15List, hit); Apply(Block2List, hit); Apply(Block6List, hit); Apply(Block7List, hit); }
//=====================================================BOSS体================================================================================================ void CEnemy2::Move() { Scale = CVector(1.1f, 1, 1)*0.35f; Velocity.Y -= 0.005f; //左向き if (Bst == 0){ //if (Time % 140 == 0)New<CWeapon6>(Position, CVector(-0.15f, 0.3f, 0)); //if (Time % 140 == 0)New<CWeapon6>(Position, CVector(-0.15f, 0.0f, 0)); //Time++; Position.X -= 0.007f; Position += Velocity; if (Time % 300 == 0){ //移動時JUMP(ガッコン) GetWave(L"se_maoudamashii_se_sound09.wav")->Play(1); GetWave(L"se_maoudamashii_se_sound09.wav")->SetVolume(0.07f); Velocity.Y += 0.07f; Position += Velocity; } if (Time % 125 == 20)Texture = GetTexture(L"boss_karada1.png"); if (Time % 125 == 40)Texture = GetTexture(L"boss_karada2.png"); if (Time % 125 == 60)Texture = GetTexture(L"boss_karada3.png"); if (Time % 125 == 80)Texture = GetTexture(L"boss_karada4.png"); if (Time % 125 == 100)Texture = GetTexture(L"boss_karada5.png"); if (Time % 125 == 120)Texture = GetTexture(L"boss_karada6.png"); Time++; } //右向き if (Bst == 1){ //if (Time % 140 == 0)New<CWeapon6>(Position, CVector(0.15f, 0.3f, 0)); //if (Time % 140 == 0)New<CWeapon6>(Position, CVector(0.15f, 0.0f, 0)); //Time++; Position.X += 0.007f; Position += Velocity; if (Time % 300 == 0){ //移動時JUMP(ガッコン) GetWave(L"se_maoudamashii_se_sound09.wav")->Play(1); GetWave(L"se_maoudamashii_se_sound09.wav")->SetVolume(0.07f); Velocity.Y += 0.07f; Position += Velocity; } if (Time % 120 == 20)Texture = GetTexture(L"boss_karada1R.png"); if (Time % 120 == 40)Texture = GetTexture(L"boss_karada2R.png"); if (Time % 120 == 60)Texture = GetTexture(L"boss_karada3R.png"); if (Time % 120 == 80)Texture = GetTexture(L"boss_karada4R.png"); if (Time % 120 == 100)Texture = GetTexture(L"boss_karada5R.png"); if (Time % 120 == 120)Texture = GetTexture(L"boss_karada6R.png"); Time++; } /*if(ATP==0){ if (Time % 180 == 0){ Enemy8List.Apply([&](CMover* b) { b->Color = CColor(1, 1, 1, 1.0f); //b->Life = 0; }); } ATP = 1; } if (ATP == 1){ if (Time % 240 == 0){ Enemy8List.Apply([&](CMover* b) { b->Color = CColor(1, 1, 1, 1.0f); }); } ATP = 0; }*/ CHitRectangle hit; Apply(BlockList, hit); Apply(Block1List, hit); Apply(Block2List, hit); Apply(Block3List, hit); Apply(Block6List, hit); Apply(Block7List, hit); Apply(Block8List, hit); Apply(Block9List, hit); Apply(Block10List, hit); Apply(Block11List, hit); Apply(Block12List, hit); Apply(Block13List, hit); Apply(Block14List, hit); Apply(Block15List, hit); Apply(Block16List, hit); Apply(Block17List, hit); Apply(Block18List, hit); Apply(Block19List, hit); Apply(Block20List, hit); Apply(Block22List, hit); Apply(Block23List, hit); Apply(Block28List, hit); Apply(Block29List, hit); //Apply(Block30List, hit); Block30List.Apply([&](CMover* b) {//ブロック接触 if (Length(Position - b->Position) <0.6f) { Color.A = 0.9f; Bst = 1; BSST = 1; } }); Block31List.Apply([&](CMover* b) {//ブロック接触 if (Length(Position - b->Position) < 0.6f) { Color.A = 0.9f; Bst = 0; BSST = 0; } }); }
static VALUE Wave_create(Mix_Chunk* chunk) { VALUE newobj = Wave_s_alloc(cWave); GetWave(newobj)->chunk = chunk; return newobj; }
// // EWaving::GetPositionAtTime // EVec4 EWaving::GetPositionAtTime( const EVec4 &init_pos, float time ) const { point_wave_s pw = GetWave(init_pos.x, init_pos.y, -init_pos.z, time); return EVec4( init_pos.x, init_pos.y, init_pos.z + pw.offset, 1 ); }