コード例 #1
0
ファイル: objwatr.cpp プロジェクト: gerstrong/fheroes2plus
int ObjWat2::GetPassable(u32 index)
{
#if (__GNUC__ == 4 && __GNUC_MINOR__ == 4)
    // fixed: array subscript is above array bounds
    const u8 disabled[] = { 11, 12, 19, 22, 255 };
#else
    const u8 disabled[] = { 11, 12, 19, 22 };
#endif
    const u8 restricted[] = { 2, 20 };

    if(isShadow(index))
        return DIRECTION_ALL;
    else
    if(10 == index)
        return Direction::CENTER | Direction::TOP | Direction::LEFT | Direction::TOP_LEFT;
    else
    if(22 == index)
        return DIRECTION_CENTER_ROW | Direction::BOTTOM | Direction::BOTTOM_LEFT;
    else
    if(isAction(index) ||
        ARRAY_COUNT_END(disabled) != std::find(disabled, ARRAY_COUNT_END(disabled), index))
        return 0;

    return ARRAY_COUNT_END(restricted) != std::find(restricted, ARRAY_COUNT_END(restricted), index) ?
            DIRECTION_CENTER_ROW | DIRECTION_BOTTOM_ROW : DIRECTION_ALL;
}
コード例 #2
0
ファイル: mounts.cpp プロジェクト: mastermind-/free-heroes
int ObjMnts2::GetPassable(int icn, u32 index)
{
    const u8 disabled1[] = { 6, 7, 8, 9, 14, 15, 16, 28, 29, 30, 31, 33, 34, 35, 50, 51, 52, 65, 77, 78, 87, 94, 99, 112 };

    if(isShadow(index)) return DIRECTION_ALL;
    // fix: disable passable: invalid top sprite
    if(icn == ICN::MTNDIRT &&
	(73 == index || 84 == index || 86 == index))
        return 0;

    return ARRAY_COUNT_END(disabled1) != std::find(disabled1, ARRAY_COUNT_END(disabled1), index) ?
	0 : DIRECTION_CENTER_ROW | DIRECTION_BOTTOM_ROW;
}
コード例 #3
0
ファイル: mounts.cpp プロジェクト: mastermind-/free-heroes
int ObjMnts1::GetPassable(int icn, u32 index)
{
    const u8 disabled2[] = { 6, 7, 8, 9, 14, 15, 16, 28, 29, 30, 31, 33, 34, 35, 47, 48, 56, 57, 64, 67, 68, 69, 82 };

    if(isShadow(index)) return DIRECTION_ALL;
    else
    // fix: disable passable: invalid top sprite
    if(icn == ICN::MTNGRAS &&
        (25 == index || 43 == index || 44 == index || 53 == index || 54 == index || 78 == index))
        return 0;

    return ARRAY_COUNT_END(disabled2) != std::find(disabled2, ARRAY_COUNT_END(disabled2), index) ?
	0 : DIRECTION_CENTER_ROW | DIRECTION_BOTTOM_ROW;
}
コード例 #4
0
ファイル: objdirt.cpp プロジェクト: asimonov-im/fheroes2
u16 ObjDirt::GetPassable(const u8 & index)
{
    const u8 disabled[] = { 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 48, 49, 50, 51 };
    const u8 restricted[] = { 7, 9, 12, 13, 15, 16, 17, 18 ,19, 20, 21, 22, 40, 41, 42, 43, 44, 45,
	53, 54, 55, 56, 57, 58, 60, 61, 63, 64, 66, 67, 69, 71, 73, 74, 76, 77, 79, 80, 82, 83, 85,
	86, 88, 89, 90, 92, 93, 98, 99, 101, 102, 104, 105, 118, 123, 127, 130, 133, 134, 137, 139,
	152, 189 };

    if(isShadow(index))
        return DIRECTION_ALL;
    else
    if(isAction(index) ||
	ARRAY_COUNT_END(disabled) != std::find(disabled, ARRAY_COUNT_END(disabled), index))
        return 0;

   return ARRAY_COUNT_END(restricted) != std::find(restricted, ARRAY_COUNT_END(restricted), index) ?
            DIRECTION_CENTER_ROW | DIRECTION_BOTTOM_ROW : DIRECTION_ALL;
}
コード例 #5
0
ファイル: objwatr.cpp プロジェクト: gerstrong/fheroes2plus
int ObjWatr::GetPassable(u32 index)
{
#if (__GNUC__ == 4 && __GNUC_MINOR__ == 4)
    // fixed: array subscript is above array bounds
    const u8 disabled[] = { 11, 12, 19, 22, 255 };
#else
    const u8 disabled[] = { 11, 12, 19, 22 };
#endif
    const u8 restricted[] = { 69, 182, 183, 185, 186, 187, 248 };

    if(isShadow(index))
        return DIRECTION_ALL;
    else
    if(isAction(index) ||
        ARRAY_COUNT_END(disabled) != std::find(disabled, ARRAY_COUNT_END(disabled), index))
        return 0;

    return ARRAY_COUNT_END(restricted) != std::find(restricted, ARRAY_COUNT_END(restricted), index) ?
            DIRECTION_CENTER_ROW | DIRECTION_BOTTOM_ROW : DIRECTION_ALL;
}
コード例 #6
0
ファイル: aflDirect3DWorld.cpp プロジェクト: mofon001/AflLib
bool World::render(RenderFrame* pRenderFrame,RenderMesh** ppRenderMesh,INT iMeshCount)
{
	//デバイスの状況チェック
	if(!isDeviceActive())
		return false;
	IDirect3DDevice9* pd3dDevice = Device::getInterface();
	if(!pd3dDevice)
		return false;

	m_screen.setTarget();
 
	//描画先のクリア
	if(Device::getCaps()->StencilCaps)
	{
		pd3dDevice->Clear( 0, NULL, D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, m_colorClear, 1.0f, 0 );
		pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET , m_colorClear, 1.0f, 0 );
	}
	else
		pd3dDevice->Clear( 0, NULL, D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET, m_colorClear, 1.0f, 0 );

	if(m_camera)
	{
		//カメラ位置設定
		m_camera->setAngle(Device::getTargetWidth(),Device::getTargetHeight());
		//投影設定
		pd3dDevice->SetTransform( D3DTS_PROJECTION, (D3DMATRIX*)&m_camera->getProjection());
	}
	//ライト設定
	std::vector<Light>::iterator itLight;
	INT i;
	for(i=0,itLight=m_light.begin();itLight != m_light.end();++itLight,i++)
	{
		if((*itLight).isEnable())
		{
			pd3dDevice->SetLight( i, &*itLight);
			pd3dDevice->LightEnable(i,true);
		}
		else
			pd3dDevice->LightEnable(i,false);
	}
	//フォグの設定
	if(m_fog.isEnable())
	{
		FLOAT fStart = m_fog.getFogStart();
		FLOAT fEnd = m_fog.getFogEnd();
		DWORD dwColor = m_fog.getFogColor();

		pd3dDevice->SetRenderState(D3DRS_FOGENABLE, true);
		pd3dDevice->SetRenderState(D3DRS_FOGCOLOR, dwColor);
		pd3dDevice->SetRenderState(D3DRS_FOGTABLEMODE, D3DFOG_LINEAR);
		pd3dDevice->SetRenderState(D3DRS_FOGSTART, *(LPDWORD)&fStart);
		pd3dDevice->SetRenderState(D3DRS_FOGEND,   *(LPDWORD)&fEnd);
	}
	else
		pd3dDevice->SetRenderState(D3DRS_FOGENABLE, false);

	//描画開始
	pd3dDevice->BeginScene();
	if(ppRenderMesh)
	{
		for(i=0;i<iMeshCount;i++)
		{
			if(ppRenderMesh[i]->renderFrame->renderUnit->unit->isView2D())
				break;
			drawImage(pRenderFrame,ppRenderMesh[i]);
		}
	}

	//影描画処理
	if(isShadow() && Device::getCaps()->StencilCaps && i)
	{
		DWORD color = 0x30050505;
		struct VECTCOLOR
		{
			D3DVECTOR vect;
			FLOAT w;
			DWORD col;
		}vectDraw[]=
		{
			0,0,0,1,color,
			(FLOAT)Device::getTargetWidth()-1,0,0,1,color,
			(FLOAT)Device::getTargetWidth()-1,(FLOAT)Device::getTargetHeight()-1,0,1,color,
			0,(FLOAT)Device::getTargetHeight()-1,0,1,color
		};
		pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA   );
		pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA  );
		
		pd3dDevice->SetRenderState(D3DRS_STENCILENABLE,true);
		pd3dDevice->SetRenderState(D3DRS_ZENABLE,D3DZB_FALSE);
		pd3dDevice->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_LESSEQUAL);
		pd3dDevice->SetRenderState(D3DRS_STENCILREF, 1);
		pd3dDevice->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE);
		pd3dDevice->SetTexture(0,NULL);
		pd3dDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN ,2,vectDraw,sizeof(VECTCOLOR));
		pd3dDevice->SetRenderState(D3DRS_STENCILENABLE,false);
	}
	
	for(;i<iMeshCount;i++)
	{
		if(!ppRenderMesh[i]->renderFrame->renderUnit->unit->isView2D())
			break;
		drawImage(pRenderFrame,ppRenderMesh[i]);
	}


	pd3dDevice->EndScene();

	return true;
}