OSDN Git Service

Added script support for revolving doors
authorryan <>
Fri, 18 Nov 2016 04:39:17 +0000 (04:39 +0000)
committerryan <>
Fri, 18 Nov 2016 04:39:17 +0000 (04:39 +0000)
designguide.html
skyscraper.ini
src/frontend/script_floors.cpp
src/sbs/floor.cpp
src/sbs/floor.h
src/sbs/revolvingdoor.cpp

index bce09fe..3d05701 100644 (file)
@@ -1449,6 +1449,21 @@ consecutive action when the users enters/leaves. The <em>X</em>, <em>Y</em> and
 relative of the floor's base. Leave the <em>sound</em> field blank for no sound
 to be played.</p>
 
+<p align="left"><strong>35. AddRevolvingDoor</strong> - adds a textured revolving door in the
+specified location.<br>
+Syntax: <font face="Courier New, Courier, mono" size="2">AddDoor <em>sound,
+texturename, thickness</em>, <em>clockwise, segments, speed,
+CenterX</em>, <em>CenterZ</em>, <em>width</em>, <em>height</em>,
+<em>voffset</em>, <em>tw</em>, <em>th, external<br>
+</em></font>Example:<font face="Courier New, Courier, mono" size="2"> AddRevolvingDoor
+, DoorTexture, 0.2, false, 4, 0.2, -8.5, 0, 3.5, 8, 0, 1, 1, false</font></p>
+
+<p align="left"><em>Clockwise</em> determines the direction the door rotates.<br>
+<em>Segments</em> determines how many door segments to create.<br>
+Leave the sound fields blank
+for no sounds to be played.<br>
+</p>
+
 <p align="left"><strong></strong></p>
 
 <br>
index f8d51b7..3143cbb 100644 (file)
@@ -169,6 +169,9 @@ Skyscraper.SBS.TextureMapper = 0
 ;default door rotation speed
 Skyscraper.SBS.DoorSpeed = 75
 
+;default revolving door speed
+Skyscraper.SBS.RevolvingDoorSpeed = 75
+
 ;horizon distance in miles
 Skyscraper.SBS.HorizonDistance = 30
 
index d57165b..1644358 100644 (file)
@@ -40,6 +40,7 @@
 #include "sound.h"
 #include "floorindicator.h"
 #include "door.h"
+#include "revolvingdoor.h"
 #include "directional.h"
 #include "scriptprocessor.h"
 #include "script_section.h"
@@ -2011,6 +2012,43 @@ int ScriptProcessor::FloorSection::Run(std::string &LineData)
                return sNextLine;
        }
 
+       //AddRevolvingDoor command
+       if (linecheck.substr(0, 17) == "addrevolvingdoor ")
+       {
+               //get data
+               int params = SplitData(LineData, 17);
+
+               if (params != 14)
+                       return ScriptError("Incorrect number of parameters");
+
+               //check numeric values
+               for (int i = 2; i <= 13; i++)
+               {
+                       if (i == 3)
+                               i++;
+
+                       if (!IsNumeric(tempdata[i]))
+                               return ScriptError("Invalid value: " + tempdata[i]);
+               }
+
+               //check to see if file exists
+               parent->CheckFile("data/" + tempdata[0]);
+               parent->CheckFile("data/" + tempdata[1]);
+
+               //stop here if in Check mode
+               if (config->CheckScript == true)
+                       return sNextLine;
+
+               //create door
+               RevolvingDoor* door = floor->AddRevolvingDoor(tempdata[0], tempdata[1], ToFloat(tempdata[2]), ToBool(tempdata[3]), ToInt(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), ToFloat(tempdata[9]), ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToBool(tempdata[13]));
+
+               if (door)
+                       door->SetLocked(config->keyvalue);
+
+               StoreCommand(door);
+               return sNextLine;
+       }
+
        //handle end of floor section
        if (linecheck == "<endfloor>" && config->RangeL == config->RangeH)
        {
index 8c0e35e..e93a475 100644 (file)
@@ -1605,8 +1605,12 @@ Model* Floor::GetModel(std::string name)
        return 0;
 }
 
