mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 08:47:17 +01:00
Use 'color' instead of 'colour' internally and expose aliases to both for the script interface.
This commit is contained in:
parent
a64fa8a3a1
commit
07d37831b9
@ -147,8 +147,8 @@ static const EnumElement g_EventEnum[] = {
|
||||
{_SC("PlayerWantedLevel"), EVT_PLAYERWANTEDLEVEL},
|
||||
{_SC("PlayerImmunity"), EVT_PLAYERIMMUNITY},
|
||||
{_SC("PlayerAlpha"), EVT_PLAYERALPHA},
|
||||
{_SC("VehicleColor"), EVT_VEHICLECOLOUR},
|
||||
{_SC("VehicleColour"), EVT_VEHICLECOLOUR},
|
||||
{_SC("VehicleColor"), EVT_VEHICLECOLOR},
|
||||
{_SC("VehicleColour"), EVT_VEHICLECOLOR},
|
||||
{_SC("VehicleHealth"), EVT_VEHICLEHEALTH},
|
||||
{_SC("VehiclePosition"), EVT_VEHICLEPOSITION},
|
||||
{_SC("VehicleRotation"), EVT_VEHICLEROTATION},
|
||||
|
@ -482,8 +482,8 @@ protected:
|
||||
SQInteger mTrackRotation; // The number of times to track rotation changes.
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
Int32 mLastPrimaryColour; // Last known secondary-color of the player entity.
|
||||
Int32 mLastSecondaryColour; // Last known primary-color of the player entity.
|
||||
Int32 mLastPrimaryColor; // Last known secondary-color of the player entity.
|
||||
Int32 mLastSecondaryColor; // Last known primary-color of the player entity.
|
||||
Float32 mLastHealth; // Last known health of the player entity.
|
||||
Vector3 mLastPosition; // Last known position of the player entity.
|
||||
Quaternion mLastRotation; // Last known rotation of the player entity.
|
||||
@ -499,7 +499,7 @@ protected:
|
||||
Function mOnExplode;
|
||||
Function mOnRespawn;
|
||||
Function mOnUpdate;
|
||||
Function mOnColour;
|
||||
Function mOnColor;
|
||||
Function mOnHealth;
|
||||
Function mOnPosition;
|
||||
Function mOnRotation;
|
||||
@ -1041,7 +1041,7 @@ public:
|
||||
void EmitPlayerWantedLevel(Int32 player_id, Int32 old_level, Int32 new_level);
|
||||
void EmitPlayerImmunity(Int32 player_id, Int32 old_immunity, Int32 new_immunity);
|
||||
void EmitPlayerAlpha(Int32 player_id, Int32 old_alpha, Int32 new_alpha, Int32 fade);
|
||||
void EmitVehicleColour(Int32 vehicle_id, Int32 changed);
|
||||
void EmitVehicleColor(Int32 vehicle_id, Int32 changed);
|
||||
void EmitVehicleHealth(Int32 vehicle_id, Float32 old_health, Float32 new_health);
|
||||
void EmitVehiclePosition(Int32 vehicle_id);
|
||||
void EmitVehicleRotation(Int32 vehicle_id);
|
||||
@ -1203,7 +1203,7 @@ private:
|
||||
Function mOnPlayerWantedLevel;
|
||||
Function mOnPlayerImmunity;
|
||||
Function mOnPlayerAlpha;
|
||||
Function mOnVehicleColour;
|
||||
Function mOnVehicleColor;
|
||||
Function mOnVehicleHealth;
|
||||
Function mOnVehiclePosition;
|
||||
Function mOnVehicleRotation;
|
||||
|
@ -870,11 +870,11 @@ void Core::EmitPlayerAlpha(Int32 player_id, Int32 old_alpha, Int32 new_alpha, In
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Core::EmitVehicleColour(Int32 vehicle_id, Int32 changed)
|
||||
void Core::EmitVehicleColor(Int32 vehicle_id, Int32 changed)
|
||||
{
|
||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
||||
Emit(_vehicle.mOnColour, changed);
|
||||
Emit(mOnVehicleColour, _vehicle.mObj, changed);
|
||||
Emit(_vehicle.mOnColor, changed);
|
||||
Emit(mOnVehicleColor, _vehicle.mObj, changed);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -1224,25 +1224,25 @@ void Core::EmitVehicleUpdate(Int32 vehicle_id, vcmpVehicleUpdate update_type)
|
||||
case vcmpVehicleUpdateColour:
|
||||
{
|
||||
Int32 primary, secondary;
|
||||
// Obtain the current colours of this instance
|
||||
// Obtain the current colors of this instance
|
||||
_Func->GetVehicleColour(vehicle_id, &primary, &secondary);
|
||||
// Which colours changed
|
||||
// Which colors changed
|
||||
Int32 changed = 0;
|
||||
// Did the primary colour changed?
|
||||
if (primary != inst.mLastPrimaryColour)
|
||||
// Did the primary color changed?
|
||||
if (primary != inst.mLastPrimaryColor)
|
||||
{
|
||||
changed |= (1<<0);
|
||||
}
|
||||
// Did the secondary colour changed?
|
||||
if (primary != inst.mLastSecondaryColour)
|
||||
// Did the secondary color changed?
|
||||
if (primary != inst.mLastSecondaryColor)
|
||||
{
|
||||
changed |= (1<<1);
|
||||
}
|
||||
// Trigger the event specific to this change
|
||||
EmitVehicleColour(vehicle_id, changed);
|
||||
EmitVehicleColor(vehicle_id, changed);
|
||||
// Update the tracked value
|
||||
inst.mLastPrimaryColour = primary;
|
||||
inst.mLastSecondaryColour = secondary;
|
||||
inst.mLastPrimaryColor = primary;
|
||||
inst.mLastSecondaryColor = secondary;
|
||||
} break;
|
||||
case vcmpVehicleUpdateRotation:
|
||||
{
|
||||
|
@ -111,8 +111,8 @@ void Core::ResetInst(VehicleInst & inst)
|
||||
inst.mFlags = ENF_DEFAULT;
|
||||
inst.mTrackPosition = 0;
|
||||
inst.mTrackRotation = 0;
|
||||
inst.mLastPrimaryColour = -1;
|
||||
inst.mLastSecondaryColour = -1;
|
||||
inst.mLastPrimaryColor = -1;
|
||||
inst.mLastSecondaryColor = -1;
|
||||
inst.mLastHealth = 0.0;
|
||||
inst.mLastPosition.Clear();
|
||||
inst.mLastRotation.Clear();
|
||||
@ -258,7 +258,7 @@ void Core::ResetFunc(VehicleInst & inst)
|
||||
inst.mOnExplode.ReleaseGently();
|
||||
inst.mOnRespawn.ReleaseGently();
|
||||
inst.mOnUpdate.ReleaseGently();
|
||||
inst.mOnColour.ReleaseGently();
|
||||
inst.mOnColor.ReleaseGently();
|
||||
inst.mOnHealth.ReleaseGently();
|
||||
inst.mOnPosition.ReleaseGently();
|
||||
inst.mOnRotation.ReleaseGently();
|
||||
@ -384,7 +384,7 @@ void Core::ResetFunc()
|
||||
Core::Get().mOnPlayerWantedLevel.ReleaseGently();
|
||||
Core::Get().mOnPlayerImmunity.ReleaseGently();
|
||||
Core::Get().mOnPlayerAlpha.ReleaseGently();
|
||||
Core::Get().mOnVehicleColour.ReleaseGently();
|
||||
Core::Get().mOnVehicleColor.ReleaseGently();
|
||||
Core::Get().mOnVehicleHealth.ReleaseGently();
|
||||
Core::Get().mOnVehiclePosition.ReleaseGently();
|
||||
Core::Get().mOnVehicleRotation.ReleaseGently();
|
||||
@ -515,7 +515,7 @@ Function & Core::GetEvent(Int32 evid)
|
||||
case EVT_PLAYERWANTEDLEVEL: return mOnPlayerWantedLevel;
|
||||
case EVT_PLAYERIMMUNITY: return mOnPlayerImmunity;
|
||||
case EVT_PLAYERALPHA: return mOnPlayerAlpha;
|
||||
case EVT_VEHICLECOLOUR: return mOnVehicleColour;
|
||||
case EVT_VEHICLECOLOR: return mOnVehicleColor;
|
||||
case EVT_VEHICLEHEALTH: return mOnVehicleHealth;
|
||||
case EVT_VEHICLEPOSITION: return mOnVehiclePosition;
|
||||
case EVT_VEHICLEROTATION: return mOnVehicleRotation;
|
||||
@ -713,7 +713,7 @@ Function & Core::GetVehicleEvent(Int32 id, Int32 evid)
|
||||
case EVT_VEHICLEEXPLODE: return inst.mOnExplode;
|
||||
case EVT_VEHICLERESPAWN: return inst.mOnRespawn;
|
||||
case EVT_VEHICLEUPDATE: return inst.mOnUpdate;
|
||||
case EVT_VEHICLECOLOUR: return inst.mOnColour;
|
||||
case EVT_VEHICLECOLOR: return inst.mOnColor;
|
||||
case EVT_VEHICLEHEALTH: return inst.mOnHealth;
|
||||
case EVT_VEHICLEPOSITION: return inst.mOnPosition;
|
||||
case EVT_VEHICLEROTATION: return inst.mOnRotation;
|
||||
|
@ -1158,21 +1158,21 @@ void CVehicle::SetTrackRotation(SQInteger num) const
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Int32 CVehicle::GetLastPrimaryColour() const
|
||||
Int32 CVehicle::GetLastPrimaryColor() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Return the requested information
|
||||
return Core::Get().GetVehicle(m_ID).mLastPrimaryColour;
|
||||
return Core::Get().GetVehicle(m_ID).mLastPrimaryColor;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Int32 CVehicle::GetLastSecondaryColour() const
|
||||
Int32 CVehicle::GetLastSecondaryColor() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Return the requested information
|
||||
return Core::Get().GetVehicle(m_ID).mLastSecondaryColour;
|
||||
return Core::Get().GetVehicle(m_ID).mLastSecondaryColor;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -1813,6 +1813,8 @@ void Register_CVehicle(HSQUIRRELVM vm)
|
||||
.Prop(_SC("Health"), &CVehicle::GetHealth, &CVehicle::SetHealth)
|
||||
.Prop(_SC("PrimaryColor"), &CVehicle::GetPrimaryColor, &CVehicle::SetPrimaryColor)
|
||||
.Prop(_SC("SecondaryColor"), &CVehicle::GetSecondaryColor, &CVehicle::SetSecondaryColor)
|
||||
.Prop(_SC("PrimaryColour"), &CVehicle::GetPrimaryColor, &CVehicle::SetPrimaryColor)
|
||||
.Prop(_SC("SecondaryColour"), &CVehicle::GetSecondaryColor, &CVehicle::SetSecondaryColor)
|
||||
.Prop(_SC("DamageData"), &CVehicle::GetDamageData, &CVehicle::SetDamageData)
|
||||
.Prop(_SC("Radio"), &CVehicle::GetRadio, &CVehicle::SetRadio)
|
||||
.Prop(_SC("TurretRotation"), &CVehicle::GetTurretRotation)
|
||||
@ -1822,8 +1824,10 @@ void Register_CVehicle(HSQUIRRELVM vm)
|
||||
.Prop(_SC("VerticalTurretRotation"), &CVehicle::GetVerticalTurretRotation)
|
||||
.Prop(_SC("TrackPosition"), &CVehicle::GetTrackPosition, &CVehicle::SetTrackPosition)
|
||||
.Prop(_SC("TrackRotation"), &CVehicle::GetTrackRotation, &CVehicle::SetTrackRotation)
|
||||
.Prop(_SC("LastPrimaryColour"), &CVehicle::GetLastPrimaryColour)
|
||||
.Prop(_SC("LastSecondaryColour"), &CVehicle::GetLastSecondaryColour)
|
||||
.Prop(_SC("LastPrimaryColor"), &CVehicle::GetLastPrimaryColor)
|
||||
.Prop(_SC("LastSecondaryColor"), &CVehicle::GetLastSecondaryColor)
|
||||
.Prop(_SC("LastPrimaryColour"), &CVehicle::GetLastPrimaryColor)
|
||||
.Prop(_SC("LastSecondaryColour"), &CVehicle::GetLastSecondaryColor)
|
||||
.Prop(_SC("LastHealth"), &CVehicle::GetLastHealth)
|
||||
.Prop(_SC("LastPosition"), &CVehicle::GetLastPosition)
|
||||
.Prop(_SC("LastRotation"), &CVehicle::GetLastRotation)
|
||||
|
@ -640,12 +640,12 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the last known primary color for the managed vehicle entity.
|
||||
*/
|
||||
Int32 GetLastPrimaryColour() const;
|
||||
Int32 GetLastPrimaryColor() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the last known secondary color for the managed vehicle entity.
|
||||
*/
|
||||
Int32 GetLastSecondaryColour() const;
|
||||
Int32 GetLastSecondaryColor() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the last known health for the managed vehicle entity.
|
||||
|
@ -442,6 +442,7 @@ Table GetWastedSettings()
|
||||
tbl.SetValue(_SC("FadeTimer"), ft);
|
||||
tbl.SetValue(_SC("FadeInSpeed"), fis);
|
||||
tbl.SetValue(_SC("FadeOutSpeed"), fos);
|
||||
tbl.SetValue(_SC("FadeColor"), c);
|
||||
tbl.SetValue(_SC("FadeColour"), c);
|
||||
tbl.SetValue(_SC("CorpseFadeStart"), cfs);
|
||||
tbl.SetValue(_SC("CorpseFadeTime"), cft);
|
||||
|
@ -394,7 +394,7 @@ enum EventType
|
||||
EVT_PLAYERWANTEDLEVEL,
|
||||
EVT_PLAYERIMMUNITY,
|
||||
EVT_PLAYERALPHA,
|
||||
EVT_VEHICLECOLOUR,
|
||||
EVT_VEHICLECOLOR,
|
||||
EVT_VEHICLEHEALTH,
|
||||
EVT_VEHICLEPOSITION,
|
||||
EVT_VEHICLEROTATION,
|
||||
|
Loading…
Reference in New Issue
Block a user