Skip to content

Mismatched texture on bottom of wall in start dungeon #279

@afritz1

Description

@afritz1

In Arena it appears to use *BOXCAP 8 in START.INF which is WALLF.SET for the texture on the bottom of walls.

Image

Not sure how to replicate this as my loading code only knows about one texture ID for all faces of the wall (ignore the different water shading, that is intentional in this engine). This problem also extends to the roof of buildings, it's hard to know what it should be because Arena locks the camera below the top of the Y=1 block.

Image

const int textureIndex = mostSigByte - 1;

	void writeVoxelInfoForMAP1(ArenaTypes::VoxelID map1Voxel, uint8_t mostSigNibble, MapType mapType, const INFFile &inf,
		const ExeData &exeData, ArenaTypes::VoxelType *outVoxelType, ArenaMeshUtils::ShapeInitCache *outShapeInitCache,
		TextureAsset *outTextureAsset0, TextureAsset *outTextureAsset1, TextureAsset *outTextureAsset2, bool *outIsCollider,
		VoxelFacing2D *outFacing)
	{
		DebugAssert(map1Voxel != 0);
		DebugAssert(mostSigNibble != 0x8);

		if ((map1Voxel & 0x8000) == 0)
		{
			const uint8_t mostSigByte = ArenaLevelUtils::getVoxelMostSigByte(map1Voxel);
			const uint8_t leastSigByte = ArenaLevelUtils::getVoxelLeastSigByte(map1Voxel);
			const bool voxelIsSolid = mostSigByte == leastSigByte;

			if (voxelIsSolid)
			{
				// Regular solid wall.
				*outVoxelType = ArenaTypes::VoxelType::Wall;
				outShapeInitCache->initDefaultBoxValues();
				ArenaMeshUtils::WriteWallRendererGeometryBuffers(outShapeInitCache->verticesView, outShapeInitCache->normalsView, outShapeInitCache->texCoordsView);
				ArenaMeshUtils::WriteWallRendererIndexBuffers(outShapeInitCache->opaqueIndices0View, outShapeInitCache->opaqueIndices1View, outShapeInitCache->opaqueIndices2View);

				const int textureIndex = mostSigByte - 1;
				const int clampedTextureID = ArenaVoxelUtils::clampVoxelTextureID(textureIndex);
				std::string voxelTextureFilename = ArenaVoxelUtils::getVoxelTextureFilename(clampedTextureID, inf);
				const std::optional<int> voxelTextureSetIndex = ArenaVoxelUtils::getVoxelTextureSetIndex(clampedTextureID, inf);
				*outTextureAsset0 = TextureAsset(std::move(voxelTextureFilename), voxelTextureSetIndex);
				*outTextureAsset1 = *outTextureAsset0;
				*outTextureAsset2 = *outTextureAsset0;

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions