Пример #1
0
void TESObjectARMA::GetNodeName(char * dstBuff, TESObjectREFR * refr, TESObjectARMO * armor, float weightOverride)
{
	float weight = 100.0;
	TESNPC * npc = DYNAMIC_CAST(refr->baseForm, TESForm, TESNPC);
	if(npc && npc->nextTemplate) {
		TESNPC * temp = npc->GetRootTemplate();
		if(temp) {
			weight = temp->weight;
		}
	}
	else
		weight = CALL_MEMBER_FN(refr, GetWeight)();

	weight /= 100.0;
	if(weightOverride >= 0.0) // Determines whether to factor weight into the name, -1 true, 1 false
		weight = weightOverride;

	weight *= 100.0;
	
	UInt32 sex = npc ? CALL_MEMBER_FN(npc, GetSex)() : 0;
	/*sprintf_s(dstBuff, MAX_PATH, "%s (%08X)[%d]/%s (%08X) [%2.0f%%]", 
		this->Unk_32(), // I really have no idea why they used a string here for a boolean value, probably legacy code
		this->formID,
		sex,
		armor->Unk_32(), 
		armor->formID, 
		weight);*/
	sprintf_s(dstBuff, MAX_PATH, " (%08X)[%d]/ (%08X) [%2.0f%%]", 
		this->formID,
		sex,
		armor->formID, 
		weight);
}
	void ReplaceHeadPart(Actor * thisActor, BGSHeadPart * oldPart, BGSHeadPart * newPart)
	{
		BSTaskPool * taskPool = BSTaskPool::GetSingleton();
		if(!taskPool || !thisActor || !newPart)
			return;

		TESNPC* npc = DYNAMIC_CAST(thisActor->baseForm, TESForm, TESNPC);
		if(npc) {
			if(!oldPart) {
				oldPart = npc->GetCurrentHeadPartByType(newPart->type);
			}
			if(newPart->type != BGSHeadPart::kTypeMisc && oldPart && oldPart->type == newPart->type) {
				taskPool->ChangeHeadPart(thisActor, oldPart, newPart);
			}
		}
	}
	void ChangeHeadPart(Actor * thisActor, BGSHeadPart * newPart)
	{
		BSTaskPool * taskPool = BSTaskPool::GetSingleton();
		if(!taskPool || !thisActor || !newPart)
			return;

		TESNPC* npc = DYNAMIC_CAST(thisActor->baseForm, TESForm, TESNPC);
		if(npc) {
			if(newPart->type != BGSHeadPart::kTypeMisc) {
				BGSHeadPart * oldPart = npc->GetCurrentHeadPartByType(newPart->type);

				// Alters the ActorBase's HeadPart list
				CALL_MEMBER_FN(npc, ChangeHeadPart)(newPart);

				// Alters the loaded mesh
				taskPool->ChangeHeadPart(thisActor, oldPart, newPart);
			}
		}
	}
Пример #4
0
NiTriBasedGeom * GetHeadTriBasedGeom(Actor * actor, UInt32 partType)
{
	BSFaceGenNiNode * faceNode = actor->GetFaceGenNiNode();
	TESNPC * actorBase = DYNAMIC_CAST(actor->baseForm, TESForm, TESNPC);

	if(faceNode && actorBase) {
		BGSHeadPart * facePart = actorBase->GetCurrentHeadPartByType(partType);
		if(facePart) {
			NiAVObject * headNode = faceNode->GetObjectByName(&facePart->partName.data);
			if(headNode) {
				NiTriBasedGeom * geometry = headNode->GetAsNiTriBasedGeom();
				if(geometry)
					return geometry;
			}
		}
	}

	return NULL;
}