Example #1
0
void	CBlender_Compile::Stage_Matrix		(LPCSTR name, int iChannel)
{
	sh_list& lst	= L_matrices; 
	int id			= ParseName(name);
	CMatrix*	M	= DEV->_CreateMatrix	((id>=0)?*lst[id]:name);
	passMatrices.push_back(M);

	// Setup transform pipeline
	u32	ID = Stage();
	if (M) {
		switch (M->dwMode)
		{
		case CMatrix::modeProgrammable:	StageSET_XForm	(D3DTTFF_COUNT3,D3DTSS_TCI_CAMERASPACEPOSITION|ID);					break;
		case CMatrix::modeTCM:			StageSET_XForm	(D3DTTFF_COUNT2,D3DTSS_TCI_PASSTHRU|iChannel);						break;
		case CMatrix::modeC_refl:		StageSET_XForm	(D3DTTFF_COUNT3,D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR|ID);			break;
		case CMatrix::modeS_refl:		StageSET_XForm	(D3DTTFF_COUNT2,D3DTSS_TCI_CAMERASPACENORMAL|ID);					break;
		default:						StageSET_XForm	(D3DTTFF_DISABLE,D3DTSS_TCI_PASSTHRU|iChannel);						break;
		}
	} else {
		// No XForm at all
		StageSET_XForm	(D3DTTFF_DISABLE,D3DTSS_TCI_PASSTHRU|iChannel);	
	}
}
#include "System.h"

vector<Stage> System::stages(11, Stage(0));

vector<Register> System::registers(32, Register(0, 0));

bool System::forwardingEnabled = true;

int System::programCounter = 1;

int System::rStalls = 0;

int System::sStalls = 0;

int System::multSubStages = 4;

bool System::fastBranching = false;

Memory System::memory=Memory();

map<string, int> System::labelMap = *(new map<string , int>);

bool System::programOver = false;

int System::clockCycle = 0;

bool System::branchChanged = false;
Example #3
0
void AI01::think(const Status& my, const Status& enemy) {

	setCost(my.getNinjutsuCost());
	ninjutsuPoint = Point(-1, -1);

	array<vector<MoveCommand>, 2> move;

	Status status(my);

	for (int i = 0; i < 2; i++)
	{
		try
		{
			move[i] = dogEscape.getCommand2(i, status);

			int ninryoku = my.getNinryoku() - defenceSort[3].first;
			if (ninryoku > 0)
			{
				if (ninryoku >= Status::getNinjutsuCost(NinjutsuCommand::RotatinCut))
				{
					const auto ninjas = my.getNinjas();
					const Stage stage(my.getStageDogStatus());
					int dogCount[2] = { 0 };
					for (int j = 0; j < 2; j++)
					{
						for (int y = -1; y < 2; y++)
						{
							for (int x = -1; x < 2; x++)
							{
								if (stage.getState(ninjas[j].point + Point(x, y)) == Stage::State::Dog)
								{
									dogCount[j]++;
								}
							}
						}
					}
					if (dogCount[i] >= dogCount[1 - i])
					{
						if (dogCount[i] >= 3)
						{
							cerr << "回転斬!" << endl;
							ninjutsuFlag = true;
							ninjutsuString = "7 " + to_string(i);
						}
					}

				}
				else
				{
					useNinjutsuA(enemy, ninryoku);
				}
			}
		}
		catch (logic_error e)
		{
			if (!ninjutsuFlag)
			{
				try
				{
					move[i] = useNinjutsuD(my, status, e.what(), i);
				}
				catch (invalid_argument)
				{
					return;
				}
			}
		}
		if (move[i].empty())
		{
			move[i] = soulFind.getCommand2(i, status);
			if (move[i].size() == 1)
			{
				Status nextStatus(status);
				auto soul = status.getSoulPoints();
				auto stage = status.getStage();
				const auto p = Stage::moveSimulation(status.getNinjas()[i].point, move[i][0], stage);
				for (auto it = soul.begin(); it != soul.end();)
				{
					if (p == *it) it = soul.erase(it);
					else ++it;
				}
				nextStatus.setSoulPoints(soul);
				auto m = soulFind.getCommand2(i, status);
				move[i].push_back(m[0]);
			}
		}

		Point p = status.getNinjas()[i].point;
		Stage stage = status.getStage();
		auto soulPoints = status.getSoulPoints();
		for (const auto& c : move[i]) {
			p = Stage::moveSimulation(p, status.getNinjas()[(i + 1) % 2].point, c, stage, status.getDogs());
			for (auto it = soulPoints.begin(); it != soulPoints.end();)
			{
				if (p == *it) it = soulPoints.erase(it);
				else ++it;
			}
		}
		array<Character, 2> nextNinjas = status.getNinjas();
		nextNinjas[i] = Character{ i, p };
		if (ninjutsuFlag)
		{
			if (ninjutsuString[0] == '1')//落石
			{
				auto arr = stage.getStage();
				arr[ninjutsuPoint.x][ninjutsuPoint.y] = Stage::State::Rock;
				stage = Stage(arr);
			}
			else if (ninjutsuString[0] == '3')//雷撃
			{
				auto arr = stage.getStage();
				arr[ninjutsuPoint.x][ninjutsuPoint.y] = Stage::State::None;
				stage = Stage(arr);
			}
			else if (ninjutsuString[0] == '5')//自分身
			{

			}
			else if (ninjutsuString[0] == '7')//回転斬
				status.eraseDogs(status.getNinjas()[i].point);
		}
		status.setSoulPoints(soulPoints);
		status.setStage(stage);
		status.setNinjas(nextNinjas);
	}

	characterMove = move;
}
Example #4
0
// 2DPlatformer.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "Character.h"
#include "Player.h"
#include "Enemy.h"
#include "Vector2.h"
#include "Stage.h"
#include "Projectile.h"
#include "2DPlatformer.h"

