-elevator music sound is now positioned properly on startup, instead of at start of play
-misc positioning fixes and cleanups
-elevator motor sounds are now children of shafts, fixing movement issues, where they were moving along with the elevator
-added Relative Position item to Move Object window, and realigned text boxes
<option>1</option>
</object>
<object class="sizeritem">
- <object class="wxStaticText" name="ID_STATICTEXT2" variable="StaticText2" member="yes">
- <label>Rotation:</label>
+ <object class="wxStaticText" name="ID_lblPosition" variable="lblPosition" member="yes">
+ <label>0, 0, 0</label>
+ <style>wxST_NO_AUTORESIZE|wxALIGN_CENTRE</style>
+ </object>
+ <flag>wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+ <border>5</border>
+ <option>1</option>
+ </object>
+ <object class="sizeritem">
+ <object class="wxStaticText" name="ID_STATICTEXT3" variable="StaticText3" member="yes">
+ <label>Relative Position:</label>
<style>wxALIGN_CENTRE</style>
</object>
<flag>wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag>
<option>1</option>
</object>
<object class="sizeritem">
- <object class="wxStaticText" name="ID_lblPosition" variable="lblPosition" member="yes">
+ <object class="wxStaticText" name="ID_STATICTEXT4" variable="lblRelPosition" member="yes">
<label>0, 0, 0</label>
- <style>wxST_NO_AUTORESIZE|wxALIGN_CENTRE</style>
+ <style>wxALIGN_CENTRE</style>
</object>
<flag>wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
<border>5</border>
<option>1</option>
</object>
<object class="sizeritem">
+ <object class="wxStaticText" name="ID_STATICTEXT2" variable="StaticText2" member="yes">
+ <label>Rotation:</label>
+ <style>wxALIGN_CENTRE</style>
+ </object>
+ <flag>wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag>
+ <border>5</border>
+ <option>1</option>
+ </object>
+ <object class="sizeritem">
<object class="wxStaticText" name="ID_lblRotation" variable="lblRotation" member="yes">
<label>0, 0, 0</label>
<style>wxST_NO_AUTORESIZE|wxALIGN_CENTRE</style>
//(*IdInit(MoveObject)
const long MoveObject::ID_STATICTEXT1 = wxNewId();
-const long MoveObject::ID_STATICTEXT2 = wxNewId();
const long MoveObject::ID_lblPosition = wxNewId();
+const long MoveObject::ID_STATICTEXT3 = wxNewId();
+const long MoveObject::ID_STATICTEXT4 = wxNewId();
+const long MoveObject::ID_STATICTEXT2 = wxNewId();
const long MoveObject::ID_lblRotation = wxNewId();
const long MoveObject::ID_STATICLINE2 = wxNewId();
const long MoveObject::ID_rPosition = wxNewId();
GridSizer1 = new wxGridSizer(0, 2, 0, 0);
StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Position:"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE, _T("ID_STATICTEXT1"));
GridSizer1->Add(StaticText1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
- StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Rotation:"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE, _T("ID_STATICTEXT2"));
- GridSizer1->Add(StaticText2, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
lblPosition = new wxStaticText(this, ID_lblPosition, _("0, 0, 0"), wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE|wxALIGN_CENTRE, _T("ID_lblPosition"));
GridSizer1->Add(lblPosition, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
+ StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("Relative Position:"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE, _T("ID_STATICTEXT3"));
+ GridSizer1->Add(StaticText3, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
+ lblRelPosition = new wxStaticText(this, ID_STATICTEXT4, _("0, 0, 0"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE, _T("ID_STATICTEXT4"));
+ GridSizer1->Add(lblRelPosition, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
+ StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Rotation:"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE, _T("ID_STATICTEXT2"));
+ GridSizer1->Add(StaticText2, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
lblRotation = new wxStaticText(this, ID_lblRotation, _("0, 0, 0"), wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE|wxALIGN_CENTRE, _T("ID_lblRotation"));
GridSizer1->Add(lblRotation, 1, wxALL|wxEXPAND|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer5->Add(GridSizer1, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
if (object)
{
Ogre::Vector3 pos = object->GetPosition();
+ Ogre::Vector3 relpos = object->GetPosition(true);
Ogre::Vector3 rot = object->GetRotation();
lblPosition->SetLabel(TruncateNumber(pos.x, 2) + wxT(", ") + TruncateNumber(pos.y, 2) + wxT(", ") + TruncateNumber(pos.z, 2));
+ lblRelPosition->SetLabel(TruncateNumber(relpos.x, 2) + wxT(", ") + TruncateNumber(relpos.y, 2) + wxT(", ") + TruncateNumber(relpos.z, 2));
lblRotation->SetLabel(TruncateNumber(rot.x, 2) + wxT(", ") + TruncateNumber(rot.y, 2) + wxT(", ") + TruncateNumber(rot.z, 2));
//move if hold vector is not zero
//(*Identifiers(MoveObject)
static const long ID_STATICTEXT1;
- static const long ID_STATICTEXT2;
static const long ID_lblPosition;
+ static const long ID_STATICTEXT3;
+ static const long ID_STATICTEXT4;
+ static const long ID_STATICTEXT2;
static const long ID_lblRotation;
static const long ID_STATICLINE2;
static const long ID_rPosition;
wxButton* bXPlus;
wxStaticText* lblPosition;
wxButton* bYNeg;
+ wxStaticText* lblRelPosition;
wxStaticText* StaticText20;
wxStaticText* StaticText1;
wxStaticText* StaticText16;
wxButton* bRotationZ;
+ wxStaticText* StaticText3;
wxTextCtrl* txtRotationX;
wxStaticText* StaticText23;
wxButton* bXNeg;
Report("creating sound objects");
carsound = new Sound(this, "Car", true);
idlesound = new Sound(this, "Idle", true);
- motorsound = new Sound(this, "Motor", true);
- motoridlesound = new Sound(this, "Motor Idle", true);
+
+ std::string motorname = "Motor " + ToString2(Number);
+ motorsound = new Sound(GetShaft(), motorname.c_str(), true);
+ motorname += " Idle";
+ motoridlesound = new Sound(GetShaft(), motorname.c_str(), true);
+
//move motor to top of shaft if location not specified, or to location
if (MotorPosition != Ogre::Vector3(0, 0, 0))
motorsound->SetPosition(Ogre::Vector3(MotorPosition.x + GetPosition().x, MotorPosition.y, MotorPosition.z + GetPosition().z));
else
{
- Shaft* shaft = GetShaft();
- if (shaft)
- {
- Floor *floor = sbs->GetFloor(shaft->endfloor);
- if (floor)
- motorsound->SetPositionY(floor->GetBase());
- }
+ Floor *floor = sbs->GetFloor(GetShaft()->endfloor);
+ if (floor)
+ motorsound->SetPositionY(floor->GetBase());
}
MotorPosition = Ogre::Vector3(motorsound->GetPosition().x - GetPosition().x, motorsound->GetPosition().y, motorsound->GetPosition().z - GetPosition().z);
motoridlesound->SetPosition(motorsound->GetPosition());
}
HeightSet = true;
- //update sound positions
- MoveObjects(0);
+ //position sounds at top of elevator car
+ Ogre::Vector3 top = Ogre::Vector3(0, Height, 0);
+ idlesound->SetPositionRelative(top);
+ alarm->SetPositionRelative(top);
+ floorbeep->SetPositionRelative(top);
+ announcesnd->SetPositionRelative(top);
+
+ //set default music position to elevator height
+ if (MusicPosition == Ogre::Vector3(0, 0, 0) && Height > 0)
+ MusicPosition = top;
+ musicsound->SetPositionRelative(MusicPosition);
}
//set random lobby level if not set
if (sbs->Verbose)
Report("playing music");
- if (MusicPosition == Ogre::Vector3(0, 0, 0) && Height > 0)
- MusicPosition = Ogre::Vector3(0, Height, 0); //set default music position to elevator height
-
- musicsound->SetPositionRelative(MusicPosition);
musicsound->Loop(true);
musicsound->Play(false);
}
//move camera
if (sbs->ElevatorSync == true && sbs->ElevatorNumber == Number)
sbs->camera->MovePosition(vector);
-
- //move sounds
- Ogre::Vector3 top = Ogre::Vector3(0, Height, 0);
- idlesound->SetPositionRelative(top);
- alarm->SetPositionRelative(top);
- floorbeep->SetPositionRelative(top);
- announcesnd->SetPositionRelative(top);
- musicsound->SetPositionRelative(MusicPosition);
- for (int i = 0; i < (int)sounds.size(); i++)
- {
- if (sounds[i])
- sounds[i]->SetPositionY(elevposition.y + sounds[i]->PositionOffset.y);
- }
}
void Elevator::SetFloor(int floor)
Object* Elevator::AddSound(const char *name, const char *filename, Ogre::Vector3 position, bool loop, float volume, int speed, float min_distance, float max_distance, float doppler_level, float cone_inside_angle, float cone_outside_angle, float cone_outside_volume, Ogre::Vector3 direction)
{
- //create a looping sound object
+ //create a sound object
Sound *sound = new Sound(this, name, false);
sounds.push_back(sound);
sbs->RemoveFloor(this);
}
-void Floor::SetCameraFloor()
-{
- //Moves camera to specified floor (sets altitude to the floor's base plus DefaultAltitude)
-
- Ogre::Vector3 camlocation = sbs->camera->GetPosition();
- sbs->camera->SetPosition(Ogre::Vector3(camlocation.x, GetBase() + sbs->camera->cfg_body_height + sbs->camera->cfg_legs_height, camlocation.z));
-}
-
WallObject* Floor::AddFloor(const char *name, const char *texture, float thickness, float x1, float z1, float x2, float z2, float voffset1, float voffset2, bool reverse_axis, bool texture_direction, float tw, float th, bool isexternal, bool legacy_behavior)
{
//Adds a floor with the specified dimensions and vertical offset
//functions
Floor(int number);
~Floor();
- void SetCameraFloor();
WallObject* AddFloor(const char *name, const char *texture, float thickness, float x1, float z1, float x2, float z2, float voffset1, float voffset2, bool reverse_axis, bool texture_direction, float tw, float th, bool isexternal, bool legacy_behavior = false);
WallObject* AddInterfloorFloor(const char *name, const char *texture, float thickness, float x1, float z1, float x2, float z2, float voffset1, float voffset2, bool reverse_axis, bool texture_direction, float tw, float th, bool legacy_behavior = false);
WallObject* AddWall(const char *name, const char *texture, float thickness, float x1, float z1, float x2, float z2, float height_in1, float height_in2, float voffset1, float voffset2, float tw, float th, bool isexternal);
Move(position);
//SetRotation(rotation);
- //set mesh object at specified offset
- mesh->SetPosition(GetPosition() + Offset);
+ //move mesh object to specified offset
+ mesh->Move(Offset);
mesh->SetRotation(rotation);
}
void Object::Move(const Ogre::Vector3 &vector, float speed)
{
//move an object
- //if relative is true, vector is relative of parent object
SetPosition(GetPosition() + (vector * speed));
}
void Object::SetPositionY(float value)
{
//set position of only Y vector
- //if relative is true, position is relative of parent object
Ogre::Vector3 pos (GetPosition().x, value, GetPosition().z);
SetPosition(pos);
SetValues(this, parent, "Sound", name, permanent);
//first set default values
- PositionOffset = 0;
Position = 0;
Volume = sbs->GetConfigFloat("Skyscraper.SBS.Sound.Volume", 1.0);
MaxDistance = sbs->GetConfigFloat("Skyscraper.SBS.Sound.MaxDistance", 10000.0);
{
public:
- Ogre::Vector3 PositionOffset; //optional position offset, used only by other objects
bool SetVelocity; //set sound velocity on move
Sound(Object *parent, const char *name, bool permanent);