Crystal Space
Welcome,
Guest
. Please
login
or
register
.
May 23, 2013, 12:17:07 am
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
9224
Posts in
2230
Topics by
5385
Members
Latest Member:
Ritatondreau
Crystal Space
Crystal Space Development
Support
Problems with my custom maps
« previous
next »
Pages:
[
1
]
Author
Topic: Problems with my custom maps (Read 1664 times)
Gladius_Coldhead
Newbie
Posts: 9
Problems with my custom maps
«
on:
August 01, 2007, 05:56:04 am »
Well, Hi.
First, I have 3 Applications, the first is my own application(an application to load player, maps...in CEL and manager them), the second is Celtst(cel tutorial), and the third is original Walktest.
Well, I made a simple map with lights, textures, simple mechs...
But, when I load my map with Walktest, everything appears normal, and when I load my map with my own application some textures appear white(or black) or uggly.
When I run celtst, the level appear normal, cool effects....But when I try load the 'celtst map' with my own app, some textures appear white, black and uggly too @_@
Celtst Problem:
http://www.brimages.com/uploads/10/c8fa4f242b.png
http://www.brimages.com/uploads/7/2514e81ec9.png
http://www.brimages.com/uploads/4/3120930075.png
http://www.brimages.com/uploads/12/df9823a65f.png
Thanks
Logged
jorrit
Administrator
Hero Member
Posts: 1703
Re: Problems with my custom maps
«
Reply #1 on:
August 01, 2007, 07:05:46 am »
Hmm that's strange. Perhaps compare the output of your app with -verbose=-scf (note the '-scf' and not 'scf') with the output of walktest or celtest with same option. Otherwise you can also post the source code of your program somewhere so I can look at it.
Greetings,
Logged
Gladius_Coldhead
Newbie
Posts: 9
Re: Problems with my custom maps
«
Reply #2 on:
August 02, 2007, 05:39:32 am »
Humn...the output log appear the same(celtst and my own app).
Well, I'll post some parts of the source.
Game.h:
http://rafb.net/p/1LLjNk25.html
Game.cpp:
http://rafb.net/p/9sDPrc65.html
Logged
Gladius_Coldhead
Newbie
Posts: 9
Re: Problems with my custom maps
«
Reply #3 on:
August 07, 2007, 05:59:15 am »
Ok i'll post the source here.
Game.h:
Code:
#ifndef GAME_H
#define GAME_H
#include <crystalspace.h>
#include <physicallayer/entity.h>
#include <physicallayer/pl.h>
#include <behaviourlayer/bl.h>
#include <ivaria/icegui.h>
#include <propclass/zone.h>
//
struct iTextureManager;
struct iBillboardManager;
struct iPcCommandInput;
struct iPcActorMove;
struct iSyntaxService;
struct iSndSysRenderer;
struct iSndSysLoader;
struct iEntityLoader;
class GUIManager;
class EnvManager;
class Game : public csApplicationFramework,public csBaseEventHandler
{
private:
csRef<iGraphics3D> g3d;
csRef<iGraphics2D> g2d;
csRef<iEngine> engine;
csRef<iLoader> loader;
csRef<iVFS> vfs;
csRef<iVirtualClock> vc;
csRef<iKeyboardDriver> kbd;
csRef<iMouseDriver> mouse;
csRef<iReporter> reporter;
csRef<iSyntaxService> synserv;
csRef<iFontServer> fontserv;
csRef<iEntityLoader> entityloader;
csRef<iCEGUI> cegui;
csRef<iView> view;
float rotX, rotY;
csRef<iCelPlLayer> pl;
csRef<iCelBlLayer> bl;
GUIManager* guimanager;
EnvManager* envmanager;
csRef<iCelEntity> scene;
csRef<iCelEntity> player_entity;
csRef<iCelEntity> gamemanager;
csString start_name;
csString start_region;
csRef<iConfigManager> app_cfg;
bool OnKeyboard (iEvent&);
void PreProcessFrame ();
void ProcessFrame ();
void PostProcessFrame();
void FinishFrame ();
bool SetupScreen ();
bool MainInit();
public:
Game ();
virtual ~Game ();
iLoader* GetLoader () const { return loader; }
iEngine* GetEngine () const { return engine; }
iVFS* GetVFS () const { return vfs; }
iCEGUI* GetCEGUI() const { return cegui; }
iCelPlLayer* GetPl () const { return pl; }
iCelBlLayer* GetBl () const { return bl; }
EnvManager* GetEnvManager () const { return envmanager; }
GUIManager* GetGUIManager () const { return guimanager; }
virtual bool OnInitialize (int argc, char* argv[]);
virtual bool Application ();
static void Terminate();
bool PreloadSound(const char*);
const char* GetCurrentRegion();
// Loading Level and Player
bool LoadLevel (const char* leveldir, const char* levelfile,
const char* entityname, const char* behaviour,
int loadingmode = CEL_ZONE_NORMAL);
bool CreatePlayer(const char* playername, const char* configname);
bool PreparePlayer(const char* playername, const char* configname,const char* level_entityname);
bool CreateGameManager ();
bool ParseLevel (const char* levelfile,iPcZoneManager* zonemgr);
bool CreateTestNPC();
const char* TakeScreenshot();
};
#endif
Logged
Gladius_Coldhead
Newbie
Posts: 9
Re: Problems with my custom maps
«
Reply #4 on:
August 07, 2007, 06:01:59 am »
Now...Game.CPP:
Code:
#include "Game.h"
#include <crystalspace.h>
#include <celtool/initapp.h>
#include <propclass/zone.h>
#include <propclass/mesh.h>
#include <propclass/linmove.h>
#include <propclass/actormove.h>
#include <propclass/meshsel.h>
#include <propclass/input.h>
#include <propclass/defcam.h>
#include <propclass/camera.h>
#include <propclass/newcamera.h>
#include <propclass/mechsys.h>
#include <propclass/inv.h>
#include <propclass/prop.h>
#include <propclass/timer.h>
#include <propclass/billboard.h>
#include <propclass/sound.h>
#include <physicallayer/propclas.h>
#include <tools/billboard.h>
#include <tools/entityloader.h>
#include "Gui/GUIManager.h"
#include "Environment/EnvManager.h"
#include "behaviour/BehaviourLayer.h"
Game::Game ()
{
SetApplicationName ("behaviourpark");
guimanager = 0;
envmanager = 0;
}
Game::~Game ()
{
delete guimanager;
delete envmanager;
}
static csVector3 GetConfigVector (iConfigManager* config, const char* key)
{
csVector3 v;
sscanf (config->GetStr (key), "%f,%f,%f", &v.x, &v.y, &v.z);
return v;
}
const char* Game::TakeScreenshot()
{
// get our image into a data buffer
csRef<iImage> screenshot (g3d->GetDriver2D()->ScreenShot());
csRef<iImageIO> iscreenshot = CS_QUERY_REGISTRY (object_reg, iImageIO);
csRef<iDataBuffer> buf = iscreenshot->Save(screenshot, "image/png", 0);
int n=0;
csStringBase str_filename;
// Now we gonna combine the filename
while (true)
{
n++;
// Check if we need some zeroes (just for better looking)
if (n<=9)
str_filename.Append("00");
else if (n<=99)
str_filename.Append("0");
str_filename.Append(n);
str_filename.Append(".png");
// Check if we can write the file
if (vfs->Exists(str_filename.GetData())==false)
break;
// else we clean up the strings
else
{
str_filename.Clear();
str_filename.Free();
}
};
// Write the buffer to file
vfs->WriteFile(str_filename.GetData(), buf->GetData(), buf->GetSize());
return str_filename.Detach();
}
bool Game::SetupScreen()
{
iNativeWindow* nw;
nw = g2d->GetNativeWindow();
nw -> SetTitle("Behaviour Park");
// g2d->SetMouseCursor(csmcNone);
g2d->SetMousePosition (g2d->GetWidth() / 2, g2d->GetHeight());
g2d->SetMouseCursor(csmcNone);
return true;
}
bool Game::MainInit()
{
//draw background images
guimanager->CreateMenuInitWindow ();
return true;
}
void Game::PreProcessFrame ()
{
}
void Game::ProcessFrame ()
{
guimanager->Render ();
if (g3d->BeginDraw(engine->GetBeginDrawFlags() | CSDRAW_3DGRAPHICS | CSDRAW_CLEARZBUFFER))
{
// Draw frame.
}
}
void Game::PostProcessFrame ()
{
}
void Game::FinishFrame ()
{
g3d->FinishDraw ();
g3d->Print (0);
}
void Game::Terminate()
{
csRef<iEventQueue> q = CS_QUERY_REGISTRY(GetObjectRegistry(), iEventQueue);
if (q.IsValid()) q->GetEventOutlet()->Broadcast(csevQuit (object_reg));
}
bool Game::OnKeyboard(iEvent& ev)
{
csKeyEventType eventtype = csKeyEventHelper::GetEventType(&ev);
if (eventtype == csKeyEventTypeDown)
{
utf32_char code = csKeyEventHelper::GetCookedCode(&ev);
if (code == CSKEY_ESC)
{
Terminate();
}
else if (code == 'j')
{
CreateNPC();
}
else if (code == CSKEY_F1)
{
csRef<iPcDefaultCamera> pccamera = CEL_QUERY_PROPCLASS_ENT (player_entity, iPcDefaultCamera);
iCamera* camera = pccamera->GetCamera ();
iSector* sector = camera->GetSector();
envmanager->Snow(sector,"snow",500,0.3f);
}
else if (code == CSKEY_F2)
{
TakeScreenshot();
}
}
return false;
}
bool Game::OnInitialize (int argc, char* argv[])
{
iObjectRegistry* r = GetObjectRegistry();
csDebuggingGraph::SetupGraph (object_reg);
if (!csInitializer::SetupConfigManager(object_reg,"/config/apptest.cfg"))
return ReportError("Failed to initialize configuration manager!");
app_cfg = CS_QUERY_REGISTRY (r, iConfigManager);
csArray<csPluginRequest> plugins_load;
plugins_load.Push(csPluginRequest(CS_REQUEST_VFS));
plugins_load.Push(csPluginRequest(CS_REQUEST_OPENGL3D));
plugins_load.Push(csPluginRequest(CS_REQUEST_ENGINE));
plugins_load.Push(csPluginRequest(CS_REQUEST_PLUGIN ("crystalspace.font.server.multiplexer", iFontServer)));
plugins_load.Push(csPluginRequest(CS_REQUEST_IMAGELOADER));
plugins_load.Push(csPluginRequest(CS_REQUEST_LEVELLOADER));
plugins_load.Push(csPluginRequest(CS_REQUEST_REPORTER));
plugins_load.Push(csPluginRequest(CS_REQUEST_REPORTERLISTENER));
plugins_load.Push(csPluginRequest(CS_REQUEST_PLUGIN ("crystalspace.documentsystem.xmlread", iDocumentSystem)));
plugins_load.Push(csPluginRequest(CS_REQUEST_PLUGIN ("crystalspace.collisiondetection.opcode", iCollideSystem)));
plugins_load.Push(csPluginRequest(CS_REQUEST_PLUGIN ("crystalspace.cegui.wrapper", iCEGUI)));
//plugins_load.Push(csPluginRequest(CS_REQUEST_PLUGIN("crystalspace.sndsys.renderer.software", iSndSysRenderer)));
//plugins_load.Push(csPluginRequest(CS_REQUEST_PLUGIN("crystalspace.sndsys.element.loader", iSndSysLoader)));
plugins_load.Push(csPluginRequest(CS_REQUEST_PLUGIN ("cel.physicallayer", iCelPlLayer)));
plugins_load.Push(csPluginRequest(CS_REQUEST_PLUGIN ("cel.addons.celentity", iEntityLoader)));
if (!celInitializer::RequestPlugins (object_reg, plugins_load)) { return ReportError ("Can't initialize plugins!"); }
csBaseEventHandler::Initialize(GetObjectRegistry());
if (!RegisterQueue (object_reg, csevAllEvents(object_reg))) { return ReportError ("Can't setup event handler!"); }
return true;
}
bool Game::Application ()
{
iObjectRegistry* r = GetObjectRegistry();
if (!OpenApplication (r))
return ReportError ("Error opening system!");
reporter = CS_QUERY_REGISTRY (object_reg, iReporter);
if (!reporter) return ReportError("Error loading iReporter Plugin!");
synserv = CS_QUERY_REGISTRY (object_reg, iSyntaxService);
if (!synserv) return ReportError("Error loading iSyntaxService Plugin!");
g3d = CS_QUERY_REGISTRY (object_reg, iGraphics3D);
if (!g3d) return ReportError("Error loading iGraphics3D Plugin!");
g2d = g3d->GetDriver2D();
engine = CS_QUERY_REGISTRY (object_reg, iEngine);
if (!engine) return ReportError("Error loading iEngine Plugin!");
loader = CS_QUERY_REGISTRY (object_reg, iLoader);
if (!loader) return ReportError("Error loading iLoader Plugin!");
vfs = CS_QUERY_REGISTRY (object_reg, iVFS);
if (!vfs) return ReportError("Error loading iVFS Plugin!");
vc = CS_QUERY_REGISTRY (object_reg, iVirtualClock);
if (!vc) return ReportError("Error loading iVirtualClock Plugin!");
kbd = CS_QUERY_REGISTRY (object_reg, iKeyboardDriver);
if (!kbd) return ReportError("Error loading iKeyboardDriver Plugin!");
entityloader = CS_QUERY_REGISTRY (object_reg, iEntityLoader);
if (!entityloader) return ReportError("Error loading iEntityLoader Plugin!");
mouse = CS_QUERY_REGISTRY (object_reg, iMouseDriver);
if (!mouse) return ReportError("Error loading iMouseDriver Plugin!");
fontserv = CS_QUERY_REGISTRY (object_reg, iFontServer);
if (!fontserv) return ReportError("Error loading iFontServer Plugin");
cegui = CS_QUERY_REGISTRY(GetObjectRegistry(), iCEGUI);
if (!cegui) return ReportError("Failed to locate CEGUI plugin");
if (!SetupScreen())
return ReportError ("Problems with setup of the screen");
pl = CS_QUERY_REGISTRY (object_reg, iCelPlLayer);
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.zonemanager"))
return ReportError ("Error loading pczonemanager factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.solid"))
return ReportError ("Error loading pcsolid factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.colldet"))
return ReportError ("Error loading pccolldet factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.actormove"))
return ReportError ("Error loading pcactormove factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.mesh"))
return ReportError ("Error loading pcmesh factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.trigger"))
return ReportError ("Error loading pctrigger factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.mechobject"))
return ReportError ("Error loading mechobject factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.mechsys"))
return ReportError ("Error loading mechsys factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.meshselect"))
return ReportError ("Error loading meshselect factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.defaultcamera"))
return ReportError ("Error loading defaultcamera factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.newcamera"))
return ReportError ("Error loading newcamera factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.linmove"))
return ReportError ("Error loading pclinmove factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.pccommandinput"))
return ReportError ("Error loading pccommandinput factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.inventory"))
return ReportError ("Error loading pcinventory factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.properties"))
return ReportError ("Error loading pcproperties factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.timer"))
return ReportError ("Error loading pctimer factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.billboard"))
return ReportError ("Error loading pcbillboard factory!");
if (!pl->LoadPropertyClassFactory ("cel.pcfactory.colldet"))
return ReportError ("Error loading pccollisiondetection factory!");
bl.AttachNew (new BehaviourLayer(this));
if (!object_reg->Register (bl, "iCelBlLayer"))
return ReportError ("Can't register our behaviour layer!");
pl->RegisterBehaviourLayer (bl);
guimanager = new GUIManager (this);
if (!guimanager->Initialize ())
return false;
envmanager = new EnvManager (this);
if (!envmanager->Initialize (10,30,17))
return false;
if (!MainInit())
return ReportError ("Problems with setup main menu");
if (!CreateGameManager ())
return false;
engine->Prepare ();
Run ();
return true;
}
bool Game::LoadLevel (const char* leveldir, const char* levelfile,
const char* entityname, const char* behaviour, int loadingmode)
{
vfs->ChDir (leveldir);
csRef<iCelEntity> level = pl->CreateEntity ("level", bl, behaviour,
"pczonemanager",
(const char*)0);
if (!level) return false;
csRef<iPcZoneManager> zonemgr = CEL_QUERY_PROPCLASS_ENT (level,iPcZoneManager);
zonemgr->SetLoadingMode (loadingmode);
if (!ParseLevel (levelfile, zonemgr))
return false;
pl->CreatePropertyClass(level, "pcinventory");
/*
pl->CreatePropertyClass(level, "pcmechsys");
csRef<iPcMechanicsSystem> pcmechsys = CEL_QUERY_PROPCLASS_ENT(level,iPcMechanicsSystem);
pcmechsys->EnableQuickStep ();
pcmechsys->SetSimulationSpeed(app_cfg->GetFloat("AppTest.Physics.Simulationspeed", 1.0f));
pcmechsys->SetStepTime (app_cfg->GetFloat("AppTest.Physics.StepTime", 0.001f));
pcmechsys->SetGravity (csVector3 (0,-7,0));
scene = pl->CreateEntity("ent_scene", 0, 0,"pcmesh","pcmechobject",(const char*)0);
csRef<iPcMesh> pcmeshscene = CEL_QUERY_PROPCLASS_ENT(scene, iPcMesh);
vfs->Mount("/apptest/map","$*data$/apptest$/world.zip");
pcmeshscene->SetPath ("/apptest/map");
if (!pcmeshscene->SetMesh("thingCube.001", "factories/thingCube.001"))
return ReportError("could not load TerrainFact mesh factory!");
csRef<iPcMechanicsObject> pcmechobjscene = CEL_QUERY_PROPCLASS_ENT(scene,iPcMechanicsObject);
pcmechobjscene->AttachColliderMesh();
pcmechobjscene->MakeStatic(true);
*/
return true;
}
bool Game::CreateGameManager ()
{
//gamemanager = pl->CreateEntity ("gamemanager", bl,"behave_gamemanager");
// if (!gamemanager) return false;
return true;
}
bool Game::CreatePlayer (const char* playername, const char* configname)
{
player_entity = pl->CreateEntity ("player", bl,"player_behave",
"pcdefaultcamera", // The player has a camera.
"pcmesh", // This is the mesh for the player.
// "pcmechobject", // Movement system property class.
"pcactormove",
"pclinearmovement",
"pccommandinput", // Keyboard movement.
"pcproperties", // Named properties.
"pcinventory",
(void*)0);
if (!player_entity) return false;
return true;
}
bool Game::PreparePlayer (const char* playername, const char* configname,const char* level_entityname)
{
if (!player_entity) return false;
csConfigAccess config;
config.AddConfig (object_reg, configname);
csRef<iPcDefaultCamera> pccamera = CEL_QUERY_PROPCLASS_ENT(player_entity, iPcDefaultCamera);
iCelEntity* level = pl->FindEntity (level_entityname);
if (level == 0)
{
return ReportError (
"Can't find level '%s' for creating the player!", level_entityname);
}
csRef<iPcZoneManager> pczonemgr = CEL_QUERY_PROPCLASS_ENT (level,iPcZoneManager);
pccamera->SetZoneManager (pczonemgr, true, start_region, start_name);
pccamera->SetMode (iPcDefaultCamera::firstperson);
pccamera->SetSpringParameters ( 10.0f,0.1f,0.01f);
pccamera->SetPitch (-0.4f);
pccamera->SetMode (iPcDefaultCamera::thirdperson);
pccamera->SetSpringParameters (3.5f,0.25f,0.01f);
pccamera->SetPitch (-0.3f);
pccamera->SetMode (iPcDefaultCamera::m64_thirdperson);
pccamera->SetSpringParameters (3.5f,0.25f,0.01f);
pccamera->SetMinMaxCameraDistance (2.0f,6.0f);
pccamera->SetTurnSpeed (1.0f);
pccamera->SetPitch (-0.1f);
pccamera->SetMode (iPcDefaultCamera::lara_thirdperson);
pccamera->SetSpringParameters (3.5,0.25f,0.01f);
pccamera->SetMinMaxCameraDistance (2.0f,6.0f);
pccamera->SetTurnSpeed (1.0f);
pccamera->SetSwingCoef (0.7f);
pccamera->SetPitch (-0.1f);
pccamera->SetMode (iPcDefaultCamera::freelook);
pccamera->SetSpringParameters (3.5f,0.25f,0.01f);
pccamera->SetMinMaxCameraDistance (2.0f,16.0f);
pccamera->SetPitch (-0.1f);
pccamera->SetFirstPersonOffset (csVector3 (0,2,0));
pccamera->SetThirdPersonOffset (csVector3 (0,3,1));
pccamera->SetModeName ("thirdperson");
// Get the iPcMesh interface so we can load the right mesh for our player.
csRef<iPcMesh> pcmesh = CEL_QUERY_PROPCLASS_ENT (player_entity, iPcMesh);
pcmesh->SetPath ("/cellib/objects");
pcmesh->SetMesh ("test","cally.cal3d");
if (!pcmesh->GetMesh ())
return ReportError ("Error loading model!");
if (pczonemgr->PointMesh (player_entity->GetName (), start_region,start_name))
return ReportError ("Can't find region or start position in region!");
csRef<iPcLinearMovement> pclinmove = CEL_QUERY_PROPCLASS_ENT (player_entity,iPcLinearMovement);
/* pclinmove->InitCD (
GetConfigVector (app_cfg,"CDBody"),
GetConfigVector (app_cfg,"CDLegs"),
GetConfigVector (app_cfg,"CDShift")); */
pclinmove->InitCD (
csVector3 (0.5f, 0.8f, 0.5f),
csVector3 (0.5f, 0.4f, 0.5f),
csVector3 (0.0f, 0.0f, 0.0f));
csRef<iPcActorMove> pcactormove = CEL_QUERY_PROPCLASS_ENT (player_entity,
iPcActorMove);
pcactormove->SetMovementSpeed (3.0f);
pcactormove->SetRunningSpeed (6.0f);
pcactormove->SetRotationSpeed (3.15f);
pcactormove->SetJumpingVelocity (7.31f);
pcactormove->MouseMove(600,800);
float ms = app_cfg->GetFloat("AppTest.Mouse.MoveSpeed");
pcactormove->SetMouseMoveSpeed(ms,ms);
pcactormove->EnableMouseMove(false);
csRef<iPcCommandInput> pcinput = CEL_QUERY_PROPCLASS_ENT (player_entity,iPcCommandInput);
pcinput->Bind("w", "forward");
pcinput->Bind("s","backward");
pcinput->Bind("a","rotateleft");
pcinput->Bind("d","rotateright");
pcinput->Bind("tab","cammode");
pcinput->Bind("enter", "center");
pcinput->Bind ("shift", "run");
pcinput->Bind ("space", "jump");
pcinput->Bind ("t", "teste");
pcinput->Bind ("mousex_centered", "mouse_move_x");
pcinput->Bind ("mousey_centered", "mouse_move_y");
csRef<iPcInventory> pcinv_room = CEL_QUERY_PROPCLASS_ENT (level, iPcInventory);
if ((!pcinv_room) || (!pcinv_room->AddEntity (player_entity)))
return ReportError("unable to add player to room's inventory!");
/*
csRef<iPcMechanicsObject> pcmechobj = CEL_QUERY_PROPCLASS_ENT(player_entity,iPcMechanicsObject);
csBox3 bbox;
pcmesh->GetMesh ()->GetMeshObject ()->GetObjectModel ()->GetObjectBoundingBox(bbox);
pcmechobj->SetFriction (0.05f);
pcmechobj->AttachColliderBox (bbox.GetSize (), csOrthoTransform ());
pcmechobj->SetSoftness (1.0f);
pcmechobj->SetMass (1.0f);
pcmechobj->SetDensity (3.0f);
*/
return true;
}
bool Game::ParseLevel (const char* levelfile,
iPcZoneManager* zonemgr)
{
bool rc = zonemgr->Load (0, levelfile);
if (!rc) return false;
scfString regionname, startname;
zonemgr->GetLastStartLocation (®ionname, &startname);
start_name = startname;
start_region = regionname;
return true;
}
bool Game::CreateTestNPC()
{
csRef<iCelEntity> npc1_entity = pl->CreateEntity ("npc1", bl,"npc_behave",
"pcmesh",
// "pcmechobject",
"pcactormove",
"pclinearmovement",
"pcproperties",
"pcmeshselect",
"pctimer",
(void*)0);
csRef<iPcMesh> pcmesh = CEL_QUERY_PROPCLASS_ENT (npc1_entity, iPcMesh);
pcmesh->SetPath ("/cellib/objects");
pcmesh->SetMesh ("test","cally.cal3d");
csRef<iPcMesh> pcmesh2 = CEL_QUERY_PROPCLASS_ENT (player_entity, iPcMesh);
csRef<iPcDefaultCamera> pccamera = CEL_QUERY_PROPCLASS_ENT (player_entity, iPcDefaultCamera);
iCamera* camera = pccamera->GetCamera ();
iSector* sector = camera->GetSector();
csVector3 pos = pcmesh2->GetMesh ()->GetMovable ()->GetPosition();
csRef<iPcLinearMovement> pclinmove = CEL_QUERY_PROPCLASS_ENT (npc1_entity,iPcLinearMovement);
pclinmove->InitCD (
csVector3 (0.5f, 0.8f, 0.5f),
csVector3 (0.5f, 0.4f, 0.5f),
csVector3 (0.0f, 0.01f, 0.0f));
pclinmove->SetPosition(pos,0, sector);
csRef<iPcActorMove> pcactormove = CEL_QUERY_PROPCLASS_ENT (npc1_entity,
iPcActorMove);
pcactormove->SetMovementSpeed (4.0f);
pcactormove->SetRunningSpeed (6.0f);
pcactormove->SetRotationSpeed (3.15f);
pcactormove->SetJumpingVelocity (7.31f);
csRef<iPcTimer> pctimer = CEL_QUERY_PROPCLASS_ENT (npc1_entity, iPcTimer);
pctimer->WakeUp(2000, true);
return true;
}
Logged
Pages:
[
1
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Crystal Space Development
-----------------------------
=> General Crystal Space Discussion
=> Support
-----------------------------
Crystal Space Project Development
-----------------------------
=> Feature Requests
=> Plugins
=> Bug Reports
-----------------------------
Crystal Space Development
-----------------------------
=> Game Content Creation
-----------------------------
Miscellaneous
-----------------------------
=> Article/Tutorial Requests
=> Article/Tutorial Discussion
-----------------------------
Crystal Space Project Development
-----------------------------
=> Development Discussion
-----------------------------
Crystal Space Projects
-----------------------------
=> Project Discussion
=> WIP Projects
=> Finished Projects
-----------------------------
Associate Projects
-----------------------------
=> CEL Discussion
=> Crystal Core Discussion
=> CrystalBlend Discussion
-----------------------------
Crystal Space Project Development
-----------------------------
=> Google Summer of Code
-----------------------------
Associate Projects
-----------------------------
=> Apricot (Open Game)
=> Ares Project
Loading...