-need office maintenance floor, possibly 2
-make either 99 or 100 housekeeping
+-possibly add a restaurant on either 116/117 or somewhere above 120
Version="8.00"
Name="Skyscraper"
ProjectGUID="{899501B5-1571-4301-B4D0-5FAADAE2A607}"
+ SignManifests="true"
>
<Platforms>
<Platform
/>
</FileConfiguration>
</File>
- <File
- RelativePath=".\tritoncenter.cpp"
- >
- </File>
</Filter>
<Filter
Name="Header Files"
RelativePath=".\skyscraper.h"
>
</File>
- <File
- RelativePath=".\tritoncenter.h"
- >
- </File>
</Filter>
<Filter
Name="Resource Files"
ls = SCF_QUERY_INTERFACE (Level->GetMeshObject (), iThingState);
level_state = ls->GetFactory ();
- CrawlSpace = (sbs->engine->CreateSectorWallsMesh (sbs->area, "CrawlSpace"));
- ShaftsFloor = (sbs->engine->CreateSectorWallsMesh (sbs->area, "ShaftsFloor"));
+ //CrawlSpace = (sbs->engine->CreateSectorWallsMesh (sbs->area, "CrawlSpace"));
+ //ShaftsFloor = (sbs->engine->CreateSectorWallsMesh (sbs->area, "ShaftsFloor"));
//Set Level = Scene.CreateMeshBuilder("Level " + Str$(Number))
//Set CrawlSpace = Scene.CreateMeshBuilder("CrawlSpace " + Str$(Number))
void Floor::CreateWallBox(const char *texture, float WidthX, float LengthZ, float CenterX, float CenterZ, float heightchange, bool CSpace, float tw, float th)
{
+ iMaterialWrapper* tm;
float height = heightchange + FloorAltitude;
float wallheight = FloorHeight - CrawlSpaceHeight;
float x1;
if (th == 0)
th = AutoSize(0, wallheight, false);
- //level_state->AddOutsideBox(csVector3(x1, height, z1), csVector3(x2, height + wallheight, z2));
level_state->AddInsideBox(csVector3(x1, height, z1), csVector3(x2, height + wallheight, z2));
- iMaterialWrapper* tm = sbs->engine->GetMaterialList ()->FindByName (texture);
+ tm = sbs->engine->GetMaterialList ()->FindByName (texture);
level_state->SetPolygonMaterial (CS_POLYRANGE_LAST, tm);
level_state->SetPolygonTextureMapping (CS_POLYRANGE_LAST, 3); //see todo below
+ level_state->AddOutsideBox(csVector3(x1 + 0.1, height + 0.1, z1 + 0.1), csVector3(x2 - 0.1, height + wallheight + 0.1, z2 + 0.1));
+ tm = sbs->engine->GetMaterialList ()->FindByName (texture);
+ level_state->SetPolygonMaterial (CS_POLYRANGE_LAST, tm);
+ level_state->SetPolygonTextureMapping (CS_POLYRANGE_LAST, 3); //see todo below
+
//*** todo: implement full texture sizing - the "3" above is a single-dimension value; there needs to be 2
}
CS_IMPLEMENT_APPLICATION
#include "sbs.h"
+#include "floor.h"
SBS *sbs; //self reference
+iObjectRegistry* object_reg;
-SBS::SBS(iObjectRegistry* object_reg)
+SBS::SBS(int _argc, char** _argv)
{
- SBS::object_reg = object_reg;
+ argc = _argc;
+ argv = _argv;
+ object_reg = csInitializer::CreateEnvironment (argc, argv);
sbs = this;
}
SBS::~SBS()
{
- //Uninitialize the variables
-/* pScene->DestroyAllMeshes ();
-
- pScene->Release ();
- pInput->Release ();
- pEngine->Release ();
- pAtmos->Release ();
- pCamera->Release ();
- pMatFactory->Release ();
- pLightEngine->Release ();
- pGraphicEffect->Release ();
- pTextureFactory->Release ();
-
- pScene = NULL;
- pInput = NULL;
- pEngine = NULL;
- pAtmos = NULL;
- pCamera = NULL;
- pMatFactory = NULL;
- pLightEngine = NULL;
- pGraphicEffect = NULL;
- pTextureFactory = NULL;
-*/
+
}
void SBS::Start()
//PrintBanner();
//Post-init startup code goes here, before the runloop
+ engine->Prepare();
//set up initial camera position
view = csPtr<iView>(new csView (engine, g3d));
g2d = g3d->GetDriver2D();
view->SetRectangle(0, 0, g2d->GetWidth(), g2d->GetHeight());
- //get camera object
- c = view->GetCamera();
-
//set main simulation values
InputOnly = false;
RenderOnly = false;
//start simulation
csDefaultRunLoop (object_reg);
-/*
- pEngine = CreateTVEngine();
-
- //Set the debug file before doing anything else
- pEngine->SetDebugFile ("c:\\debug.txt");
- //Initialize Windowed
- pEngine->Init3DWindowedMode ((long)WindowHandle, true);
-
- //Tell it to display the FPS
- pEngine->put_DisplayFPS(tvtrue);
-
- //AppPath is a small Macro function in tv3dcpp lib to return the path
- //of a file you pass to it, in this case we get the application path
- char path[256];
- char srchpath[256];
-
- HMODULE Module = (HMODULE)hInstance;
- GetModuleFileName(Module,path,255);
-
- AppPath(path,srchpath);
-
- //Set the search directory of the objects, textures, ...
- pEngine->SetSearchDirectory(srchpath);
-
- //We set the AngleSystem to Degrees
- pEngine->SetAngleSystem (TV_ANGLE_DEGREE);
-
- //Init input after main init, and check if it errors anywhere.
- pInput = CreateTVInputEngine();
- pScene = CreateTVScene();
- pGlobals = CreateTVGlobals();
- pAtmos = CreateTVAtmosphere();
- pCamera = CreateTVCamera();
- pMatFactory = CreateTVMaterialFactory();
- pLightEngine = CreateTVLightEngine();
- pGraphicEffect = CreateTVGraphicEffect();
-*/
}
void SBS::Wait(long milliseconds)
}
+void SBS::SlowToFPS(long FrameRate)
+{
+
+}
+
void SBS::render()
{
// Tell 3D driver we're going to display 3D things.
csOrthoTransform ot (rot, c->GetTransform().GetOrigin ());
c->SetTransform (ot);
-/* if(pInput->IsKeyPressed(TV_KEY_UP))
- pCamera->MoveRelative ((0.015 * pEngine->TimeElapsed()), 0, 0, tvfalse);
-
- if(pInput->IsKeyPressed(TV_KEY_DOWN))
- pCamera->MoveRelative ((-0.015 * pEngine->TimeElapsed()), 0, 0, tvfalse);
-
- if(pInput->IsKeyPressed(TV_KEY_LEFT))
- pCamera->RotateY (pEngine->TimeElapsed() * -6 / 100);
-
- if(pInput->IsKeyPressed(TV_KEY_RIGHT))
- pCamera->RotateY (pEngine->TimeElapsed() * 6 / 100);
-
- if(pInput->IsKeyPressed(TV_KEY_PAGEUP))
- pCamera->RotateX (-0.68);
-
- if(pInput->IsKeyPressed(TV_KEY_PAGEDOWN))
- pCamera->RotateX (0.68);
-
- if(pInput->IsKeyPressed(TV_KEY_HOME))
- pCamera->MoveRelative (0, 1, 0, tvfalse);
-
- if(pInput->IsKeyPressed(TV_KEY_END))
- pCamera->MoveRelative (0, -1, 0, tvfalse);
-
- if(pInput->IsKeyPressed(TV_KEY_F1))
- pEngine->ScreenShot ("../shot.bmp");
-
- if(pInput->IsKeyPressed(TV_KEY_A) && RideCar->GetPosition().z > 0)
- GoCar = true;
-
- if(pInput->IsKeyPressed(TV_KEY_SPACE))
- pCamera->SetRotation (0, 180, 0);
-
- lineend = pCamera->GetPosition();
- LineTest = lineend;
-
- if(lineend.x > linestart.x)
- LineTest.x = lineend.x + 2;
- if(lineend.x < linestart.x)
- LineTest.x = lineend.x - 2;
- if(lineend.z > linestart.z)
- LineTest.z = lineend.z + 2;
- if(lineend.z < linestart.z)
- LineTest.z = lineend.z - 2;
-
- //if (Room->Collision(linestart, LineTest, TV_TESTTYPE_ACCURATETESTING, 0) == tvtrue || HypnoRoom->Collision(linestart, LineTest, TV_TESTTYPE_ACCURATETESTING, 0) == tvtrue || HypnoDoor->Collision(linestart, LineTest, TV_TESTTYPE_ACCURATETESTING, 0) == tvtrue || HypnoRide->Collision(linestart, LineTest, TV_TESTTYPE_ACCURATETESTING, 0) == tvtrue || RideDoor->Collision(linestart, LineTest, TV_TESTTYPE_ACCURATETESTING, 0) == tvrue Or RideCar->Collision(linestart, LineTest, TV_TESTTYPE_ACCURATETESTING, 0) == tvtrue)
- // pCamera->SetPosition (linestart.x, linestart.y, linestart.z);
- //else
- // pCamera->SetPosition (lineend.x, lineend.y, lineend.z);
- //
- if(pInput->IsKeyPressed(TV_KEY_ESCAPE)) //Check if ESCAPE has been pressed.
- {
- PostQuitMessage(0);
- }*/
-}
-
-void SBS::SlowToFPS(long FrameRate)
-{
-
}
void SBS::FinishFrame()
// First get elapsed time from the virtual clock.
elapsed_time = vc->GetElapsedTicks ();
+ //get camera object
+ c = view->GetCamera();
+
//if (RenderOnly == false)
input();
//if (InputOnly == false)
return sbs ? sbs->HandleEvent (ev) : false;
}
-bool SBS::Initialize()
+bool SBS::Initialize(const char *windowtitle)
{
if (!csInitializer::RequestPlugins (object_reg,
}
// Open the main system. This will open all the previously loaded plug-ins.
+ iNativeWindow* nw = g2d->GetNativeWindow ();
+ if (nw) nw->SetTitle (windowtitle);
if (!csInitializer::OpenApplication (object_reg))
{
csReport (object_reg, CS_REPORTER_SEVERITY_ERROR,
// not to need this.
engine->SetLightingCacheMode (0);
- //Load textures
-
// these are used store the current orientation of the camera
rotY = rotX = 0;
//create 3D environment
area = engine->CreateSector("area");
-
- engine->Prepare();
return true;
}
return false;
}
+void Cleanup()
+{
+ //cleanup
+ csInitializer::DestroyApplication (object_reg);
+}
+
void SBS::AddWall(csRef<iThingFactoryState> dest, const char *texture, float x1, float z1, float x2, float z2, float wallheight, float altitude, float tw, float th)
{
//Adds a wall with the specified dimensions
//global functions
bool IsEven(int Number);
float AutoSize(float n1, float n2, bool iswidth);
+void Cleanup();
struct iEngine;
struct iLoader;
public:
//Engine data
- iObjectRegistry* object_reg;
csRef<iEngine> engine;
csRef<iLoader> loader;
csRef<iGraphics3D> g3d;
// D3DVECTOR CameraStartRotation;
//public functions
- SBS(iObjectRegistry* object_reg);
+ SBS(int _argc, char** _argv);
~SBS();
void Wait(long Milliseconds);
- void render();
- void input();
void SlowToFPS(long FrameRate);
bool LoadTexture(const char *name, const char *filename);
- bool Initialize();
+ bool Initialize(const char *windowtitle);
void Start();
void AddLight(const char *name, float x, float y, float z, float radius, float r, float g, float b);
void SetStartPosition(float x, float y, float z);
//private functions
void PrintBanner();
+ void render();
+ void input();
static bool SBSEventHandler(iEvent& ev);
bool HandleEvent(iEvent& ev);
void FinishFrame();
+ int argc;
+ char **argv;
};
#include "csutil/event.h"
#include "sbs.h"
-#include "tritoncenter.h"
+#include "floor.h"
+#include "elevator.h"
+#include "globals.h"
SBS *Simcore;
-iObjectRegistry* object_reg;
+Floor *testfloor;
-void startsim()
+int main (int argc, char* argv[])
{
//Create new simulator object
- Simcore = new SBS (object_reg);
+ Simcore = new SBS(argc, argv);
//set default starting elevator
Simcore->ElevatorNumber = 1;
Simcore->FrameRate = 30;
Simcore->FrameLimiter = true;
- //temporary static values
- //SoundDivisor = 10
- //SoundMaxDistance = 1000
-
- //Print banner
- //Dest.ForeColor = RGB(255, 255, 255)
- //Dest.BackColor = RGB(0, 0, 0)
-
//Start simulator
- if (Simcore->Initialize ())
+ if (Simcore->Initialize("Skyscraper 1.1 Alpha"))
{
LoadTritonCenter(); //temporary building loader
Simcore->Start();
}
- //DoEvents
-
- //wait 2 seconds
- //Sleep(2000);
-
- //Dest.Print Spc(2); "Initializing TrueVision3D..."
- //DoEvents
-
- //Simcore->IsRunning = true;
- //EnableCollisions = true;
+ delete testfloor;
delete Simcore;
+ testfloor = 0;
Simcore = 0;
-
-}
+ Cleanup();
-int main (int argc, char* argv[])
-{
- object_reg = csInitializer::CreateEnvironment (argc, argv);
- startsim();
- csInitializer::DestroyApplication (object_reg);
return 0;
}
+void LoadTritonCenter()
+{
+ //This is a temporary function to load the Triton Center, since file loading
+ //support is not implemented yet
+ Simcore->LoadTexture("stone", "/lib/std/stone4.gif");
+
+ Simcore->SetStartPosition(0, 5, -3);
+
+ testfloor = new Floor(1);
+ testfloor->FloorAltitude = 0;
+ testfloor->FloorHeight = 20;
+ testfloor->CrawlSpaceHeight = 0;
+ testfloor->CreateWallBox("stone", 10, 10, 0, 0, 0, false, 0, 0);
+
+ //Add lights
+ Simcore->AddLight(0, -3, 5, 0, 10, 1, 0, 0);
+ Simcore->AddLight(0, 3, 5, 0, 10, 0, 0, 1);
+ Simcore->AddLight(0, 0, 5, -3, 10, 0, 1, 0);
+
+}
\ No newline at end of file
#include "globals.h"
int main (int argc, char* argv[]);
-void startsim();
+void LoadTritonCenter();
+++ /dev/null
-//Skyscraper 1.1 Alpha - Temporary Triton Center building definitions
-//Copyright ©2005 Ryan Thoryk
-//http://www.tliquest.net/skyscraper
-//http://sourceforge.net/projects/skyscraper
-//Contact - ryan@tliquest.net
-
-//This program is free software; you can redistribute it and/or
-//modify it under the terms of the GNU General Public License
-//as published by the Free Software Foundation; either version 2
-//of the License, or (at your option) any later version.
-
-//This program is distributed in the hope that it will be useful,
-//but WITHOUT ANY WARRANTY; without even the implied warranty of
-//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-//GNU General Public License for more details.
-
-//You should have received a copy of the GNU General Public License
-//along with this program; if not, write to the Free Software
-//Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-//CrystalSpace Includes
-#include "cssysdef.h"
-#include "csutil/sysfunc.h"
-#include "iutil/vfs.h"
-#include "csutil/cscolor.h"
-#include "cstool/csview.h"
-#include "cstool/initapp.h"
-#include "iutil/eventq.h"
-#include "iutil/event.h"
-#include "iutil/objreg.h"
-#include "iutil/csinput.h"
-#include "iutil/virtclk.h"
-#include "iengine/sector.h"
-#include "iengine/engine.h"
-#include "iengine/camera.h"
-#include "iengine/light.h"
-#include "iengine/texture.h"
-#include "iengine/mesh.h"
-#include "iengine/movable.h"
-#include "iengine/material.h"
-#include "imesh/thing.h"
-#include "imesh/object.h"
-#include "ivideo/graph3d.h"
-#include "ivideo/graph2d.h"
-#include "ivideo/texture.h"
-#include "ivideo/material.h"
-#include "ivideo/fontserv.h"
-#include "ivideo/natwin.h"
-#include "igraphic/imageio.h"
-#include "imap/parser.h"
-#include "ivaria/reporter.h"
-#include "ivaria/stdrep.h"
-#include "csutil/cmdhelp.h"
-#include "csutil/event.h"
-
-#include "tritoncenter.h"
-#include "sbs.h"
-#include "floor.h"
-#include "elevator.h"
-
-extern SBS *Simcore;
-extern iObjectRegistry* object_reg;
-
-void LoadTritonCenter()
-{
- //This is a temporary function to load the Triton Center, since file loading
- //support is not implemented yet
- Simcore->LoadTexture("stone", "/lib/std/stone4.gif");
-
- Simcore->SetStartPosition(0, 5, -3);
-
- Floor *testfloor = new Floor(1);
- testfloor->FloorAltitude = 0;
- testfloor->FloorHeight = 20;
- testfloor->CrawlSpaceHeight = 0;
- testfloor->CreateWallBox("stone", 10, 10, 0, 0, 0, false, 0, 0);
-
- //Add lights
- Simcore->AddLight(0, -3, 5, 0, 10, 1, 0, 0);
- Simcore->AddLight(0, 3, 5, 0, 10, 0, 0, 1);
- Simcore->AddLight(0, 0, 5, -3, 10, 0, 1, 0);
-
-}
+++ /dev/null
-//Skyscraper 1.1 Alpha - Temporary Triton Center building definitions
-//Copyright ©2005 Ryan Thoryk
-//http://www.tliquest.net/skyscraper
-//http://sourceforge.net/projects/skyscraper
-//Contact - ryan@tliquest.net
-
-//This program is free software; you can redistribute it and/or
-//modify it under the terms of the GNU General Public License
-//as published by the Free Software Foundation; either version 2
-//of the License, or (at your option) any later version.
-
-//This program is distributed in the hope that it will be useful,
-//but WITHOUT ANY WARRANTY; without even the implied warranty of
-//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-//GNU General Public License for more details.
-
-//You should have received a copy of the GNU General Public License
-//along with this program; if not, write to the Free Software
-//Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#include "globals.h"
-
-void LoadTritonCenter();