示例#1
0
	static int WINAPI DllPrint(LPSTR str, unsigned long i)
	{
		if (Log)
		{
			char Buf[256];
			char *Out = Buf;
			for (char *In = str; 1; In++)
			{
				if (!*In OR *In == '\n')
				{
					*Out++ = 0;

					if (Buf[0] AND
						!stristr(Buf, "adding:") AND
						!stristr(Buf, "deflated"))
					{
						Log->Log(Buf, stristr(Buf, "zip error") ? Rgb24(128, 0, 0) : Rgb24(0x80, 0x80, 0x80));
					}

					Out = Buf;

					if (!*In) break;
				}
				else if (*In == '\t')
				{
					*Out++ = ' ';
					*Out++ = ' ';
					*Out++ = ' ';
				}
				else
				{
					*Out++ = *In;
				}
			}
		}
		return 0;
	}
示例#2
0
	void Terrain::_OnLoadSetting()
	{
		mLayers.Clear();

		rml_node * node = World::Instance()->GetSetting()->first_node("Terrain");
		if (node != NULL)
		{
			mInfo.Serialize(node, false);

			rml_node * layerNode = node->first_node("Layer");
			while (layerNode != NULL)
			{
				Layer layer;
				layer.Serialize(layerNode, false);
				mLayers.PushBack(layer);

				layerNode = layerNode->next_sibling("Layer");
			}
		}

		d_assert (mInfo.BlocksPerSection.x > 0 && mInfo.BlocksPerSection.y > 0);

		const World::Info * wi = World::Instance()->GetInfo();

		mInfo.BlockCount = wi->SectionCount * mInfo.BlocksPerSection;
		mInfo.GridCount = mInfo.BlockCount * Int2(kMeshGridCount, kMeshGridCount);
		mInfo.VertexCount = mInfo.GridCount + Int2(1, 1);

		mInfo.GridSize = wi->SectionSize.x / (kMeshGridCount * mInfo.BlocksPerSection.x);
		mInfo.BlockSize = mInfo.GridSize * kMeshGridCount;

		mInfo.InvGridSize = 1 / mInfo.GridSize;
		mInfo.InvBlockSize = 1 / mInfo.BlockSize;

		mInfo.Size.x = mInfo.BlockSize * mInfo.BlockCount.x;
		mInfo.Size.y = mInfo.BlockSize * mInfo.BlockCount.y;
		mInfo.InvSize = Float2(1, 1) / mInfo.Size;

		if (node != NULL)
		{
			mHeights.Resize(mInfo.VertexCount.x * mInfo.VertexCount.y);
			for (int i = 0; i < mHeights.Size(); ++i)
			{
				mHeights[i] = mInfo.DefaultHeight;
			}

			mNormals.Resize(mInfo.VertexCount.x * mInfo.VertexCount.y);
			for (int i = 0; i < mNormals.Size(); ++i)
			{
				mNormals[i] = Rgb24(128, 255, 128);
			}

			mMeshes = new TerrainMesh[mInfo.BlockCount.x * mInfo.BlockCount.y];
			for (int j = 0; j < mInfo.BlockCount.y; ++j)
			{
				for (int i = 0; i < mInfo.BlockCount.x; ++i)
				{
					mMeshes[j * mInfo.BlockCount.x + i].Init(Int2(i, j));
				}
			}
		}
	}
示例#3
0
文件: GScreenDC.cpp 项目: FEI17N/Lgi
COLOUR GScreenDC::Colour()
{
	rgb_color Rgb = d->View->HighColor();
	return CBit(GetBits(), Rgb24(Rgb.red, Rgb.green, Rgb.blue), 24);
}