OSDN Git Service

-added "selection_position" parameter to Control object (AddControl and AddActionCont...
authorryan <>
Tue, 2 Aug 2016 00:07:52 +0000 (00:07 +0000)
committerryan <>
Tue, 2 Aug 2016 00:07:52 +0000 (00:07 +0000)
-more work on the "Simple - Hoistway Access" building

19 files changed:
buildings/Simple - Hoistway Access.bld
designguide.html
src/frontend/script_commands.cpp
src/frontend/script_elevatorcars.cpp
src/frontend/script_floors.cpp
src/sbs/buttonpanel.cpp
src/sbs/buttonpanel.h
src/sbs/control.cpp
src/sbs/control.h
src/sbs/elevatorcar.cpp
src/sbs/elevatorcar.h
src/sbs/floor.cpp
src/sbs/floor.h
src/sbs/sbs.cpp
src/sbs/sbs.h
src/sbs/shaft.cpp
src/sbs/shaft.h
src/sbs/stairs.cpp
src/sbs/stairs.h

index 1aacd25..c112b99 100644 (file)
@@ -479,9 +479,10 @@ AddFloorSigns 0, true, Button, left, 3.5 / 2 - 0.01, -3.301 - 0.2 - 0.33, 0.5, 0
     AddFloorSigns 0, true, Button, right, -3.5 / 2 + 0.01, -3.301 - 0.2 - 0.33, 0.5, 0.42, 5.5
 
 <Floor 0>
-    AddActionControl AccessSwitch, switch.wav, right, -3.5 / 2 + 0.01, -3.301 - 0.2 - 0.33 + 5.706, 0.25, 0.25, 6.5, AccessDownLanding, AccessOffLanding, AccessUpLanding, Fire1Off, Fire1Bypass, Fire1On
+    AddActionControl AccessSwitch, switch.wav, right, -3.5 / 2 + 0.01, -3.301 - 0.2 - 0.33 + 5.706, 0.25, 0.25, 6.5, 2, AccessDownLanding, AccessOffLanding, AccessUpLanding, Fire1Off, Fire1Bypass, Fire1On
 <EndFloor>
 
 <Floor 9>
+    AddActionControl AccessSwitch, switch.wav, right, -3.5 / 2 + 0.01, -3.301 - 0.2 - 0.33 + 5.706, 0.25, 0.25, 6.5, 2, AccessDownTop, AccessOffTop, AccessUpTop, Fire1Off, Fire1Bypass, Fire1On
 <EndFloor>
 
index 2f54cea..26c1840 100644 (file)
@@ -1357,10 +1357,10 @@ AddActionControl</strong> - creates a custom control that uses a specific
 action defined by AddAction.<br>
 Syntax: <font face="Courier New, Courier, mono" size="2">AddActionControl
 <em>name, sound, direction, centerx, centerz, width, height, voffset,
-action_name(s), texture_name(s)<br>
+selection_position, action_name(s), texture_name(s)<br>
 </em></font>Example: <font face="Courier New, Courier, mono"
 size="2">AddActionControl MyControl, switch.wav, front, -10, 10, 1.5, 1.5, 4,
-UndoMyAction, MyAction, Touch, TouchLit<br>
+1, UndoMyAction, MyAction, Touch, TouchLit<br>
 </font><br>
 AddActionControl command creates an advanced control similar to elevator button
 panel controls, but assigned to an action created with the AddAction command.
@@ -1371,17 +1371,17 @@ and only 2 textures, you will get an error. The control starts up in the first
 action, and switches to the next actions in sequence when it's clicked.
 <em>Direction</em> is the direction the control itself will face in 3D space
 (front, left, right, back). <em>Voffset</em> is relative of the floor's base.
-Leave the <em>sound</em> field blank for no sound to be played.</p>
+Leave the <em>sound</em> field blank for no sound to be played. <em>Selection_position</em> is the selection position to start at, which is normally 1.</p>
 
 <p style="text-align:left;margin-left:0;margin-right:auto;"><strong>32.
 AddShaftActionControl</strong> - creates a custom control in a specified shaft
 that uses a specific action defined by AddAction.<br>
 Syntax: <font face="Courier New, Courier, mono" size="2">AddShaftActionControl
 <em>number, name, sound, direction, centerx, centerz, width, height, voffset,
-action_name(s), texture_name(s)<br>
+selection_position, action_name(s), texture_name(s)<br>
 </em></font>Example: <font face="Courier New, Courier, mono"
 size="2">AddShaftActionControl 1, MyControl, switch.wav, front, -10, 10, 1.5,
-1.5, 4, UndoMyAction, MyAction, Touch, TouchLit<br>
+1.5, 4, 1, UndoMyAction, MyAction, Touch, TouchLit<br>
 </font><br>
 This command creates an advanced control similar to elevator car button panel
 controls, but assigned to an action created with the AddAction command. The
@@ -1393,17 +1393,18 @@ action, and switches to the next actions in sequence when it's clicked.
 <em>Direction</em> is the direction the control itself will face in 3D space
 (front, left, right, back). <em>Voffset</em> is relative of the floor's base.
 Leave the <em>sound</em> field blank for no sound to be
-played.<strong></strong></p>
+played. <em>Selection_position</em> is the starting selection position, which
+is normally 1.</p>
 
 <p style="text-align:left;margin-left:0;margin-right:auto;"><strong>33.
 AddStairsActionControl</strong> - creates a custom control in a specified
 stairwell that uses a specific action defined by AddAction.<br>
 Syntax: <font face="Courier New, Courier, mono" size="2">AddStairsActionControl
 <em>number, name, sound, direction, centerx, centerz, width, height, voffset,
-action_name(s), texture_name(s)<br>
+selection_position, action_name(s), texture_name(s)<br>
 </em></font>Example: <font face="Courier New, Courier, mono"
 size="2">AddStairsActionControl 1, MyControl, switch.wav, front, -10, 10, 1.5,
-1.5, 4, UndoMyAction, MyAction, Touch, TouchLit<br>
+1.5, 4, 1, UndoMyAction, MyAction, Touch, TouchLit<br>
 </font><br>
 This command creates an advanced control similar to elevator button panel
 controls, but assigned to an action created with the AddAction command. The
@@ -1415,7 +1416,8 @@ action, and switches to the next actions in sequence when it's clicked.
 <em>Direction</em> is the direction the control itself will face in 3D space
 (front, left, right, back). <em>Voffset</em> is relative of the floor's base.
 Leave the <em>sound</em> field blank for no sound to be
-played.<strong></strong></p>
+played. <em>Selection_position</em> is the starting selection position, which is
+normally 1.</p>
 
 <p style="text-align:left;margin-left:0;margin-right:auto;"><strong>34.
 AddTrigger</strong> - creates a trigger that is used to signal an action when
@@ -2171,16 +2173,16 @@ the right, and 0.1 grid units down. Notice that no sound is specified in the
 buttons, switches and knobs on the panel<br>
 Syntax: <font face="Courier New, Courier, mono" size="2">AddControl
 <em>panel_number, sound, row, column, width, height, hoffset, voffset,
-command_name(s), texture_name(s)<br>
+selection_position, command_name(s), texture_name(s)<br>
 </em></font>Example 1: <font face="Courier New, Courier, mono"
-size="2">AddControl 1, switch.wav, 7, 3, 1, 1, 0, 0, open, ButtonOpen</font><br>
+size="2">AddControl 1, switch.wav, 7, 3, 1, 1, 0, 0, 1, open, ButtonOpen</font><br>
 Example 2: <font face="Courier New, Courier, mono" size="2">AddControl 1,
-switch.wav, 7, 3, 1, 1, 0, 0, FanOff, FanOn, SwitchFanOff,
+switch.wav, 7, 3, 1, 1, 0, 0, 1, FanOff, FanOn, SwitchFanOff,
 SwitchFanOn</font><br>
 Example 3: <font face="Courier New, Courier, mono" size="2">AddControl 1,
-switch.wav, 7, 3, 1, 1, 0, 0, Off, 4, Button5, ButtonLit5</font><br>
+switch.wav, 7, 3, 1, 1, 0, 0, 1, Off, 4, Button5, ButtonLit5</font><br>
 Example 4: <font face="Courier New, Courier, mono" size="2">AddControl 1,
-switch.wav, 7, 3, 1, 1, 0, 0, Fire2Off, Fire2On, Fire2Hold, FireKnob1,
+switch.wav, 7, 3, 1, 1, 0, 0, 1, Fire2Off, Fire2On, Fire2Hold, FireKnob1,
 FireKnob2, FireKnob3</font></p>
 
 <p align="left">The AddControl command creates an advanced control on the
@@ -2196,7 +2198,8 @@ fan switch being created, with the first command being "FanOff" with the
 with the "SwitchFanOn" texture being used for that. Example 3 shows a standard
 floor button being created (which is what the AddButton command does) and
 example 4 shows a fire service mode knob being created with 3 positions. Leave
-the sound field blank for no sound to be played.</p>
+the sound field blank for no sound to be played.  The <em>selection_position</em>
+parameter specifies the starting selection position, which is normally 1.</p>
 
 <p align="left">Available command names for elevators:</p>
 
@@ -2558,10 +2561,10 @@ AddActionControl</strong> - creates a custom control that uses a specific
 action defined by AddAction.<br>
 Syntax: <font face="Courier New, Courier, mono" size="2">AddActionControl
 <em>name, sound, direction, centerx, centerz, width, height, voffset,
-action_name(s), texture_name(s)<br>
+selection_position, action_name(s), texture_name(s)<br>
 </em></font>Example: <font face="Courier New, Courier, mono"
 size="2">AddActionControl MyControl, switch.wav, front, -10, 10, 1.5, 1.5, 4,
-UndoMyAction, MyAction, Touch, TouchLit<br>
+1, UndoMyAction, MyAction, Touch, TouchLit<br>
 </font><br>
 AddActionControl command creates an advanced control similar to elevator button
 panel controls, but assigned to an action created with the AddAction command.
@@ -2573,7 +2576,8 @@ action, and switches to the next actions in sequence when it's clicked.
 <em>Direction</em> is the direction the control itself will face in 3D space
 (front, left, right, back). <em>Voffset</em> is relative of the elevator car's
 base. Leave the sound field blank for no sound to be
-played.<strong></strong></p>
+played. <em>Selection_position</em> is the starting selection position, which is
+normally 1.</p>
 
 <p style="text-align:left;margin-left:0;margin-right:auto;"><strong>22.
 AddTrigger</strong> - creates a trigger that is used to signal an action when
@@ -3273,10 +3277,10 @@ AddActionControl</strong> - creates a custom control that uses a specific
 action defined by AddAction.<br>
 Syntax: <font face="Courier New, Courier, mono" size="2">AddActionControl
 <em>name, sound, direction, centerx, centerz, width, height, voffset,
-action_name(s), texture_name(s)<br>
+selection_position, action_name(s), texture_name(s)<br>
 </em></font>Example: <font face="Courier New, Courier, mono"
 size="2">AddActionControl MyControl, switch.wav, front, -10, 10, 1.5, 1.5, 4,
-UndoMyAction, MyAction, Touch, TouchLit<br>
+1, UndoMyAction, MyAction, Touch, TouchLit<br>
 </font><br>
 AddActionControl command creates an advanced control similar to elevator button
 panel controls, but assigned to an action created with the AddAction command.
@@ -3287,7 +3291,8 @@ and only 2 textures, you will get an error. The control starts up in the first
 action, and switches to the next actions in sequence when it's clicked.
 <em>Direction</em> is the direction the control itself will face in 3D space
 (front, left, right, back). Leave the sound field blank for no sound to be
-played.</p>
+played.  <em>Selection_position</em> is the selection position to start at,
+which is normally 1.</p>
 
 <p style="text-align:left;margin-left:0;margin-right:auto;"><strong>al.
 AddTrigger</strong> - creates a trigger that is used to signal an action when
index 07c578e..fbe7aaa 100644 (file)
@@ -1527,8 +1527,17 @@ int ScriptProcessor::CommandsSection::Run(std::string &LineData)
                if (params < 10)
                        return ScriptError("Incorrect number of parameters");
 
+               //set backwards compatibility
+               bool compat = false;
+               if (IsNumeric(tempdata[8]) == false)
+                       compat = true;
+
+               int end = 8;
+               if (compat == true)
+                       end = 7;
+
                //check numeric values
-               for (int i = 3; i <= 7; i++)
+               for (int i = 3; i <= end; i++)
                {
                        if (!IsNumeric(tempdata[i]))
                                return ScriptError("Invalid value: " + tempdata[i]);
@@ -1539,13 +1548,13 @@ int ScriptProcessor::CommandsSection::Run(std::string &LineData)
 
                //get number of action & texture parameters
                slength = (int)tempdata.size();
-               parameters = slength - 8; //strip off main parameters
+               parameters = slength - (end + 1); //strip off main parameters
 
                //action & texture parameter number needs to be even
                if (IsEven(parameters) == false)
                        return ScriptError("Incorrect number of parameters");
 
-               for (int i = 8; i < slength - (parameters / 2); i++)
+               for (int i = (end + 1); i < slength - (parameters / 2); i++)
                        action_array.push_back(tempdata[i]);
                for (int i = slength - (parameters / 2); i < slength; i++)
                        tex_array.push_back(tempdata[i]);
@@ -1553,7 +1562,11 @@ int ScriptProcessor::CommandsSection::Run(std::string &LineData)
                //check to see if file exists
                parent->CheckFile("data/" + tempdata[1]);
 
-               Control* control = Simcore->AddControl(tempdata[0], tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), action_array, tex_array);
+               Control* control = 0;
+               if (compat == true)
+                       control = Simcore->AddControl(tempdata[0], tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), 1, action_array, tex_array);
+               else
+                       control = Simcore->AddControl(tempdata[0], tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToInt(tempdata[8]), action_array, tex_array);
 
                if (control)
                {
index 26892dc..225237b 100644 (file)
@@ -1366,8 +1366,17 @@ int ScriptProcessor::ElevatorCarSection::Run(std::string &LineData)
                if (params < 10)
                        return ScriptError("Incorrect number of parameters");
 
+               //set backwards compatibility
+               bool compat = false;
+               if (IsNumeric(tempdata[8]) == false)
+                       compat = true;
+
+               int end = 8;
+               if (compat == true)
+                       end = 7;
+
                //check numeric values
-               for (int i = 1; i <= 7; i++)
+               for (int i = 1; i <= end; i++)
                {
                        if (i == 1)
                                i++;
@@ -1383,13 +1392,13 @@ int ScriptProcessor::ElevatorCarSection::Run(std::string &LineData)
 
                //get number of action & texture parameters
                slength = (int)tempdata.size();
-               parameters = slength - 8; //strip off main parameters
+               parameters = slength - (end + 1); //strip off main parameters
 
                //action & texture parameter number needs to be even
                if (IsEven(parameters) == false)
                        return ScriptError("Incorrect number of parameters");
 
-               for (int i = 8; i < slength - (parameters / 2); i++)
+               for (int i = (end + 1); i < slength - (parameters / 2); i++)
                        action_array.push_back(tempdata[i]);
                for (int i = slength - (parameters / 2); i < slength; i++)
                        tex_array.push_back(tempdata[i]);
@@ -1397,7 +1406,11 @@ int ScriptProcessor::ElevatorCarSection::Run(std::string &LineData)
                //check to see if file exists
                parent->CheckFile("data/" + tempdata[1]);
 
-               Control* control = car->GetPanel(ToInt(tempdata[0]))->AddControl(tempdata[1], ToInt(tempdata[2]), ToInt(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), action_array, tex_array);
+               Control* control = 0;
+               if (compat == true)
+                       control = car->GetPanel(ToInt(tempdata[0]))->AddControl(tempdata[1], ToInt(tempdata[2]), ToInt(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), 1, action_array, tex_array);
+               else
+                       control = car->GetPanel(ToInt(tempdata[0]))->AddControl(tempdata[1], ToInt(tempdata[2]), ToInt(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToInt(tempdata[8]), action_array, tex_array);
 
                if (control)
                {
@@ -1913,8 +1926,17 @@ int ScriptProcessor::ElevatorCarSection::Run(std::string &LineData)
                if (params < 10)
                        return ScriptError("Incorrect number of parameters");
 
+               //set backwards compatibility
+               bool compat = false;
+               if (IsNumeric(tempdata[8]) == false)
+                       compat = true;
+
+               int end = 8;
+               if (compat == true)
+                       end = 7;
+
                //check numeric values
-               for (int i = 3; i <= 7; i++)
+               for (int i = 3; i <= end; i++)
                {
                        if (!IsNumeric(tempdata[i]))
                                return ScriptError("Invalid value: " + tempdata[i]);
@@ -1925,13 +1947,13 @@ int ScriptProcessor::ElevatorCarSection::Run(std::string &LineData)
 
                //get number of action & texture parameters
                slength = (int)tempdata.size();
-               parameters = slength - 8; //strip off main parameters
+               parameters = slength - (end + 1); //strip off main parameters
 
                //action & texture parameter number needs to be even
                if (IsEven(parameters) == false)
                        return ScriptError("Incorrect number of parameters");
 
-               for (int i = 8; i < slength - (parameters / 2); i++)
+               for (int i = (end + 1); i < slength - (parameters / 2); i++)
                        action_array.push_back(tempdata[i]);
                for (int i = slength - (parameters / 2); i < slength; i++)
                        tex_array.push_back(tempdata[i]);
@@ -1939,7 +1961,11 @@ int ScriptProcessor::ElevatorCarSection::Run(std::string &LineData)
                //check to see if file exists
                parent->CheckFile("data/" + tempdata[1]);
 
-               Control* control = car->AddControl(tempdata[0], tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), action_array, tex_array);
+               Control* control = 0;
+               if (compat == true)
+                       control = car->AddControl(tempdata[0], tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), 1, action_array, tex_array);
+               else
+                       control = car->AddControl(tempdata[0], tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToInt(tempdata[8]), action_array, tex_array);
 
                if (control)
                {
index bb32076..4ac9e38 100644 (file)
@@ -1515,8 +1515,17 @@ int ScriptProcessor::FloorSection::Run(std::string &LineData)
                if (params < 10)
                        return ScriptError("Incorrect number of parameters");
 
+               //set backwards compatibility
+               bool compat = false;
+               if (IsNumeric(tempdata[8]) == false)
+                       compat = true;
+
+               int end = 8;
+               if (compat == true)
+                       end = 7;
+
                //check numeric values
-               for (int i = 3; i <= 7; i++)
+               for (int i = 3; i <= end; i++)
                {
                        if (!IsNumeric(tempdata[i]))
                                return ScriptError("Invalid value: " + tempdata[i]);
@@ -1527,13 +1536,13 @@ int ScriptProcessor::FloorSection::Run(std::string &LineData)
 
                //get number of action & texture parameters
                slength = (int)tempdata.size();
-               parameters = slength - 8; //strip off main parameters
+               parameters = slength - (end + 1); //strip off main parameters
 
                //action & texture parameter number needs to be even
                if (IsEven(parameters) == false)
                        return ScriptError("Incorrect number of parameters");
 
-               for (int i = 8; i < slength - (parameters / 2); i++)
+               for (int i = (end + 1); i < slength - (parameters / 2); i++)
                        action_array.push_back(tempdata[i]);
                for (int i = slength - (parameters / 2); i < slength; i++)
                        tex_array.push_back(tempdata[i]);
@@ -1541,7 +1550,11 @@ int ScriptProcessor::FloorSection::Run(std::string &LineData)
                //check to see if file exists
                parent->CheckFile("data/" + tempdata[1]);
 
-               Control* control = floor->AddControl(tempdata[0], tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), action_array, tex_array);
+               Control* control = 0;
+               if (compat == true)
+                       control = floor->AddControl(tempdata[0], tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), 1, action_array, tex_array);
+               else
+                       control = floor->AddControl(tempdata[0], tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToInt(tempdata[8]), action_array, tex_array);
 
                if (control)
                {
@@ -1563,8 +1576,17 @@ int ScriptProcessor::FloorSection::Run(std::string &LineData)
                if (params < 11)
                        return ScriptError("Incorrect number of parameters");
 
+               //set backwards compatibility
+               bool compat = false;
+               if (IsNumeric(tempdata[9]) == false)
+                       compat = true;
+
+               int end = 9;
+               if (compat == true)
+                       end = 8;
+
                //check numeric values
-               for (int i = 0; i <= 8; i++)
+               for (int i = 0; i <= end; i++)
                {
                        if (i == 1)
                                i = 4;
@@ -1577,13 +1599,13 @@ int ScriptProcessor::FloorSection::Run(std::string &LineData)
 
                //get number of action & texture parameters
                slength = (int)tempdata.size();
-               parameters = slength - 9; //strip off main parameters
+               parameters = slength - (end + 1); //strip off main parameters
 
                //action & texture parameter number needs to be even
                if (IsEven(parameters) == false)
                        return ScriptError("Incorrect number of parameters");
 
-               for (int i = 9; i < slength - (parameters / 2); i++)
+               for (int i = (end + 1); i < slength - (parameters / 2); i++)
                        action_array.push_back(tempdata[i]);
                for (int i = slength - (parameters / 2); i < slength; i++)
                        tex_array.push_back(tempdata[i]);
@@ -1593,7 +1615,11 @@ int ScriptProcessor::FloorSection::Run(std::string &LineData)
 
                if (Simcore->GetShaft(ToInt(tempdata[0])))
                {
-                       Control* control = Simcore->GetShaft(ToInt(tempdata[0]))->AddControl(Current, tempdata[1], tempdata[2], tempdata[3], ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), action_array, tex_array);
+                       Control* control = 0;
+                       if (compat == true)
+                               control = Simcore->GetShaft(ToInt(tempdata[0]))->AddControl(Current, tempdata[1], tempdata[2], tempdata[3], ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), 1, action_array, tex_array);
+                       else
+                               control = Simcore->GetShaft(ToInt(tempdata[0]))->AddControl(Current, tempdata[1], tempdata[2], tempdata[3], ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), ToInt(tempdata[9]), action_array, tex_array);
 
                        if (control)
                        {
@@ -1618,8 +1644,17 @@ int ScriptProcessor::FloorSection::Run(std::string &LineData)
                if (params < 11)
                        return ScriptError("Incorrect number of parameters");
 
+               //set backwards compatibility
+               bool compat = false;
+               if (IsNumeric(tempdata[9]) == false)
+                       compat = true;
+
+               int end = 9;
+               if (compat == true)
+                       end = 8;
+
                //check numeric values
-               for (int i = 0; i <= 8; i++)
+               for (int i = 0; i <= end; i++)
                {
                        if (i == 1)
                                i = 4;
@@ -1632,13 +1667,13 @@ int ScriptProcessor::FloorSection::Run(std::string &LineData)
 
                //get number of action & texture parameters
                slength = (int)tempdata.size();
-               parameters = slength - 9; //strip off main parameters
+               parameters = slength - (end + 1); //strip off main parameters
 
                //action & texture parameter number needs to be even
                if (IsEven(parameters) == false)
                        return ScriptError("Incorrect number of parameters");
 
-               for (int i = 9; i < slength - (parameters / 2); i++)
+               for (int i = (end + 1); i < slength - (parameters / 2); i++)
                        action_array.push_back(tempdata[i]);
                for (int i = slength - (parameters / 2); i < slength; i++)
                        tex_array.push_back(tempdata[i]);
@@ -1648,7 +1683,11 @@ int ScriptProcessor::FloorSection::Run(std::string &LineData)
 
                if (Simcore->GetStairs(ToInt(tempdata[0])))
                {
-                       Control* control = Simcore->GetStairs(ToInt(tempdata[0]))->AddControl(Current, tempdata[1], tempdata[2], tempdata[3], ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), action_array, tex_array);
+                       Control* control = 0;
+                       if (compat == true)
+                               control = Simcore->GetStairs(ToInt(tempdata[0]))->AddControl(Current, tempdata[1], tempdata[2], tempdata[3], ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), 1, action_array, tex_array);
+                       else
+                               control = Simcore->GetStairs(ToInt(tempdata[0]))->AddControl(Current, tempdata[1], tempdata[2], tempdata[3], ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), ToInt(tempdata[9]), action_array, tex_array);
 
                        if (control)
                        {
index 97bc782..931ec87 100644 (file)
@@ -153,10 +153,10 @@ Control* ButtonPanel::AddButton(const std::string &sound, const std::string &tex
        else
                names.push_back(newtype);
 
-       return AddControl(sound, row, column, width, height, hoffset, voffset, names, textures);
+       return AddControl(sound, row, column, width, height, hoffset, voffset, 1, names, textures);
 }
 
-Control* ButtonPanel::AddControl(const std::string &sound, int row, int column, float bwidth, float bheight, float hoffset, float voffset, std::vector<std::string> &action_names, std::vector<std::string> &textures)
+Control* ButtonPanel::AddControl(const std::string &sound, int row, int column, float bwidth, float bheight, float hoffset, float voffset, int selection_position, std::vector<std::string> &action_names, std::vector<std::string> &textures)
 {
        //create an elevator control (button, switch, knob)
 
@@ -232,7 +232,7 @@ Control* ButtonPanel::AddControl(const std::string &sound, int row, int column,
                        actions.push_back(off_action);
        }
 
-       Control *control = controls[control_index] = new Control(this, name, false, sound, actionsnull, actions, textures, Direction, ButtonWidth * bwidth, ButtonHeight * bheight, false);
+       Control *control = controls[control_index] = new Control(this, name, false, sound, actionsnull, actions, textures, Direction, ButtonWidth * bwidth, ButtonHeight * bheight, false, selection_position);
 
        //move control
        controls[control_index]->Move(position);
index 134b32f..e17c031 100644 (file)
@@ -50,7 +50,7 @@ public:
        ButtonPanel(ElevatorCar *car, int index, const std::string &texture, int rows, int columns, const std::string &direction, float CenterX, float CenterZ, float buttonwidth, float buttonheight, float spacingX, float spacingY, float voffset, float tw, float th);
        ~ButtonPanel();
        Control* AddButton(const std::string &sound, const std::string &texture, const std::string &texture_lit, int row, int column, const std::string &type, float width, float height, float hoffset = 0, float voffset = 0);
-       Control* AddControl(const std::string &sound, int row, int column, float bwidth, float bheight, float hoffset, float voffset, std::vector<std::string> &action_names, std::vector<std::string> &textures);
+       Control* AddControl(const std::string &sound, int row, int column, float bwidth, float bheight, float hoffset, float voffset, int selection_position, std::vector<std::string> &action_names, std::vector<std::string> &textures);
        void Enabled(bool value);
        bool AddWall(const std::string &name, const std::string &texture, float thickness, float x1, float z1, float x2, float z2, float height1, float height2, float voffset1, float voffset2, float tw, float th);
        void ChangeLight(int floor, bool value);
index be96c99..5c4b992 100644 (file)
@@ -38,7 +38,7 @@
 
 namespace SBS {
 
-Control::Control(Object *parent, const std::string &name, bool permanent, const std::string &sound_file, const std::vector<std::string> &action_names, const std::vector<Action*> &actions, std::vector<std::string> &textures, const std::string &direction, float width, float height, bool center) : Object(parent)
+Control::Control(Object *parent, const std::string &name, bool permanent, const std::string &sound_file, const std::vector<std::string> &action_names, const std::vector<Action*> &actions, std::vector<std::string> &textures, const std::string &direction, float width, float height, bool center, int selection_position) : Object(parent)
 {
        //create a control at the specified location
 
@@ -56,7 +56,6 @@ Control::Control(Object *parent, const std::string &name, bool permanent, const
        Direction = direction;
        is_enabled = true;
        TextureArray = textures;
-       current_position = 1;
        Locked = false;
        KeyID = 0;
        light_status = false;
@@ -65,6 +64,11 @@ Control::Control(Object *parent, const std::string &name, bool permanent, const
        //create object mesh
        ControlMesh = new MeshObject(this, name2, 0, "", sbs->GetConfigFloat("Skyscraper.SBS.MaxSmallRenderDistance", 100));
 
+       //set selection position to starting value
+       SetSelectPosition(selection_position);
+
+       std::string texture = GetTexture(selection_position);
+
        sbs->TexelOverride = true;
        WallObject *wall;
        if (Direction == "front")
@@ -77,7 +81,7 @@ Control::Control(Object *parent, const std::string &name, bool permanent, const
                }
                sbs->DrawWalls(true, false, false, false, false, false);
                wall = ControlMesh->CreateWallObject(name);
-               sbs->AddWallMain(wall, name, textures[0], 0, x, 0, y, 0, height, height, 0, 0, 1, 1, false);
+               sbs->AddWallMain(wall, name, texture, 0, x, 0, y, 0, height, height, 0, 0, 1, 1, false);
        }
        if (Direction == "back")
        {
@@ -89,7 +93,7 @@ Control::Control(Object *parent, const std::string &name, bool permanent, const
                }
                sbs->DrawWalls(false, true, false, false, false, false);
                wall = ControlMesh->CreateWallObject(name);
-               sbs->AddWallMain(wall, name, textures[0], 0, x, 0, y, 0, height, height, 0, 0, 1, 1, false);
+               sbs->AddWallMain(wall, name, texture, 0, x, 0, y, 0, height, height, 0, 0, 1, 1, false);
        }
        if (Direction == "left")
        {
@@ -101,7 +105,7 @@ Control::Control(Object *parent, const std::string &name, bool permanent, const
                }
                sbs->DrawWalls(true, false, false, false, false, false);
                wall = ControlMesh->CreateWallObject(name);
-               sbs->AddWallMain(wall, name, textures[0], 0, 0, x, 0, y, height, height, 0, 0, 1, 1, false);
+               sbs->AddWallMain(wall, name, texture, 0, 0, x, 0, y, height, height, 0, 0, 1, 1, false);
        }
        if (Direction == "right")
        {
@@ -113,7 +117,7 @@ Control::Control(Object *parent, const std::string &name, bool permanent, const
                }
                sbs->DrawWalls(false, true, false, false, false, false);
                wall = ControlMesh->CreateWallObject(name);
-               sbs->AddWallMain(wall, name, textures[0], 0, 0, x, 0, y, height, height, 0, 0, 1, 1, false);
+               sbs->AddWallMain(wall, name, texture, 0, 0, x, 0, y, height, height, 0, 0, 1, 1, false);
        }
        sbs->ResetWalls();
        sbs->TexelOverride = false;
@@ -192,7 +196,7 @@ bool Control::SetSelectPosition(int position)
 
        current_position = position;
 
-       return ControlMesh->ChangeTexture(TextureArray[position - 1]);
+       return ControlMesh->ChangeTexture(GetTexture(position));
 }
 
 bool Control::ChangeSelectPosition(int position)
@@ -304,6 +308,17 @@ void Control::SetTexture(int position, const std::string &texture)
        TextureArray[position - 1] = texture;
 }
 
+std::string Control::GetTexture(int position)
+{
+       //get texture for specified position
+
+       if (position < 1 || position > GetPositions())
+               return "";
+
+       return TextureArray[position - 1];
+
+}
+
 int Control::GetPositions()
 {
        //return number of available positions, based on size of Actions array
index c6af837..80c156b 100644 (file)
@@ -34,7 +34,7 @@ public:
        std::string Direction;
 
        //functions
-       Control(Object *parent, const std::string &name, bool permanent, const std::string &sound, const std::vector<std::string> &action_names, const std::vector<Action*> &actions, std::vector<std::string> &textures, const std::string &direction, float width, float height, bool center);
+       Control(Object *parent, const std::string &name, bool permanent, const std::string &sound, const std::vector<std::string> &action_names, const std::vector<Action*> &actions, std::vector<std::string> &textures, const std::string &direction, float width, float height, bool center, int selection_position);
        ~Control();
        void Enabled(bool value);
        bool SetSelectPosition(int position);
@@ -49,6 +49,7 @@ public:
        int GetPositions();
        void PlaySound();
        void SetTexture(int position, const std::string &texture);
+       std::string GetTexture(int position);
        int FindActionPosition(const std::string &name);
        int FindNumericActionPosition();
        bool DoAction();
index 5dd27e4..d3f158a 100644 (file)
@@ -2222,11 +2222,11 @@ std::string ElevatorCar::GetFloorDisplay()
        return value;
 }
 
-Control* ElevatorCar::AddControl(const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, std::vector<std::string> &action_names, std::vector<std::string> &textures)
+Control* ElevatorCar::AddControl(const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, int selection_position, std::vector<std::string> &action_names, std::vector<std::string> &textures)
 {
        //add a control
        std::vector<Action*> actionnull; //not used
-       Control* control = new Control(this, name, false, sound, action_names, actionnull, textures, direction, width, height, true);
+       Control* control = new Control(this, name, false, sound, action_names, actionnull, textures, direction, width, height, true, selection_position);
        control->Move(Ogre::Vector3(CenterX, voffset, CenterZ));
        ControlArray.push_back(control);
        return control;
index 35915e4..6cb21ef 100644 (file)
@@ -163,7 +163,7 @@ public:
        Model* AddModel(const std::string &name, const std::string &filename, bool center, Ogre::Vector3 position, Ogre::Vector3 rotation, float max_render_distance = 0, float scale_multiplier = 1, bool enable_physics = false, float restitution = 0, float friction = 0, float mass = 0);
        void AddModel(Model *model);
        void AddDisplayFloor(int floor);
-       Control* AddControl(const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, std::vector<std::string> &action_names, std::vector<std::string> &textures);
+       Control* AddControl(const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, int selection_position, std::vector<std::string> &action_names, std::vector<std::string> &textures);
        Trigger* AddTrigger(const std::string &name, const std::string &sound_file, Ogre::Vector3 &area_min, Ogre::Vector3 &area_max, std::vector<std::string> &action_names);
        bool ReplaceTexture(const std::string &oldtexture, const std::string &newtexture);
        std::vector<Sound*> GetSound(const std::string &name);
index 1053d70..f15cec1 100644 (file)
@@ -1355,11 +1355,11 @@ void Floor::ReplaceTexture(const std::string &oldtexture, const std::string &new
        ColumnFrame->ReplaceTexture(oldtexture, newtexture);
 }
 
-Control* Floor::AddControl(const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, std::vector<std::string> &action_names, std::vector<std::string> &textures)
+Control* Floor::AddControl(const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, int selection_position, std::vector<std::string> &action_names, std::vector<std::string> &textures)
 {
        //add a control
        std::vector<Action*> actionnull; //not used
-       Control* control = new Control(this, name, false, sound, action_names, actionnull, textures, direction, width, height, true);
+       Control* control = new Control(this, name, false, sound, action_names, actionnull, textures, direction, width, height, true, selection_position);
        control->Move(CenterX, GetBase(true) + voffset, CenterZ);
        ControlArray.push_back(control);
        return control;
index 679fb01..b297b66 100644 (file)
@@ -106,7 +106,7 @@ public:
        Model* AddModel(const std::string &name, const std::string &filename, bool center, Ogre::Vector3 position, Ogre::Vector3 rotation, float max_render_distance = 0, float scale_multiplier = 1, bool enable_physics = false, float restitution = 0, float friction = 0, float mass = 0);
        void AddModel(Model *model);
        void ReplaceTexture(const std::string &oldtexture, const std::string &newtexture);
-       Control* AddControl(const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, std::vector<std::string> &action_names, std::vector<std::string> &textures);
+       Control* AddControl(const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, int selection_position, std::vector<std::string> &action_names, std::vector<std::string> &textures);
        Trigger* AddTrigger(const std::string &name, const std::string &sound_file, Ogre::Vector3 &area_min, Ogre::Vector3 &area_max, std::vector<std::string> &action_names);
        CameraTexture* AddCameraTexture(const std::string &name, bool enabled, int quality, float fov, Ogre::Vector3 position, bool use_rotation, Ogre::Vector3 rotation);
        Escalator* AddEscalator(const std::string &name, bool run, bool run_direction, const std::string &sound_file, const std::string &texture, const std::string &direction, float CenterX, float CenterZ, float width, float risersize, float treadsize, int num_steps, float voffset, float tw, float th);
index 3efee6f..28cfc72 100644 (file)
@@ -3311,11 +3311,11 @@ void SBS::ResetLighting()
        AmbientB = OldAmbientB;
 }
 
-Control* SBS::AddControl(const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, std::vector<std::string> &action_names, std::vector<std::string> &textures)
+Control* SBS::AddControl(const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, int selection_position, std::vector<std::string> &action_names, std::vector<std::string> &textures)
 {
        //add a control
        std::vector<Action*> actionnull; //not used
-       Control* control = new Control(this, name, false, sound, action_names, actionnull, textures, direction, width, height, true);
+       Control* control = new Control(this, name, false, sound, action_names, actionnull, textures, direction, width, height, true, selection_position);
        control->SetPosition(CenterX, voffset, CenterZ);
        ControlArray.push_back(control);
        return control;
index 25e97e5..2c673b5 100644 (file)
@@ -311,7 +311,7 @@ public:
        void ResetDoorwayWalls();
        void SetLighting(float red = 1.0, float green = 1.0, float blue = 1.0);
        void ResetLighting();
-       Control* AddControl(const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, std::vector<std::string> &action_names, std::vector<std::string> &textures);
+       Control* AddControl(const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, int selection_position, std::vector<std::string> &action_names, std::vector<std::string> &textures);
        Trigger* AddTrigger(const std::string &name, const std::string &sound_file, const Ogre::Vector3 &area_min, const Ogre::Vector3 &area_max, std::vector<std::string> &action_names);
        Action* AddAction(const std::string &name, std::vector<Object*> &action_parents, const std::string &command, const std::vector<std::string> &parameters);
        Action* AddAction(const std::string &name, std::vector<Object*> &action_parents, const std::string &command);
index a7c68c9..e6081a4 100644 (file)
@@ -819,7 +819,7 @@ void Shaft::AddModel(int floor, Model *model)
        ModelArray[floor - startfloor].push_back(model);
 }
 
-Control* Shaft::AddControl(int floor, const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, std::vector<std::string> &action_names, std::vector<std::string> &textures)
+Control* Shaft::AddControl(int floor, const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, int selection_position, std::vector<std::string> &action_names, std::vector<std::string> &textures)
 {
        //add a control
 
@@ -828,7 +828,7 @@ Control* Shaft::AddControl(int floor, const std::string &name, const std::string
                return 0;
 
        std::vector<Action*> actionnull; //not used
-       Control* control = new Control(GetMeshObject(floor), name, false, sound, action_names, actionnull, textures, direction, width, height, true);
+       Control* control = new Control(GetMeshObject(floor), name, false, sound, action_names, actionnull, textures, direction, width, height, true, selection_position);
        control->Move(CenterX, voffset, CenterZ);
        ControlArray[floor - startfloor].push_back(control);
        return control;
index 6106438..0b0651f 100644 (file)
@@ -81,7 +81,7 @@ public:
        Light* AddLight(int floor, const std::string &name, int type, Ogre::Vector3 position, Ogre::Vector3 direction, float color_r, float color_g, float color_b, float spec_color_r, float spec_color_g, float spec_color_b, float spot_inner_angle, float spot_outer_angle, float spot_falloff, float att_range, float att_constant, float att_linear, float att_quadratic);
        Model* AddModel(int floor, const std::string &name, const std::string &filename, bool center, Ogre::Vector3 position, Ogre::Vector3 rotation, float max_render_distance = 0, float scale_multiplier = 1, bool enable_physics = false, float restitution = 0, float friction = 0, float mass = 0);
        void AddModel(int floor, Model *model);
-       Control* AddControl(int floor, const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, std::vector<std::string> &action_names, std::vector<std::string> &textures);
+       Control* AddControl(int floor, const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, int selection_position, std::vector<std::string> &action_names, std::vector<std::string> &textures);
        Trigger* AddTrigger(int floor, const std::string &name, const std::string &sound_file, Ogre::Vector3 &area_min, Ogre::Vector3 &area_max, std::vector<std::string> &action_names);
        void ReplaceTexture(const std::string &oldtexture, const std::string &newtexture);
        void OnInit();
index 76181d2..438e1f5 100644 (file)
@@ -834,7 +834,7 @@ void Stairs::AddModel(int floor, Model *model)
        ModelArray[floor - startfloor].push_back(model);
 }
 
-Control* Stairs::AddControl(int floor, const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, std::vector<std::string> &action_names, std::vector<std::string> &textures)
+Control* Stairs::AddControl(int floor, const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, int selection_position, std::vector<std::string> &action_names, std::vector<std::string> &textures)
 {
        //add a control
 
@@ -843,7 +843,7 @@ Control* Stairs::AddControl(int floor, const std::string &name, const std::strin
                return 0;
 
        std::vector<Action*> actionnull; //not used
-       Control* control = new Control(GetMeshObject(floor), name, false, sound, action_names, actionnull, textures, direction, width, height, true);
+       Control* control = new Control(GetMeshObject(floor), name, false, sound, action_names, actionnull, textures, direction, width, height, true, selection_position);
        control->Move(CenterX, voffset, CenterZ);
        ControlArray[floor - startfloor].push_back(control);
        return control;
index 5a13136..dbf76a2 100644 (file)
@@ -69,7 +69,7 @@ public:
        MeshObject* GetMeshObject(int floor);
        Model* AddModel(int floor, const std::string &name, const std::string &filename, bool center, Ogre::Vector3 position, Ogre::Vector3 rotation, float max_render_distance = 0, float scale_multiplier = 1, bool enable_physics = false, float restitution = 0, float friction = 0, float mass = 0);
        void AddModel(int floor, Model *model);
-       Control* AddControl(int floor, const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, std::vector<std::string> &action_names, std::vector<std::string> &textures);
+       Control* AddControl(int floor, const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, int selection_position, std::vector<std::string> &action_names, std::vector<std::string> &textures);
        Trigger* AddTrigger(int floor, const std::string &name, const std::string &sound_file, Ogre::Vector3 &area_min, Ogre::Vector3 &area_max, std::vector<std::string> &action_names);
        void ReplaceTexture(const std::string &oldtexture, const std::string &newtexture);
        void OnInit();