Ejemplo n.º 1
0
void Light::init(bool create, ObjectTypePtr _type)
{
	//-------------------------------------------
	// Initialize the Light Appearance here.
	GameObject::init(create, _type);
	setFlag(OBJECT_FLAG_JUSTCREATED, true);
	setFlag(OBJECT_FLAG_TANGIBLE, false);
	//-------------------------------------------------------------
	// The appearance is initialized here using data from the type
#ifdef USE_LIGHT_APPEARANCE
	uint32_t appearanceType = _type->getAppearanceTypeNum();
	AppearanceTypePtr lightAppearanceType = appearanceTypeList->getAppearance(appearanceType);
	if(!lightAppearanceType)
		return(NO_APPEARANCE_TYPE_FOR_EXPL);
	//--------------------------------------------------------------
	// The only kind of appearanceType the explosions currently know how
	// to work with is a spriteTree.  Anything else is wrong.
	if(lightAppearanceType->getAppearanceClass() == VFX_APPEAR)
	{
		lightAppearance = new VFXAppearance;
		if(!lightAppearance)
			return(NO_APPEARANCE_FOR_EXPL);
		result = lightAppearance->init((VFXAppearanceType*)lightAppearanceType, (GameObjectPtr)this);
		if(result != NO_ERROR)
			return(result);
	}
	else
	{
		return(APPEARANCE_NOT_VFX_XPL);
	}
#endif
	objectClass = KLIEG_LIGHT;
	setFlag(OBJECT_FLAG_DONE, false);
}
Ejemplo n.º 2
0
//---------------------------------------------------------------------------
int32_t GameCamera::activate(void)
{
	//------------------------------------------
	// If camera is already active, just return
	if (ready && active)
		return (NO_ERROR);
	//---------------------------------------------------------
	// Camera always starts pointing at first mover in lists
	// CANNOT be infinite because we don't allow missions without at least 1
	// player mech!!
	MoverPtr firstMover = nullptr;
	if (ObjectManager->getNumMovers() > 0)
	{
		int32_t i  = 0;
		firstMover = ObjectManager->getMover(i);
		while (firstMover &&
			((firstMover->getCommander()->getId() != Commander::home->getId()) ||
				!firstMover->isOnGUI()))
		{
			i++;
			if (i == ObjectManager->getNumMovers())
				break;
			firstMover = ObjectManager->getMover(i);
		}
	}
	if (firstMover)
	{
		Stuff::Vector3D newPosition(firstMover->getPosition());
		setPosition(newPosition);
	}
	if (land)
	{
		land->update();
	}
	allNormal();
	// updateDaylight(true);
	lastShadowLightPitch = lightPitch;
	// Startup the SKYBox
	int32_t appearanceType					= (GENERIC_APPR_TYPE << 24);
	AppearanceTypePtr genericAppearanceType = nullptr;
	genericAppearanceType = appearanceTypeList->getAppearance(appearanceType, "skybox");
	if (!genericAppearanceType)
	{
		char msg[1024];
		sprintf(msg, "No Generic Appearance Named %s", "skybox");
		Fatal(0, msg);
	}
	theSky = new GenericAppearance;
	gosASSERT(theSky != nullptr);
	//--------------------------------------------------------------
	gosASSERT(genericAppearanceType->getAppearanceClass() == GENERIC_APPR_TYPE);
	theSky->init((GenericAppearanceType*)genericAppearanceType, nullptr);
	theSky->setSkyNumber(mission->theSkyNumber);
	return NO_ERROR;
}