Exemple #1
0
KaeruKing::KaeruKing(int rXPx, int rYPx)
{

	KAERUKSX = GI("KAERUKSX");
	KAERUKSY = GI("KAERUKSY");

	KTAIKI_TIME = GF("KTAIKI_TIME");
	KJUMPSTART_TIME = GF("KJUMPSTART_TIME");
	KJMPSPX = GF("KJMPSPX");
	KJMPTAKASA = GF("KJMPTAKASA");

	mX = rXPx;
	mY = rYPx - sMapAtHanteiY[0][0] + SP->CHSZY;

	mSizeX = KAERUKSX;
	mSizeY = KAERUKSY;

	mStatus		= JUMP;

	mTaikiTimer = 0.0f;

	mCurAshiba = NULL;

	// 当たり判定
	AddFrame(0);
	AddCircle(0, SP->GRID_BOGYO, 44, 44, 44);
	AddIndexedRect(0, SP->GRID_BOUND, TBOUND_IDX, 10, 12, 73, 85);
	SetCurFrame(0);
}
RollingApple::RollingApple(int rXPx, int rYPx, int rType) : Apple( rXPx, rYPx )
{
	APPLE_RLSP = GF("APPLE_RLSP");
	APPLE_KTSP = GF("APPLE_KTSP");

	mStatus = FALL;
	mType = rType;
}
Exemple #3
0
Apple::Apple(int rXPx, int rYPx)
{

	APPLESZX = GI("APPLESZX");
	APPLESZY = GI("APPLESZY");

	APPLE_BRTM = GF("APPLE_BRTM");

	mSizeX = APPLESZX;
	mSizeY = APPLESZY;

	mX = rXPx;
	mY = rYPx;
	mZ = 1.0f;

	mNo = 0;
	mTimer = 0.0f;
	mBaseStatus = NORMAL;

	// あたり判定
	AddFrame(FR_NORMAL);
	AddCircle(FR_NORMAL, SP->GRID_BOGYO, 20, 20, 15);

	AddFrame(FR_DISABLE);

	SetCurFrame(FR_DISABLE);

}
KariudoKen::KariudoKen(int rXPx, int rYPx)
{

	KARIKENSX = GI("KARIKENSX");
	KARIKENSY = GI("KARIKENSY");

	KARIKENSPX = GF("KARIKENSPX");
	KARIKENKGHANI = GF("KARIKENKGHANI");
	KARIKENWTM1 = GF("KARIKENWTM1");
	KARIKENWTM2 = GF("KARIKENWTM2");

	mX = rXPx;
	mY = rYPx - sMapAtHanteiY[0][0] + SP->CHSZY;

	mSizeX = KARIKENSX;
	mSizeY = KARIKENSY;

	mStatus = ARUKI;

	mKgTimer = 0.0f;

	mSeFl = false;

	// 当たり判定	
	AddFrame(FR_KAMAE);
	AddFrame(FR_ZANZOU);
	AddFrame(FR_DOWN);

	AddRect(FR_KAMAE, SP->GRID_BOGYO, 43, 33, 81, 119);
	AddIndexedRect( FR_KAMAE, SP->GRID_BOUND, TBOUND_IDX, 38, 22, 83, 120);
	
	AddRect(FR_ZANZOU, SP->GRID_BOGYO, 43, 33, 81, 119);
	AddCircle(FR_ZANZOU, SP->GRID_KOUGEKI, 38, 43, 35);
	AddCircle(FR_ZANZOU, SP->GRID_KOUGEKI, 33, 69, 35);
	AddIndexedRect( FR_ZANZOU, SP->GRID_BOUND, TBOUND_IDX, 38, 22, 83, 120);

	AddRect(FR_DOWN, SP->GRID_BOGYO, 43, 33, 81, 119);
	AddCircle(FR_DOWN, SP->GRID_BOGYO, 20, 62, 11);
	AddIndexedRect( FR_DOWN, SP->GRID_BOUND, TBOUND_IDX, 38, 22, 83, 120);

	//AddCircle(0, GRID_BOGYO, 60, 60, 30);

	SetAnim(0);
}
Exemple #5
0
// ?�ッ?�゚を?�ー??��す�?
void Stage::Load()
{
	mpMap->Load( mDataFname, mMapChipGr );
	mpMap->SetScrollP(0);
	mpHaichi->Load( mTekiFname, mpCheckpointController );
	if( mZokuseiFname.compare("")!=0 ) 
		mpZokusei->Load( mZokuseiFname );

	inited = false;
	bgm_played = false;
	title_stage = 0;
	GAMECONTROL->GetJiki()->SetPos(GF("HERINITX"), GF("HERINITY"));
	GAMECONTROL->GetJiki()->ResetTempParams();
	GAMECONTROL->GetJiki()->SetSuperPause();
	GAMECONTROL->GetJiki()->SetMuki(1);

	GAMECONTROL->GetUserLightControl()->GetControlLight()->SetPos( SP->SCRSZX/2, SP->SCRSZY/2 );
	GAMECONTROL->GetJiki()->GetInterface()->Hide();
			
	mpSeigenJikan->SeigenJikanReset();

}
void Reed_Solomon::encode(const bvec &uncoded_bits, bvec &coded_bits)
{
  int i, j, iterations = floor_i(static_cast<double>(uncoded_bits.length())
                                 / (k * m));
  GFX mx(q, k), cx(q, n);
  GFX r(n + 1, n - k);
  GFX uncoded_shifted(n + 1, n);
  GF mpow;
  bvec mbit(k * m), cbit(m);

  coded_bits.set_size(iterations * n * m, false);

  if (systematic)
    for (i = 0; i < n - k; i++)
      uncoded_shifted[i] = GF(n + 1, -1);

  for (i = 0; i < iterations; i++) {
    //Fix the message polynom m(x).
    for (j = 0; j < k; j++) {
      mpow.set(q, uncoded_bits.mid((i * m * k) + (j * m), m));
      mx[j] = mpow;
      if (systematic) {
        cx[j] = mx[j];
        uncoded_shifted[j + n - k] = mx[j];
      }
    }
    //Fix the outputbits cbit.
    if (systematic) {
      r = modgfx(uncoded_shifted, g);
      for (j = k; j < n; j++) {
        cx[j] = r[j - k];
      }
    }
    else {
      cx = g * mx;
    }
    for (j = 0; j < n; j++) {
      cbit = cx[j].get_vectorspace();
      coded_bits.replace_mid((i * n * m) + (j * m), cbit);
    }
  }
}
void LightKobitoBlue::Init()
{
	mSpX = - GF("LKOBITO_BLUESPX");
}
void CurtainRollScr::UpdateStage()
{
	switch( mStage ){

	// フェードイン
	case FADING:	
		if( GAMECONTROL->GetFader()->FadeIn() ){
			//幕をあげる
			GAMECONTROL->GetMaku()->Open();
			mStage = OPENING;
		}
		break;

	// 幕アップ
	case OPENING:
		if( GAMECONTROL->GetMaku()->IsOpen() ){
			mStage = WAIT1SEC;
		}
		break;

	// 1秒待機
	case WAIT1SEC:
		WAIT_TIMER(mTimer, 1.0f)
			GAMECONTROL->GetTxtGraphicController()->ShowWithAlphaFade( TxtGraphicController::CENTER, 
				GI("THANKSSX"), GI("THANKSSY"), "graphics\\screen\\thank_you.png", 3.0f, 0.05f );
			mStage = THANKSPLAYING;
		WAIT_END
		break;

	// サンキュー
	case THANKSPLAYING:
		if( GAMECONTROL->GetTxtGraphicController()->IsFinished() )
			mStage = WAIT1SECMORE;
		break;

	// さらに1秒待機
	case WAIT1SECMORE:
		WAIT_TIMER(mTimer, 1.0f)
			mStage = HEROINE_ENTERING;
			heroine->SetPos(500-GI("HERSIZE"), GI("FLOORY") - GI("HERSIZE"));
			heroine->GetAnimationSet()->SetCurAnimation(HERAN_WALK);
			heroine->SetSp( GF("SPWALK"), 0 );
			GAMECONTROL->GetMobManager()->Request( heroine, true );
		WAIT_END
		break;

	// ヒロイン登場
	case HEROINE_ENTERING:
		if( heroine->GetX() >= 500+170-GI("HERSIZE") ){
			heroine->SetSp(0,0);
			heroine->GetAnimationSet()->SetCurAnimation(HERAN_STOP);
			mStage = HEROINE_STOP1SEC;
		}
		break;

	// ヒロイン停止
	case HEROINE_STOP1SEC:
		WAIT_TIMER(mTimer, 1.0f)
			mStage = HEROINE_ATTACK;
			heroine->GetAnimationSet()->SetCurAnimation(HERAN_ATT);
			heroine->SetSp( GF("SPWALK"), 0 ) ;
			heroine->SetAcc( GF("ACCKOGEKI") / SP->FRAMERATE, 0 );
			GAMECONTROL->GetSoundController()->LoopSE("audio\\se\\se_hiroin_tijoukougeki.wav");
		WAIT_END
		break;

	// ヒロイン攻撃
	case HEROINE_ATTACK:
		// 敵に当たったら敵が死ぬ
		for(int i=0; i<7; i++){
			if( actors[i]->IsJikiColliding() && actors[i]->GetAnimationSet()->GetCurAnimationIdx() == TEKI_STAND ){
				actors[i]->GetAnimationSet()->SetCurAnimation( TEKI_DIE );
				actors[i]->SetSp( GF("SHINIPATT_SPX"), -GF("SHINIPATT_SHOSP") );
				actors[i]->SetAcc( 0, SP->GRAVITY );
				GAMECONTROL->GetSoundController()->PlaySE("audio\\se\\se_kougekimeityuu.wav");
			}
		}

		// 到着
		if( heroine->GetX() >= 500+740-GI("HERSIZE") && 
			heroine->GetAnimationSet()->GetCurAnimation()->GetCurFrameIdx() == 3)
		{
			heroine->SetSp(0,0);
			heroine->SetAcc(0,0);
			heroine->GetAnimationSet()->SetCurAnimation(HERAN_ATTEND);
			mStage = HEROINE_ATTACKEND;
			GAMECONTROL->GetSoundController()->StopSE("audio\\se\\se_hiroin_tijoukougeki.wav");
		}
		break;

	// 攻撃終了動作
	case HEROINE_ATTACKEND:
		if( heroine->GetAnimationSet()->GetCurAnimation()->GetLoopCount() == 1 ){
			heroine->GetAnimationSet()->SetCurAnimation(HERAN_STOP);
			mStage = HEROINE_STOP1SECMORE;
		}
		break;

	// さらに1秒停止
	case HEROINE_STOP1SECMORE:
		WAIT_TIMER(mTimer, 1.0f)
			mStage = SEEYOUAGAIN;
			GAMECONTROL->GetTxtGraphicController()->ShowWithAlphaFade( TxtGraphicController::CENTER, 
				GI("SEEYOUSX"), GI("SEEYOUSY"), "graphics\\screen\\see_you_again.png", 3.0f, 0.05f );
		WAIT_END
		break;

	// また遊んでね
	case SEEYOUAGAIN:
		if( GAMECONTROL->GetTxtGraphicController()->IsFinished() ){
			mStage = CLOSINGANDFADINGOUT;
			GAMECONTROL->GetMaku()->Close();
		}
		break;

	// バイバイ
	case CLOSINGANDFADINGOUT:
		if( GAMECONTROL->GetMaku()->IsClosed() ){
			if( GAMECONTROL->GetFader()->FadeOut() ){
				GAMECONTROL->GetSoundController()->ResetBGMs();
				GAMECONTROL->GetStageManager()->GoToStage(1);
			}
		}
		break;
	}
}
bool Reed_Solomon::decode(const bvec &coded_bits, const ivec &erasure_positions, bvec &decoded_message, bvec &cw_isvalid)
{
  bool decoderfailure, no_dec_failure;
  int j, i, kk, l, L, foundzeros, iterations = floor_i(static_cast<double>(coded_bits.length()) / (n * m));
  bvec mbit(m * k);
  decoded_message.set_size(iterations * k * m, false);
  cw_isvalid.set_length(iterations);

  GFX rx(q, n - 1), cx(q, n - 1), mx(q, k - 1), ex(q, n - 1), S(q, 2 * t), Xi(q, 2 * t), Gamma(q), Lambda(q),
      Psiprime(q), OldLambda(q), T(q), Omega(q);
  GFX dummy(q), One(q, (char*)"0"), Omegatemp(q);
  GF delta(q), tempsum(q), rtemp(q), temp(q), Xk(q), Xkinv(q);
  ivec errorpos;

  if ( erasure_positions.length() ) {
    it_assert(max(erasure_positions) < iterations*n, "Reed_Solomon::decode: erasure position is invalid.");
  }
  
  no_dec_failure = true;
  for (i = 0; i < iterations; i++) {
    decoderfailure = false;
    //Fix the received polynomial r(x)
    for (j = 0; j < n; j++) {
      rtemp.set(q, coded_bits.mid(i * n * m + j * m, m));
      rx[j] = rtemp;
    }
    // Fix the Erasure polynomial Gamma(x)
    // and replace erased coordinates with zeros
    rtemp.set(q, -1);
    ivec alphapow = - ones_i(2);
    Gamma = One;
    for (j = 0; j < erasure_positions.length(); j++) {
      rx[erasure_positions(j)] = rtemp;
      alphapow(1) = erasure_positions(j);
      Gamma *= (One - GFX(q, alphapow));
    }
    //Fix the syndrome polynomial S(x).
    S.clear();
    for (j = 1; j <= 2 * t; j++) {
      S[j] = rx(GF(q, b + j - 1));
    }
    // calculate the modified syndrome polynomial Xi(x) = Gamma * (1+S) - 1
    Xi = Gamma * (One + S) - One;
    // Apply Berlekam-Massey algorithm
    if (Xi.get_true_degree() >= 1) { //Errors in the received word
      // Iterate to find Lambda(x), which hold all error locations
      kk = 0;
      Lambda = One;
      L = 0;
      T = GFX(q, (char*)"-1 0");
      while (kk < 2 * t) {
        kk = kk + 1;
        tempsum = GF(q, -1);
        for (l = 1; l <= L; l++) {
          tempsum += Lambda[l] * Xi[kk - l];
        }
        delta = Xi[kk] - tempsum;
        if (delta != GF(q, -1)) {
          OldLambda = Lambda;
          Lambda -= delta * T;
          if (2 * L < kk) {
            L = kk - L;
            T = OldLambda / delta;
          }
        }
        T = GFX(q, (char*)"-1 0") * T;
      }
      // Find the zeros to Lambda(x)
      errorpos.set_size(Lambda.get_true_degree());
      foundzeros = 0;
      for (j = q - 2; j >= 0; j--) {
        if (Lambda(GF(q, j)) == GF(q, -1)) {
          errorpos(foundzeros) = (n - j) % n;
          foundzeros += 1;
          if (foundzeros >= Lambda.get_true_degree()) {
            break;
          }
        }
      }
      if (foundzeros != Lambda.get_true_degree()) {
        decoderfailure = true;
      }
      else { // Forney algorithm...
        //Compute Omega(x) using the key equation for RS-decoding
        Omega.set_degree(2 * t);
        Omegatemp = Lambda * (One + Xi);
        for (j = 0; j <= 2 * t; j++) {
          Omega[j] = Omegatemp[j];
        }
        //Find the error/erasure magnitude polynomial by treating them the same
        Psiprime = formal_derivate(Lambda*Gamma);
        errorpos = concat(errorpos, erasure_positions);
        ex.clear();
        for (j = 0; j < errorpos.length(); j++) {
          Xk = GF(q, errorpos(j));
          Xkinv = GF(q, 0) / Xk;
          // we calculate ex = - error polynomial, in order to avoid the 
          // subtraction when recunstructing the corrected codeword
          ex[errorpos(j)] = (Xk * Omega(Xkinv)) / Psiprime(Xkinv);
          if (b != 1) { // non-narrow-sense code needs corrected error magnitudes
            int correction_exp = ( errorpos(j)*(1-b) ) % n;
            ex[errorpos(j)] *= GF(q, correction_exp + ( (correction_exp < 0) ? n : 0 ));
          }
        }
        //Reconstruct the corrected codeword.
        // instead of subtracting the error/erasures, we calculated 
        // the negative error with 'ex' above
        cx = rx + ex;
        //Code word validation
        S.clear();
        for (j = 1; j <= 2 * t; j++) {
          S[j] = cx(GF(q, b + j - 1));
        }
        if (S.get_true_degree() >= 1) {
          decoderfailure = true;
        }
      }
    }
    else {
      cx = rx;
      decoderfailure = false;
    }
    //Find the message polynomial
    mbit.clear();
    if (decoderfailure == false) {
      if (cx.get_true_degree() >= 1) { // A nonzero codeword was transmitted
        if (systematic) {
          for (j = 0; j < k; j++) {
            mx[j] = cx[j];
          }
        }
        else {
          mx = divgfx(cx, g);
        }
        for (j = 0; j <= mx.get_true_degree(); j++) {
          mbit.replace_mid(j * m, mx[j].get_vectorspace());
        }
      }
    }
    else { //Decoder failure.
      // for a systematic code it is better to extract the undecoded message
      // from the received code word, i.e. obtaining a bit error
      // prob. p_b << 1/2, than setting all-zero (p_b = 1/2)
      if (systematic) {
        mbit = coded_bits.mid(i * n * m, k * m);
      }
      else {
        mbit = zeros_b(k);
      }
      no_dec_failure = false;
    }
    decoded_message.replace_mid(i * m * k, mbit);
    cw_isvalid(i) = (!decoderfailure);
  }
  return no_dec_failure;
}
Exemple #10
0
/*
	開始演�?
	終わったら1を返す
*/
void Stage::Init()
{
	if( !bgm_played){
		bgm_played = true;
		GAMECONTROL->GetSoundController()->SetBGM(mBgm);
	}

	// ?�ェ?�??��イ??
	if( GAMECONTROL->GetFader()->FadeIn() ){
		
		// タイトル表示
		if( title_stage == 0 ){
			title_stage = 1;
			GAMECONTROL->GetTxtGraphicController()->
				ShowWithEnterFromRight( GI("STGTITLE_Y"), GI("STGTITLE_SX"), GI("STGTITLE_SY"), mTitleGraphic, GF("STGTITLE_SPX") );
		}
		// act start
		if( GAMECONTROL->GetTxtGraphicController()->IsFinished() ){
			if( title_stage == 1 ){
				title_stage = 2;
				GAMECONTROL->GetTxtGraphicController()->
				ShowWithEnterFromRight( GI("STGACTSTART_Y"), GI("STGACTSTART_SX"), GI("STGACTSTART_SY"), "graphics\\txtgraphic\\actstart.png", GF("STGTITLE_SPX") );
			}
		}

		// �?
		if( GAMECONTROL->GetTxtGraphicController()->IsFinished() ){

			if( GAMECONTROL->GetMaku()->IsClosed() ) GAMECONTROL->GetMaku()->Open();
			// 幕をあげ�?
			if( GAMECONTROL->GetMaku()->IsOpen() ){
				inited = true;
				//BGM
				//GAMECONTROL->GetSoundController()->SetBGM(SoundController::STGSTART);
				GAMECONTROL->GetUserLightControl()->GetControlLight()->TurnOn();
				GAMECONTROL->GetJiki()->SetSuperControl();
				GAMECONTROL->GetJiki()->GetInterface()->Show();
				GAMECONTROL->GetStageManager()->GetCurrentStage()->GetSeigenJikan()->SeigenJikanOn();	
			}
		}


		// ?�ウ?�?�?�ッ?�演�?スキ�??
		if( GAMECONTROL->GetDXController()->IsMouseClicked() ){
			// 幕を強制�?��持ち上げ�?
			GAMECONTROL->GetMaku()->SetOpened();
			// �?��を消す
			GAMECONTROL->GetTxtGraphicController()->Reset();
			title_stage = 2;
		}
	}
}