Ejemplo n.º 1
0
void MuscleOutput(MSA &msa)
	{
	MHackEnd(msa);
	if (g_bStable)
		{
		MSA msaStable;
		Stabilize(msa, msaStable);
		msa.Clear();	// save memory
		DoOutput(msaStable);
		}
	else
		DoOutput(msa);
	}
Ejemplo n.º 2
0
void prepareAlignResults(MSA& msa, const DNAAlphabet* al, MultipleSequenceAlignment& ma, bool mhack) {
    if (mhack) {
        MHackEnd(msa);
    }
    MuscleContext* ctx = getMuscleContext();
    if (ctx->params.g_bStable) {
        MSA msaStable;
        Stabilize(msa, msaStable);
        msa.Clear();
        convertMSA2MAlignment(msaStable, al, ma);
    } else {
        convertMSA2MAlignment(msa, al, ma);
    }
}
Ejemplo n.º 3
0
void CLife::ToggleEditMode()
{
    if ( !EditMode )
    {
        Pause();
        Stabilize();
        SyncGrids();
        EditMode = true;
    }
    else
    {
        EditMode = false;
        //UnPause();
    }
}
Ejemplo n.º 4
0
bool C4Object::ExecMovement() // Every Tick1 by Execute
{
	// update in which material this object is
	UpdateInMat();

	// Containment check
	if (Contained)
	{
		CopyMotion(Contained);

		return true;
	}

	// General mobility check
	if (Category & C4D_StaticBack) return false;

	// Movement execution
	if (Mobile) // Object is moving
	{
		// Move object
		DoMovement();
		// Demobilization check
		if ((xdir==0) && (ydir==0) && (rdir==0)) Mobile=0;
		// Check for stabilization
		if (rdir==0) Stabilize();
	}
	else // Object is static
	{
		// Check for stabilization
		Stabilize();
		// Check for mobilization
		if (!::Game.iTick10)
		{
			// Gravity mobilization
			xdir=ydir=rdir=0;
			Mobile=1;
		}
	}

	// Enforce zero rotation
	if (!Def->Rotateable) fix_r=Fix0;

	// Out of bounds check
	if ((!Inside<int32_t>(GetX() + Shape.GetX(), -Shape.Wdt, GBackWdt) && !(GetPropertyInt(P_BorderBound) & C4D_Border_Sides))
	    || ((GetY() + Shape.GetY() > GBackHgt) && !(GetPropertyInt(P_BorderBound) & C4D_Border_Bottom)))
	{
		C4PropList* pActionDef = GetAction();
		// Never remove attached objects: If they are truly outside landscape, their target will be removed,
		//  and the attached objects follow one frame later
		if (!pActionDef || !Action.Target || pActionDef->GetPropertyP(P_Procedure) != DFA_ATTACH)
		{
			bool fRemove = true;
			// never remove HUD objects
			if (Category & C4D_Parallax)
			{
				int parX, parY;
				GetParallaxity(&parX, &parY);
				fRemove = false;
				if (GetX()>GBackWdt || GetY()>GBackHgt) fRemove = true; // except if they are really out of the viewport to the right...
				else if (GetX()<0 && !!parX) fRemove = true; // ...or it's not HUD horizontally and it's out to the left
				else if (!parX && GetX()<-GBackWdt) fRemove = true; // ...or it's HUD horizontally and it's out to the left
			}
			if (fRemove)
			{
				AssignDeath(true);
				AssignRemoval();
			}
		}
	}
	return true;
}
Ejemplo n.º 5
0
void CLife::OnKeyUp( SDLKey sym, SDLMod mod, Uint16 unicode )
{
    switch ( sym )
    {
        case SDLK_RIGHT:
        {
            Pause();
            break;
        }

        case SDLK_s:
        {
            Pause();
            Save();
            break;
        }

        case SDLK_RETURN:
        {
            TogglePause();
            break;
        }

        case SDLK_UP:
        case SDLK_PLUS:
        case SDLK_KP_PLUS:
        case SDLK_PERIOD:
        {
            Framerate->raiseFPS();
            break;
        }

        case SDLK_DOWN:
        case SDLK_MINUS:
        case SDLK_KP_MINUS:
        case SDLK_COMMA:
        {
            Framerate->lowerFPS();
            break;
        }

        case SDLK_e:
        {
            ToggleEditMode();
            break;
        }

        case SDLK_h:
        {
            //Pause();
            TogglePause();
            Stabilize();
            ToggleStepping();
            TogglePause();
            break;
        }

        case SDLK_c:
        {
            SwitchColours();
            break;
        }

        case SDLK_r:
        {
            Reset();
            break;
        }

        //Patterns:
        case SDLK_0:
        case SDLK_KP0:
        {
            Patternify(0);
            break;
        }

        case SDLK_1:
        case SDLK_KP1:
        {
            Patternify(1);
            break;
        }

        case SDLK_2:
        case SDLK_KP2:
        {
            Patternify(2);
            break;
        }

        case SDLK_3:
        case SDLK_KP3:
        {
            Patternify(3);
            break;
        }

        case SDLK_7:
        case SDLK_KP7:
        case SDLK_x:
        {
            Patternify(7);
            break;
        }

        case SDLK_8:
        case SDLK_KP8:
        {
            Patternify(8);
            break;
        }

        case SDLK_9:
        case SDLK_KP9:
        {
            Patternify(9);
            break;
        }

        default:
        {
            break;
        }
    }
}
Ejemplo n.º 6
0
void CLife::Save()
{
    Stabilize();
    Flash();
    LifeGrid->toFile(OutFile);
}