-RevolvingDoor* Floor::AddRevolvingDoor(const std::string &soundfile, const std::string &texture, float thickness, bool clockwise, int segments, float speed, float CenterX, float CenterZ, float width, float height, float voffset, float tw, float th)
+RevolvingDoor* Floor::AddRevolvingDoor(const std::string &soundfile, const std::string &texture, float thickness, bool clockwise, int segments, float speed, float CenterX, float CenterZ, float width, float height, float voffset, float tw, float th, bool external)
 {
+       //create an external (global) door if specified
+       if (external == true)
+               return sbs->GetRevolvingDoorManager()->AddDoor(soundfile, texture, thickness, clockwise, segments, speed, CenterX, CenterZ, width, height, Altitude + voffset, tw, th);
+
        int number = (int)RDoorArray.size();
        std::string name = "Floor " + ToString(Number) + ":Door " + ToString(number);
        RevolvingDoor* door = new RevolvingDoor(this, DoorWrapper, name, soundfile, texture, thickness, clockwise, segments, speed, CenterX, CenterZ, width, height, GetBase(true) + voffset, tw, th);
index 90182e7..d66b393 100644 (file)
@@ -120,7 +120,7 @@ public:
        ElevatorRoute* GetDirectRoute(int DestinationFloor, std::string ElevatorType);
        std::vector<int> GetDirectFloors(bool include_service);
        Model* GetModel(std::string name);
-       RevolvingDoor* AddRevolvingDoor(const std::string &soundfile, const std::string &texture, float thickness, bool clockwise, int segments, float speed, float CenterX, float CenterZ, float width, float height, float voffset, float tw, float th);
+       RevolvingDoor* AddRevolvingDoor(const std::string &soundfile, const std::string &texture, float thickness, bool clockwise, int segments, float speed, float CenterX, float CenterZ, float width, float height, float voffset, float tw, float th, bool external);
        void RemoveRevolvingDoor(RevolvingDoor *door);
        RevolvingDoor* GetRevolvingDoor(int number);
 
index d6c253d..357eb18 100644 (file)
@@ -28,9 +28,6 @@
 #include "manager.h"
 #include "mesh.h"
 #include "floor.h"
-#include "elevatorcar.h"
-#include "shaft.h"
-#include "stairs.h"
 #include "texture.h"
 #include "sound.h"
 #include "revolvingdoor.h"
@@ -78,10 +75,6 @@ RevolvingDoor::RevolvingDoor(Object *parent, DynamicMesh *wrapper, const std::st
        //create door
        sbs->DrawWalls(true, true, true, true, true, true);
        sbs->GetTextureManager()->ResetTextureMapping(true);
-       /*if (Direction == 1 || Direction == 2 || Direction == 5 || Direction == 6)
-               sbs->GetTextureManager()->SetTextureFlip(0, 1, 0, 0, 0, 0); //flip texture on rear side of door
-       if (Direction == 3 || Direction == 4 || Direction == 7 || Direction == 8)
-               sbs->GetTextureManager()->SetTextureFlip(1, 0, 0, 0, 0, 0); //flip texture on rear side of door*/
 
        WallObject *wall;
        wall = DoorMesh->CreateWallObject(name);
@@ -89,18 +82,24 @@ RevolvingDoor::RevolvingDoor(Object *parent, DynamicMesh *wrapper, const std::st
        Segments = segments;
        if (Segments == 3)
        {
-               sbs->AddWallMain(wall, name, texture, thickness, -width, -width, 0, 0, height, height, 0, 0, tw, th, false);
-               sbs->AddWallMain(wall, name, texture, thickness, 0, 0, width, -width, height, height, 0, 0, tw, th, false);
-               sbs->AddWallMain(wall, name, texture, thickness, 0, 0, 0, width, height, height, 0, 0, tw, th, false);
+               sbs->GetTextureManager()->SetTextureFlip(1, 0, 0, 0, 0, 0); //flip texture on rear side of door
+               sbs->AddWallMain(wall, name, texture, thickness, -width, -width, 0, 0, height, height, voffset, voffset, tw, th, false);
+               sbs->AddWallMain(wall, name, texture, thickness, 0, 0, width, -width, height, height, voffset, voffset, tw, th, false);
+               sbs->GetTextureManager()->SetTextureFlip(0, 1, 0, 0, 0, 0); //flip texture on rear side of door
+               sbs->AddWallMain(wall, name, texture, thickness, 0, 0, 0, width, height, height, voffset, voffset, tw, th, false);
        }
-       if (Segments == 4 || Segments == 2)
+       else
        {
-               sbs->AddWallMain(wall, name, texture, thickness, -width, 0, 0, 0, height, height, 0, 0, tw, th, false);
-               sbs->AddWallMain(wall, name, texture, thickness, 0, 0, width, 0, height, height, 0, 0, tw, th, false);
+               sbs->GetTextureManager()->SetTextureFlip(0, 1, 0, 0, 0, 0); //flip texture on rear side of door
+               sbs->AddWallMain(wall, name, texture, thickness, -width, 0, 0, 0, height, height, voffset, voffset, tw, th, false);
+               sbs->GetTextureManager()->SetTextureFlip(1, 0, 0, 0, 0, 0); //flip texture on rear side of door
+               sbs->AddWallMain(wall, name, texture, thickness, 0, 0, width, 0, height, height, voffset, voffset, tw, th, false);
                if (Segments == 4)
                {
-                       sbs->AddWallMain(wall, name, texture, thickness, 0, -width, 0, 0, height, height, 0, 0, tw, th, false);
-                       sbs->AddWallMain(wall, name, texture, thickness, 0, 0, 0, width, height, height, 0, 0, tw, th, false);
+                       sbs->GetTextureManager()->SetTextureFlip(1, 0, 0, 0, 0, 0); //flip texture on rear side of door
+                       sbs->AddWallMain(wall, name, texture, thickness, 0, -width, 0, 0, height, height, voffset, voffset, tw, th, false);
+                       sbs->GetTextureManager()->SetTextureFlip(0, 1, 0, 0, 0, 0); //flip texture on rear side of door
+                       sbs->AddWallMain(wall, name, texture, thickness, 0, 0, 0, width, height, height, voffset, voffset, tw, th, false);
                }
        }
        sbs->ResetWalls();