Player player = Player("Gizmo", 8, Vector2(40, 8*32));
Stage currStage = Stage();
Vector2 healthPlaces[9] = {Vector2(10, 51), Vector2(10, 46), Vector2(10, 41), Vector2(10, 36), Vector2(10, 31), Vector2(10, 26), Vector2(10, 21), Vector2(10, 16), Vector2(10, 11)};
ALLEGRO_BITMAP *healthBar; 
ALLEGRO_BITMAP *healthBit;

int main()
{
	al_init();
	al_init_image_addon();
	ALLEGRO_DISPLAY *display = al_create_display(480, 320);
	healthBar  = al_load_bitmap("Assets/HealthBar.png");
	healthBit = al_load_bitmap("Assets/HealthBit.png");
	
	player.LoadSprite();
	currStage.LoadAll();

	while (true)//for (int i = 0; i < 250; i++)
	{	
		if (rungameFlag == false)
Example #5
0
	void Framework::update(){
		if ( !gStage ){
			gPrimitiveRenderer = Scene::PrimitiveRenderer::create( 1000, 100 );
			Pad::create();
			gRobo[ 0 ] = NEW Robo( 0 );
			gRobo[ 1 ] = NEW Robo( 1 );
			gRobo[ 0 ]->setPosition( Vector3( 0.0, 0.0, 50.0 ) );
			gRobo[ 0 ]->setAngleY( 180.0 );
			gStage = NEW Stage();
			gPlaying = true;
		}
		if ( gPlaying ){
			gRobo[ 0 ]->update( gRobo[ 1 ] );
			gRobo[ 1 ]->update( gRobo[ 0 ] );
			++gTime;
		}

		//0番ロボからカメラ行列ゲット
		Matrix44 pvm;
		pvm.setPerspectiveTransform( 45.f, 
			static_cast< float >( width() ),
			static_cast< float >( height() ),
			1.f,
			10000.f );
		Matrix34 vm;
		Vector3 eyePosition;
		gRobo[ 0 ]->getView( &vm, &eyePosition ); //ビュー行列はロボに作ってもらう
		pvm *= vm;

		//描画
		//グローバルなライティング設定
		Graphics::Manager gm = Graphics::Manager::instance();
		gm.setProjectionViewMatrix( pvm );
		gm.setEyePosition( eyePosition );
		gm.setLightingMode( Graphics::LIGHTING_PER_PIXEL );
		gm.setAmbientColor( gAmbient );
		gm.setLightColor( 0, Vector3( 0.7f, 0.4f, 0.2f ) );
		Vector3 lightPos[ 4 ];
		lightPos[ 0 ].set( 100000.f, 100000.f, 100000.f );
		gm.setLightIntensity( 0, lightPos[ 0 ].length() ); //長さを強度にすれば、だいたいその距離で1になる
		//残り三つのライトは弾のところに置こうか。
		//カメラに近い順に3つ選ぼう。
		float nearestDistance[ 3 ];
		int nearestIndex[ 3 ];
		for ( int i = 0; i < 3; ++i ){
			nearestDistance[ i ] = numeric_limits< float >::max();
			nearestIndex[ i ] = -1;
		}
		//距離を測りながら最小を三つ取得
		//100はロボあたりの弾の数の最大数。
		for ( int i = 0; i < 2; ++i ){
			for ( int j = 0; j < 100; ++j ){
				const Vector3* p = gRobo[ i ]->getBulletPosition( j );
				if ( p ){
					Vector3 t;
					t.setSub( *p, eyePosition );
					float d = t.squareLength();
					if ( d < nearestDistance[ 0 ] ){
						nearestDistance[ 2 ] = nearestDistance[ 1 ];
						nearestDistance[ 1 ] = nearestDistance[ 0 ];
						nearestDistance[ 0 ] = d;
						nearestIndex[ 2 ] = nearestIndex[ 1 ];
						nearestIndex[ 1 ] = nearestIndex[ 0 ];
						nearestIndex[ 0 ] = i * 100 + j;
					}else if ( d < nearestDistance[ 1 ] ){
						nearestDistance[ 2 ] = nearestDistance[ 1 ];
						nearestDistance[ 1 ] = d;
						nearestIndex[ 2 ] = nearestIndex[ 1 ];
						nearestIndex[ 1 ] = i * 100 + j;
					}else if ( d < nearestDistance[ 2 ] ){
						nearestDistance[ 2 ] = d;
						nearestIndex[ 2 ] = i * 100 + j;
					}
				}
			}
		}
		for ( int i = 0; i < 3; ++i ){
			if ( nearestIndex[ i ] != -1 ){
				int robo = nearestIndex[ i ] / 100;
				int bullet = nearestIndex[ i ] % 100;
				const Vector3* p = gRobo[ robo ]->getBulletPosition( bullet );
				lightPos[ i + 1 ] = *p;
				if ( robo == 1 ){
					gm.setLightColor( i + 1, Vector3( 1.f, 0.2f, 0.4f ) );
				}else{
					gm.setLightColor( i + 1, Vector3( 0.2f, 0.4f, 1.f ) );
				}
				gm.setLightIntensity( i + 1, 10.f );
			}else{
				gm.setLightIntensity( i + 1, 0.f );
			}
		}
		for ( int i = 0; i < 4; ++i ){
			gm.setLightPosition( i, lightPos[ i ] );
		}
		gm.setCullMode( Graphics::CULL_BACK );
		gStage->draw();
		gRobo[ 0 ]->draw();
		gRobo[ 1 ]->draw();

		//以下フロントエンド描画
		gm.setDiffuseColor( Vector3( 1.f, 1.f, 1.f ) );

		//必要な情報を抜いて
		int hp0 = gRobo[ 0 ]->getHitPoint();
		int hp1 = gRobo[ 1 ]->getHitPoint();
		int e0 = gRobo[ 0 ]->getEnergy();
		bool lockOn0 = gRobo[ 0 ]->getLockOn();

		//Zテスト無用。アルファブレンドON
		gPrimitiveRenderer.enableDepthTest( false );
		gPrimitiveRenderer.enableDepthWrite( false );
		gPrimitiveRenderer.setBlendMode( Graphics::BLEND_LINEAR );

		Vector2 p[ 4 ];
		unsigned c1;
		unsigned c2;
		//体力バー背景
		p[ 0 ].set( -0.9f, 0.95f );
		p[ 1 ].set( -0.9f, 0.87f );
		p[ 2 ].set( 0.1f, 0.95f );
		p[ 3 ].set( 0.1f, 0.87f );
		c1 = c2 = 0xff406080;
		drawRect( p, c1, c2 );
		p[ 0 ].set( -0.9f, 0.85f );
		p[ 1 ].set( -0.9f, 0.82f );
		p[ 2 ].set( 0.1f, 0.85f );
		p[ 3 ].set( 0.1f, 0.82f );
		c1 = c2 = 0xff806040;
		drawRect( p, c1, c2 );
		//体力バー本体
		float length = static_cast< float >( hp0 ) / static_cast< float >( Robo::mMaxHitPoint );
		p[ 0 ].set( -0.9f, 0.95f );
		p[ 1 ].set( -0.9f, 0.87f );
		p[ 2 ].set( -0.9f + length, 0.95f );
		p[ 3 ].set( -0.9f + length, 0.87f );
		c1 = 0xff882244;
		c2 = 0xff88ccff;
		drawRect( p, c1, c2 );
		length = static_cast< float >( hp1 ) / static_cast< float >( Robo::mMaxHitPoint );
		p[ 0 ].set( -0.9f, 0.85f );
		p[ 1 ].set( -0.9f, 0.82f );
		p[ 2 ].set( -0.9f + length, 0.85f );
		p[ 3 ].set( -0.9f + length, 0.82f );
		c1 = 0xffff4422;
		c2 = 0xffffcc88;
		drawRect( p, c1, c2 );
		//武器エネルギー
		//背景
		p[ 0 ].set( -0.1f, -0.7f );
		p[ 1 ].set( -0.1f, -0.8f );
		p[ 2 ].set( 0.1f, -0.7f );
		p[ 3 ].set( 0.1f, -0.8f );
		c1 = c2 = 0x80404040;
		drawRect( p, c1, c2 );
		//本体
		gPrimitiveRenderer.setBlendMode( Graphics::BLEND_ADDITIVE ); //加算にしてみようかな
		length = 0.2f * static_cast< float >( e0 ) / static_cast< float >( Robo::mMaxEnergy );
		p[ 0 ].set( -0.1f, -0.7f );
		p[ 1 ].set( -0.1f, -0.8f );
		p[ 2 ].set( -0.1f + length, -0.7f );
		p[ 3 ].set( -0.1f + length, -0.8f );
		c1 = 0x80ff0000;
		c2 = 0x80ffff00;
		drawRect( p, c1, c2 );

		//レーダー
		gPrimitiveRenderer.setBlendMode( Graphics::BLEND_LINEAR );
		//背景
		p[ 0 ].set( 0.7f, 0.7f );
		p[ 1 ].set( 0.7f, 0.9f );
		p[ 2 ].set( 0.9f, 0.7f );
		p[ 3 ].set( 0.9f, 0.9f );
		c1 = c2 = 0x80404040;
		drawRect( p, c1, c2 );
		gPrimitiveRenderer.setBlendMode( Graphics::BLEND_ADDITIVE ); //加算にしてみようか
		//自分
		Vector2 t;
		t.set( gRobo[ 0 ]->getPosition()->x, gRobo[ 0 ]->getPosition()->z ); //x.z
		t *= 0.002f; //+-50のステージを0.2の大きさに縮小するんだから、0.2/100で0.002
		t += Vector2( 0.8f, 0.8f ); //(0.8,0.8)が中心なのだから、それを足す
		p[ 0 ].set( t.x - 0.005f, t.y - 0.005f );
		p[ 1 ].set( t.x - 0.005f, t.y + 0.005f );
		p[ 2 ].set( t.x + 0.005f, t.y - 0.005f );
		p[ 3 ].set( t.x + 0.005f, t.y + 0.005f );
		c1 = c2 = 0xcc0080ff;
		drawRect( p, c1, c2 );
		//敵
		t.set( gRobo[ 1 ]->getPosition()->x, gRobo[ 1 ]->getPosition()->z ); //x.z
		t *= 0.002f; //+-50のステージを0.2の大きさに縮小するんだから、0.2/100で0.002
		t += Vector2( 0.8f, 0.8f ); //(0.8,0.8)が中心なのだから、それを足す
		p[ 0 ].set( t.x - 0.005f, t.y - 0.005f );
		p[ 1 ].set( t.x - 0.005f, t.y + 0.005f );
		p[ 2 ].set( t.x + 0.005f, t.y - 0.005f );
		p[ 3 ].set( t.x + 0.005f, t.y + 0.005f );
		c1 = c2 = 0xccff8000;
		drawRect( p, c1, c2 );

		//ロックオンマーク
		if ( lockOn0 ){
			gPrimitiveRenderer.setBlendMode( Graphics::BLEND_ADDITIVE ); //加算にしてみようかな
			//敵ロボを座標変換してスクリーン座標に変換
			Vector3 t = *gRobo[ 1 ]->getPosition();
			Vector4 p4;
			pvm.mul( &p4, t );
			//XY座標はwで割れば出る。
			float x = p4[ 0 ] / p4[ 3 ];
			float y = p4[ 1 ] / p4[ 3 ];
			//色は赤かなあ
			c1 = c2 = 0x80ff0000;
			//線4本でやろう。
			p[ 0 ].set( x - 0.01f, y + 0.2f );
			p[ 1 ].set( x - 0.01f, y + 0.1f );
			p[ 2 ].set( x + 0.01f, y + 0.2f );
			p[ 3 ].set( x + 0.01f, y + 0.1f );
			drawRect( p, c1, c2 );
			p[ 0 ].set( x - 0.01f, y - 0.2f );
			p[ 1 ].set( x - 0.01f, y - 0.1f );
			p[ 2 ].set( x + 0.01f, y - 0.2f );
			p[ 3 ].set( x + 0.01f, y - 0.1f );
			drawRect( p, c1, c2 );
			p[ 0 ].set( x - 0.2f, y - 0.01f );
			p[ 1 ].set( x - 0.2f, y + 0.01f );
			p[ 2 ].set( x - 0.1f, y - 0.01f );
			p[ 3 ].set( x - 0.1f, y + 0.01f );
			drawRect( p, c1, c2 );
			p[ 0 ].set( x + 0.2f, y - 0.01f );
			p[ 1 ].set( x + 0.2f, y + 0.01f );
			p[ 2 ].set( x + 0.1f, y - 0.01f );
			p[ 3 ].set( x + 0.1f, y + 0.01f );
			drawRect( p, c1, c2 );
		}
		//時間制限
		gPrimitiveRenderer.setBlendMode( Graphics::BLEND_LINEAR ); //もどして
		length = 1.9f * static_cast< float >( 60 * TIME_LIMIT - gTime ) / static_cast< float >( 60 * TIME_LIMIT );
		p[ 0 ].set( -0.95f, -0.95f );
		p[ 1 ].set( -0.95f, -0.9f );
		p[ 2 ].set( 0.95f, -0.95f );
		p[ 3 ].set( 0.95f, -0.9f );
		c1 = c2 = 0x80404040;
		drawRect( p, c1, c2 );
		p[ 0 ].set( -0.95f, -0.95f );
		p[ 1 ].set( -0.95f, -0.9f );
		p[ 2 ].set( -0.95f + length, -0.95f );
		p[ 3 ].set( -0.95f + length, -0.9f );
		gPrimitiveRenderer.setBlendMode( Graphics::BLEND_ADDITIVE ); //加算?
		c1 = 0x80ff8888;
		c2 = 0x8088ffff;
		drawRect( p, c1, c2 );

		if ( Input::Manager().keyboard().isTriggered( ' ' ) ){
			gPlaying = !gPlaying;
		}

		if ( hp0 <= 0 || hp1 <= 0 || gTime >= 60 * TIME_LIMIT ){
			gPlaying = false;
			DebugScreen::instance().draw( 20, 5, "Game Over. press FIRE" );
			if ( Pad::instance()->isTriggered( Pad::FIRE, 0 ) ){
				//セットしているものは後始末
				gm.setVertexBuffer( 0 );
				gm.setIndexBuffer( 0 );
				gm.setTexture( 0 );

				SAFE_DELETE( gRobo[ 0 ] );
				SAFE_DELETE( gRobo[ 1 ] );
				gRobo[ 0 ] = NEW Robo( 0 );
				gRobo[ 1 ] = NEW Robo( 1 );
				gRobo[ 0 ]->setPosition( Vector3( 0.f, 0.f, 50.f ) );
				gRobo[ 0 ]->setAngleY( 180.0 );
				gPlaying = true;
				gTime = 0;
			}
		}
		gPrimitiveRenderer.draw(); //足し終わったら描画
		//終了判定(マウスで×ボタンが叩かれたか)
		if ( isEndRequested() ){
			if ( gStage ){
				Pad::destroy();
				SAFE_DELETE( gRobo[ 0 ] );
				SAFE_DELETE( gRobo[ 1 ] );
				SAFE_DELETE( gStage );
				//グローバルにあるものは勝手には消えないので開放
				gPrimitiveRenderer.release(); 
			}
		}
	}
Example #6
0
void Magnifier::Initialize()
{
  Actor self = Self();
  mPropertySourcePosition = self.RegisterProperty( Toolkit::Magnifier::SOURCE_POSITION_PROPERTY_NAME, Vector3::ZERO );
  Vector2 stageSize(Stage::GetCurrent().GetSize());

  Layer dummyLayer = Layer::New();
  Stage().GetCurrent().Add(dummyLayer);
  dummyLayer.SetParentOrigin(ParentOrigin::CENTER);

  // NOTE:
  // sourceActor is a dummy delegate actor that takes the source property position,
  // and generates a WORLD_POSITION, which is 1 frame behind the source property.
  // This way the constraints for determining the camera position (source) and those
  // for determining viewport position use the same 1 frame old values.
  // A simple i) CameraPos = f(B), ii) B = f(A) set of constraints wont suffice as
  // although CameraPos will use B, which is A's previous value. The constraint will
  // not realise that B is still dirty as far as constraint (i) is concerned.
  // Perhaps this is a bug in the way the constraint system factors into what is dirty
  // and what is not.
  mSourceActor = Actor::New();
  dummyLayer.Add(mSourceActor);
  mSourceActor.SetParentOrigin(ParentOrigin::CENTER);
  Constraint constraint = Constraint::New<Vector3>( Actor::POSITION,
                                                    Source( self, mPropertySourcePosition ),
                                                    EqualToConstraint() );
  mSourceActor.ApplyConstraint(constraint);

  // create the render task this will render content on top of everything
  // based on camera source position.
  InitializeRenderTask();

  // set up some constraints to:
  // i) reposition (dest) frame actor based on magnifier actor's world position (this is 1 frame delayed)
  // ii) reposition and resize (dest) the render task's viewport based on magnifier actor's world position (1 frame delayed) & size.
  // iii) reposition (source) camera actor based on magnifier source actor's world position (this is 1 frame delayed)

  // Apply constraint to camera's position
  // Position our camera at the same distance from its target as the default camera is.
  // The camera position doesn't affect how we render, just what we render (due to near and far clip planes)
  // NOTE: We can't interrogate the default camera's position as it is not known initially (takes 1 frame
  // for value to update).
  // But we can determine the initial position using the same formula:
  // distance = stage.height * 0.5 / tan(FOV * 0.5)

  RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
  RenderTask renderTask = taskList.GetTask(0u);
  float fov = renderTask.GetCameraActor().GetFieldOfView();
  mDefaultCameraDistance = (stageSize.height * 0.5f) / tanf(fov * 0.5f);

  // Use a 1 frame delayed source position to determine the camera actor's position.
  // This is necessary as the viewport is determined by the Magnifier's Actor's World position (which is computed
  // at the end of the update cycle i.e. after constraints have been applied.)
  //Property::Index propertySourcePositionDelayed = mCameraActor.RegisterProperty("delayed-source-position", Vector3::ZERO);

  constraint = Constraint::New<Vector3>( Actor::POSITION,
                                                    Source( mSourceActor, Actor::WORLD_POSITION ),
                                                    CameraActorPositionConstraint(stageSize, mDefaultCameraDistance) );
  mCameraActor.ApplyConstraint(constraint);

  // Apply constraint to render-task viewport position
  constraint = Constraint::New<Vector2>( RenderTask::VIEWPORT_POSITION,
                                         Source( self, Actor::WORLD_POSITION ),//mPropertySourcePosition ),
                                         Source( self, Actor::SIZE ),
                                         Source( self, Actor::WORLD_SCALE),
                                         RenderTaskViewportPositionConstraint(stageSize) );
  mTask.ApplyConstraint(constraint);

  // Apply constraint to render-task viewport position
  constraint = Constraint::New<Vector2>( RenderTask::VIEWPORT_SIZE,
                                         Source( self, Actor::SIZE ),
                                         Source( self, Actor::WORLD_SCALE),
                                         RenderTaskViewportSizeConstraint() );
  mTask.ApplyConstraint(constraint);
}
Example #7
0
    //! Default constructor.
    RowsStages::RowsStages(const IMC::Rows* maneuver, Tasks::Task* task)
    {
      // Setup offsets (without bearing rotation)
      m_man = *maneuver;
      // Save a pointer to the task to call debug message
      m_task = task;

      double curve_sign = curveRight() ? 1 : -1;
      double alt_frac_up = 0.01 * (double)m_man.alternation;
      double alt_frac_down = 2 - 0.01 * (double)m_man.alternation;

      m_stages.clear();

      Stage approach("approach", -m_man.coff, 0);
      m_stages.push_back(approach);

      Stage start_point("start", m_man.coff, 0);
      m_stages.push_back(start_point);

      Stage up("up", m_man.length + m_man.coff, 0);

      m_stages.push_back(up);

      Stage up_curve("begin curve (up)", 0, curve_sign * alt_frac_up * m_man.hstep);
      Stage up_curve_end("end curve (up)", -m_man.coff, 0);

      if (!squareCurve())
      {
        Angles::rotate(m_man.cross_angle, curveLeft(), up_curve.x, up_curve.y);
        up_curve.x -= m_man.coff;
        m_stages.push_back(up_curve);
      }
      else
      {
        Angles::rotate(m_man.cross_angle, curveLeft(), up_curve.x, up_curve.y);
        m_stages.push_back(up_curve);
        m_stages.push_back(up_curve_end);
      }

      Stage down("down", -up.x, 0);
      m_stages.push_back(down);

      Stage down_curve("begin curve (down)", 0, curve_sign * alt_frac_down * m_man.hstep);
      Stage down_curve_end("end curve (down)", -up_curve_end.x, 0);

      if (!squareCurve())
      {
        Angles::rotate(m_man.cross_angle, curveLeft(), down_curve.x, down_curve.y);
        down_curve.x += m_man.coff;
        m_stages.push_back(down_curve);
      }
      else
      {
        Angles::rotate(m_man.cross_angle, curveLeft(), down_curve.x, down_curve.y);
        m_stages.push_back(down_curve);
        m_stages.push_back(down_curve_end);
      }

      if (m_task != NULL)
      {
        m_task->debug("-- row stages and offsets -- ");
        for (uint8_t i = 0; i < m_stages.size(); ++i)
        {
          m_task->debug("%s | %0.2f %0.2f", m_stages[i].label,
                        m_stages[i].x, m_stages[i].y);
        }
      }

      // Other init
      m_curves = (int)std::floor(m_man.width / m_man.hstep);
      m_curr = 0;
      m_sabs = Stage("undefined", 0, 0);

      m_index = 0;
    }
Example #8
0
void nextStage() {
	stages.push_back(Stage());
	stage = &stages.back();
	stage->id = stages.size()-1;
}
Example #9
0
void	CBlender_Compile::StageSET_Alpha	(u32 a1, u32 op, u32 a2)
{
	RS.SetAlpha	(Stage(),a1,op,a2);
}
Example #10
0
void	CBlender_Compile::StageSET_Color3	(u32 a1, u32 op, u32 a2, u32 a3)
{
	RS.SetColor3(Stage(),a1,op,a2,a3);
}
Example #11
0
void	CBlender_Compile::StageSET_Color	(u32 a1, u32 op, u32 a2)
{
	RS.SetColor	(Stage(),a1,op,a2);
}
Example #12
0
void	CBlender_Compile::StageSET_Address	(u32 adr)
{
	RS.SetSAMP	(Stage(),D3DSAMP_ADDRESSU,	adr);
	RS.SetSAMP	(Stage(),D3DSAMP_ADDRESSV,	adr);
}
usa_InsertErrorMgr::usa_InsertErrorMgr()
{
   _manager = "usa_InsertErrorMgr";
   Stage( 1);
}
Example #14
0
usa_InsertDoneMgr::usa_InsertDoneMgr()
{
   _manager = "usa_InsertDoneMgr";
   Stage( 1);
}