Beispiel #1
0
	// /////////////////////////////////////////////////////////////////
	// 
	// /////////////////////////////////////////////////////////////////
	bool BallActorParams::VInit(LuaPlus::LuaObject srcData, TErrorMessageList &errorMessages)
	{
		if (!Pool3dActorParams::VInit(srcData, errorMessages))
		{
			return (false);
		}

		VSetType(AT_Ball);

		LuaPlus::LuaObject rObj = srcData["Radius"];
		if(rObj.IsNumber())
		{
			m_radius = static_cast<F32>(rObj.GetNumber());
		}
		LuaPlus::LuaObject slObj = srcData["Slices"];
		if(slObj.IsInteger())
		{
			m_slices = slObj.GetInteger();
		}
		LuaPlus::LuaObject stObj = srcData["Stacks"];
		if(stObj.IsInteger())
		{
			m_stacks = stObj.GetInteger();
		}
		LuaPlus::LuaObject groupObj = srcData["Group"];
		if(groupObj.IsString())
		{
			const char *groupStr = groupObj.GetString();
			if(strcmp(groupStr, "cue") == 0)
			{
				m_group = eCue;
			}
			else if(strcmp(groupStr, "stripes") == 0)
			{
				m_group = eStripes;
			}
			else if(strcmp(groupStr, "plain") == 0)
			{
				m_group = ePlain;
			}
			else if(strcmp(groupStr, "black") == 0)
			{
				m_group = eBlack;
			}
			else
			{
				m_group = eCue;
			}
		}

		return (true);
	}
Beispiel #2
0
bool EvtData_StartJump::buildEventFromScript(void)
{
	if (m_eventData.IsTable())
	{
		// ID
		LuaPlus::LuaObject temp = m_eventData.GetByName("actorId");
		if (temp.IsInteger())
		{
			m_id = temp.GetInteger();
		}
		else
		{
			GCC_ERROR("Invalid id sent to EvtData_StartJump; type = " + std::string(temp.TypeName()));
			return false;
		}

		// acceleration
		temp = m_eventData.GetByName("acceleration");
		if (temp.IsNumber())
			m_acceleration = temp.GetFloat();
		else
			m_acceleration = 5.0f;  // something reasonable

		return true;
	}

	return false;
}
    // /////////////////////////////////////////////////////////////////
    //
    // /////////////////////////////////////////////////////////////////
    bool SetIntFromLua(const LuaPlus::LuaObject &numberData, I32 &number)
    {
        if(!numberData.IsInteger()) {
            return (false);
        }

        number = numberData.GetInteger();
        return (true);
    }
 // /////////////////////////////////////////////////////////////////
 //
 // /////////////////////////////////////////////////////////////////
 void LuaStateManager::IdentifyLuaObjectType(LuaPlus::LuaObject &objToTest)
 {
     assert(!objToTest.IsNil() && "Nil!");
     assert(!objToTest.IsBoolean() && "Boolean!");
     assert(!objToTest.IsCFunction() && "C-Function!");
     assert(!objToTest.IsFunction() && "Function!");
     assert(!objToTest.IsInteger() && "Integer!");
     assert(!objToTest.IsLightUserData() && "Light User Data!");
     assert(!objToTest.IsNone() && "None!");
     assert(!objToTest.IsNumber() && "Number!");
     assert(!objToTest.IsString() && "String!");
     assert(!objToTest.IsTable() && "Table!");
     assert(!objToTest.IsUserData() && "User Data!");
     assert(!objToTest.IsWString() && "Wide String!");
     assert(0 && "UNKNOWN!");
 }
Beispiel #5
0
bool EvtData_EndAccelerating::buildEventFromScript(void)
{
	if (m_eventData.IsTable())
	{
		// ID
		LuaPlus::LuaObject temp = m_eventData.GetByName("id");
		if (temp.IsInteger())
		{
			m_id = temp.GetInteger();
		}
		else
		{
			GCC_ERROR("Invalid id sent to EvtData_EndAccelerating; type = " + std::string(temp.TypeName()));
			return false;
		}

		return true;
	}

	return false;
}
Beispiel #6
0
	// /////////////////////////////////////////////////////////////////
	// 
	// /////////////////////////////////////////////////////////////////
	bool TableActorParams::VInit(LuaPlus::LuaObject srcData, TErrorMessageList &errorMessages)
	{
		if (!Pool3dActorParams::VInit(srcData, errorMessages))
		{
			return (false);
		}

		VSetType(AT_Table);

		// Table Panels data.
		LuaPlus::LuaObject obj = srcData["FrontPanelMeshName"];
		if(obj.IsString())
		{
			SetFrontPanelMeshName(obj.GetString());
		}
		obj = srcData["SidePanelMeshName"];
		if(obj.IsString())
		{
			SetSidePanelMeshName(obj.GetString());
		}
		obj = srcData["PanelTextureName"];
		if(obj.IsString())
		{
			SetPanelTextureName(obj.GetString());
		}
		obj = srcData["PanelMaterial"];
		if(obj.IsTable())
		{
			GameColor tmp;
			if(SetColorFromLua(obj["Ambient"], tmp))
			{
				m_panelMaterial.SetAmbient(tmp);
			}
			if(SetColorFromLua(obj["Diffuse"], tmp))
			{
				m_panelMaterial.SetDiffuse(tmp);
			}
			if(SetColorFromLua(obj["Specular"], tmp))
			{
				m_panelMaterial.SetSpecular(tmp);
			}
			if(SetColorFromLua(obj["Emissive"], tmp))
			{
				m_panelMaterial.SetEmissive(tmp);
			}
			F32 tmp2;
			if(SetFloatFromLua(obj["Shininess"], tmp2))
			{
				m_panelMaterial.SetSpecularPower(tmp2);
			}
		}

		// Table pockets data.
		obj = srcData["MiddlePocketMeshName"];
		if(obj.IsString())
		{
			SetMiddlePocketMeshName(obj.GetString());
		}
		obj = srcData["CornerPocketMeshName"];
		if(obj.IsString())
		{
			SetCornerPocketMeshName(obj.GetString());
		}
		obj = srcData["PocketMaterial"];
		if(obj.IsTable())
		{
			GameColor tmp;
			if(SetColorFromLua(obj["Ambient"], tmp))
			{
				m_pocketsMaterial.SetAmbient(tmp);
			}
			if(SetColorFromLua(obj["Diffuse"], tmp))
			{
				m_pocketsMaterial.SetDiffuse(tmp);
			}
			if(SetColorFromLua(obj["Specular"], tmp))
			{
				m_pocketsMaterial.SetSpecular(tmp);
			}
			if(SetColorFromLua(obj["Emissive"], tmp))
			{
				m_pocketsMaterial.SetEmissive(tmp);
			}
			F32 tmp2;
			if(SetFloatFromLua(obj["Shininess"], tmp2))
			{
				m_pocketsMaterial.SetSpecularPower(tmp2);
			}
		}
		obj = srcData["PocketTexture"];
		if(obj.IsString())
		{
			SetPocketTextureName(obj.GetString());
		}

		obj = srcData["Width"];
		if(obj.IsNumber())
		{
			SetFloatFromLua(obj, m_width);
		}
		obj = srcData["Height"];
		if(obj.IsNumber())
		{
			SetFloatFromLua(obj, m_height);
		}
		obj = srcData["Depth"];
		if(obj.IsNumber())
		{
			SetFloatFromLua(obj, m_depth);
		}
		obj = srcData["PocketRadius"];
		if(obj.IsNumber())
		{
			SetFloatFromLua(obj, m_pocketRadius);
		}

		obj = srcData["TopLeftPocketTriggerPos"];
		if(obj.IsTable())
		{
			SetPoint3FromLua(obj, m_tlpTriggerPos);
		}
		obj = srcData["TopLeftPocketTriggerId"];
		if(obj.IsInteger())
		{
			SetIntFromLua(obj, m_tlPocketId);
		}
		obj = srcData["TopRightPocketTriggerPos"];
		if(obj.IsTable())
		{
			SetPoint3FromLua(obj, m_trpTriggerPos);
		}
		obj = srcData["TopRightPocketTriggerId"];
		if(obj.IsInteger())
		{
			SetIntFromLua(obj, m_trPocketId);
		}
		obj = srcData["BottomLeftPocketTriggerPos"];
		if(obj.IsTable())
		{
			SetPoint3FromLua(obj, m_blpTriggerPos);
		}
		obj = srcData["BottomLeftPocketTriggerId"];
		if(obj.IsInteger())
		{
			SetIntFromLua(obj, m_blPocketId);
		}
		obj = srcData["BottomRightPocketTriggerPos"];
		if(obj.IsTable())
		{
			SetPoint3FromLua(obj, m_brpTriggerPos);
		}
		obj = srcData["BottomRightPocketTriggerId"];
		if(obj.IsInteger())
		{
			SetIntFromLua(obj, m_brPocketId);
		}
		obj = srcData["MiddleLeftPocketTriggerPos"];
		if(obj.IsTable())
		{
			SetPoint3FromLua(obj, m_mlpTriggerPos);
		}
		obj = srcData["MiddleLeftPocketTriggerId"];
		if(obj.IsInteger())
		{
			SetIntFromLua(obj, m_mlPocketId);
		}
		obj = srcData["MiddleRightPocketTriggerPos"];
		if(obj.IsTable())
		{
			SetPoint3FromLua(obj, m_mrpTriggerPos);
		}
		obj = srcData["MiddleRightPocketTriggerId"];
		if(obj.IsInteger())
		{
			SetIntFromLua(obj, m_mrPocketId);
		}

		return (true);
	}
 // /////////////////////////////////////////////////////////////////
 //
 // /////////////////////////////////////////////////////////////////
 void SliderControl::SetLuaEventId(const LuaPlus::LuaObject &table)
 {
     if(table.IsInteger()) {
         m_eventTypeId = table.GetInteger();
     }
 }