Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(51) |
Jun
(91) |
Jul
(31) |
Aug
(9) |
Sep
(59) |
Oct
(27) |
Nov
(142) |
Dec
(99) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(30) |
Feb
(65) |
Mar
(105) |
Apr
(276) |
May
(92) |
Jun
(81) |
Jul
(94) |
Aug
(145) |
Sep
(129) |
Oct
(96) |
Nov
(56) |
Dec
(59) |
2005 |
Jan
(86) |
Feb
(100) |
Mar
(252) |
Apr
(328) |
May
(223) |
Jun
(101) |
Jul
(393) |
Aug
(44) |
Sep
(226) |
Oct
(152) |
Nov
(48) |
Dec
(74) |
2006 |
Jan
(42) |
Feb
(4) |
Mar
(8) |
Apr
(12) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
1
|
2
|
3
(6) |
4
(5) |
5
(5) |
6
|
7
|
8
(6) |
9
|
10
(2) |
11
|
12
(10) |
13
|
14
|
15
(1) |
16
(2) |
17
(2) |
18
(10) |
19
|
20
(1) |
21
(1) |
22
|
23
|
24
(11) |
25
(10) |
26
(10) |
27
|
28
(6) |
29
(1) |
30
(5) |
31
|
From: Daniel Rigby <rigbyd@us...> - 2004-07-30 21:50:00
|
Update of /cvsroot/once/oncecode/vs/vc7.1/onceserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2224/vs/vc7.1/onceserver Modified Files: onceserver.vcproj Log Message: Fixed project files for msvc, cause Remi broke them again (-: Client seems to be broken currently though, explodes on loading map. Index: onceserver.vcproj =================================================================== RCS file: /cvsroot/once/oncecode/vs/vc7.1/onceserver/onceserver.vcproj,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** onceserver.vcproj 19 Jul 2004 23:09:00 -0000 1.18 --- onceserver.vcproj 30 Jul 2004 21:49:51 -0000 1.19 *************** *** 134,144 **** </File> <File RelativePath="..\..\..\src\common\ocarea.cpp"> </File> <File RelativePath="..\..\..\src\server\ocareastate.cpp"> </File> <File ! RelativePath="..\..\..\src\common\bl\ocbl.cpp"> </File> <File --- 134,153 ---- </File> <File + RelativePath="..\..\..\src\common\ocapplication.cpp"> + </File> + <File RelativePath="..\..\..\src\common\ocarea.cpp"> </File> <File + RelativePath="..\..\..\src\server\behaviours\ocarea_bl.cpp"> + </File> + <File RelativePath="..\..\..\src\server\ocareastate.cpp"> </File> <File ! RelativePath="..\..\..\src\server\ocbl.cpp"> ! </File> ! <File ! RelativePath="..\..\..\src\common\ocblcommon.cpp"> </File> <File *************** *** 161,167 **** </File> <File - RelativePath="..\..\..\src\common\ocentitymesh.cpp"> - </File> - <File RelativePath="..\..\..\src\server\ocentitystate.cpp"> </File> --- 170,173 ---- *************** *** 218,221 **** --- 224,230 ---- </File> <File + RelativePath="..\..\..\src\server\behaviours\ocplayer_bl.cpp"> + </File> + <File RelativePath="..\..\..\src\common\ocplayeractionmsg.cpp"> </File> *************** *** 276,288 **** --- 285,309 ---- </File> <File + RelativePath="..\..\..\src\common\ocapplication.h"> + </File> + <File RelativePath="..\..\..\src\common\ocarea.h"> </File> <File + RelativePath="..\..\..\src\server\behaviours\ocarea_bl.h"> + </File> + <File RelativePath="..\..\..\src\server\ocareastate.h"> </File> <File + RelativePath="..\..\..\src\server\ocbl.h"> + </File> + <File RelativePath="..\..\..\src\common\bl\ocbl.h"> </File> <File + RelativePath="..\..\..\src\common\ocblcommon.h"> + </File> + <File RelativePath="..\..\..\src\common\occhangenumber.h"> </File> *************** *** 354,357 **** --- 375,381 ---- </File> <File + RelativePath="..\..\..\src\server\behaviours\ocplayer_bl.h"> + </File> + <File RelativePath="..\..\..\src\common\ocplayeractionmsg.h"> </File> |
From: Daniel Rigby <rigbyd@us...> - 2004-07-30 21:49:59
|
Update of /cvsroot/once/oncecode/vs/vc7.1/onceclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2224/vs/vc7.1/onceclient Modified Files: onceclient.vcproj Log Message: Fixed project files for msvc, cause Remi broke them again (-: Client seems to be broken currently though, explodes on loading map. Index: onceclient.vcproj =================================================================== RCS file: /cvsroot/once/oncecode/vs/vc7.1/onceclient/onceclient.vcproj,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** onceclient.vcproj 19 Jul 2004 23:09:00 -0000 1.16 --- onceclient.vcproj 30 Jul 2004 21:49:51 -0000 1.17 *************** *** 133,136 **** --- 133,139 ---- </File> <File + RelativePath="..\..\..\src\common\ocapplication.cpp"> + </File> + <File RelativePath="..\..\..\src\common\ocarea.cpp"> </File> *************** *** 139,143 **** </File> <File ! RelativePath="..\..\..\src\common\bl\ocbl.cpp"> </File> <File --- 142,149 ---- </File> <File ! RelativePath="..\..\..\src\client\ocbl.cpp"> ! </File> ! <File ! RelativePath="..\..\..\src\common\ocblcommon.cpp"> </File> <File *************** *** 151,154 **** --- 157,163 ---- </File> <File + RelativePath="..\..\..\src\client\occltbehave.cpp"> + </File> + <File RelativePath="..\..\..\src\client\occltcmd.cpp"> </File> *************** *** 169,175 **** </File> <File - RelativePath="..\..\..\src\common\ocentitymesh.cpp"> - </File> - <File RelativePath="..\..\..\src\common\ocfactory.cpp"> </File> --- 178,181 ---- *************** *** 260,263 **** --- 266,272 ---- </File> <File + RelativePath="..\..\..\src\common\ocapplication.h"> + </File> + <File RelativePath="..\..\..\src\common\ocarea.h"> </File> *************** *** 266,272 **** --- 275,287 ---- </File> <File + RelativePath="..\..\..\src\client\ocbl.h"> + </File> + <File RelativePath="..\..\..\src\common\bl\ocbl.h"> </File> <File + RelativePath="..\..\..\src\common\ocblcommon.h"> + </File> + <File RelativePath="..\..\..\src\common\occhangenumber.h"> </File> *************** *** 278,281 **** --- 293,299 ---- </File> <File + RelativePath="..\..\..\src\client\occltbehave.h"> + </File> + <File RelativePath="..\..\..\src\client\occltcmd.h"> </File> *************** *** 296,303 **** </File> <File ! RelativePath="..\..\..\src\common\ocentitymesh.h"> </File> <File ! RelativePath="..\..\..\src\client\ocentitymesh.h"> </File> <File --- 314,321 ---- </File> <File ! RelativePath="..\..\..\src\client\ocentitymesh.h"> </File> <File ! RelativePath="..\..\..\src\common\ocentitymesh.h"> </File> <File |
From: Remi Bonnet <elscouta@us...> - 2004-07-30 21:32:08
|
Update of /cvsroot/once/oncecode/src/common/bl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31770/src/common/bl Removed Files: ocarea_bl.cpp ocarea_bl.h ocbl.cpp ocbl.h ocplayer_bl.cpp ocplayer_bl.h Log Message: Deleted dir. *poof* --- ocbl.h DELETED --- --- ocarea_bl.h DELETED --- --- ocbl.cpp DELETED --- --- ocarea_bl.cpp DELETED --- --- ocplayer_bl.cpp DELETED --- --- ocplayer_bl.h DELETED --- |
From: Robin Stanton <uavfun@us...> - 2004-07-30 01:22:24
|
Update of /cvsroot/once/oncecode/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6368/src/common Modified Files: ocentity.cpp Log Message: There is no variable mesh Index: ocentity.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocentity.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ocentity.cpp 28 Jul 2004 16:51:49 -0000 1.17 --- ocentity.cpp 30 Jul 2004 01:22:14 -0000 1.18 *************** *** 85,89 **** { svrstate = 0; - CS_ASSERT(mesh == 0); } --- 85,88 ---- |
From: Robin Stanton <uavfun@us...> - 2004-07-30 01:16:35
|
Update of /cvsroot/once/oncecode/src/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5409/src/server Modified Files: ocareastate.cpp Log Message: Small fix Index: ocareastate.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocareastate.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** ocareastate.cpp 28 Jul 2004 16:51:49 -0000 1.38 --- ocareastate.cpp 30 Jul 2004 01:16:19 -0000 1.39 *************** *** 228,231 **** --- 228,233 ---- // first subscription to entities Resubscribe(player_state); + + return true; } |
From: Jon <resquad@us...> - 2004-07-29 01:19:54
|
Update of /cvsroot/once/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6134 Modified Files: content.html Log Message: MDDU Index: content.html =================================================================== RCS file: /cvsroot/once/htdocs/content.html,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** content.html 19 May 2004 09:40:26 -0000 1.15 --- content.html 29 Jul 2004 01:19:46 -0000 1.16 *************** *** 15,18 **** --- 15,21 ---- <h2>News:</h2> <!-- Insert new News Items here: --> + <p class="news">Wednessday, July 15, 2004:0216GMT: Death is overrated<p> + Some claim Once has been dead, or going inactive, but thats just not true. There has been much progress over these last few summer months, but mostly in relation to programming. Thomi has to go offline for a few weeks, but if you are intrested in helping (and etc), talk to bear. As soon as I can find new artwork, it shall be posted. -ResQuad + <p class="news">Thursday, May 19, 2004:0920GMT: Website remake.</p> The website is being completely remade. The content will still be here, but several features will be improved. To name a few: |
From: Remi Bonnet <elscouta@us...> - 2004-07-28 16:56:32
|
Update of /cvsroot/once/oncecode/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14173/docs Modified Files: history.txt Log Message: Noticed that cvs -z3 commit -m docs/ src/ server_data/ is NOT a good cvs command ;) Look at history.txt for missing cvs commit messages. Index: history.txt =================================================================== RCS file: /cvsroot/once/oncecode/docs/history.txt,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** history.txt 26 Jul 2004 11:49:56 -0000 1.157 --- history.txt 28 Jul 2004 16:56:22 -0000 1.158 *************** *** 4,7 **** --- 4,14 ---- The history order is reversed so that new features are at the top. + 28-July-2004 + - Remi removed iTextureManager as asked on the Crystal Mailing List. + - Remi made a new step towards cel: + - Removed collision detection code (cel takes care of this). All entity + controlling code is now inside cel or in the behaviour. + - Re-added some common behaviour handling. + 26-July-2004 - Remi made a new step towards cel: |
From: Remi Bonnet <elscouta@us...> - 2004-07-28 16:51:59
|
Update of /cvsroot/once/oncecode/src/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13342/src/server Modified Files: ocareastate.cpp ocareastate.h ocbl.cpp ocbl.h ocentitystate.cpp ocentitystate.h ochdlplayeraction.cpp ochdlplayeraction.h ocplayerstate.cpp ocplayerstate.h ocserver.cpp Log Message: docs/ Index: ocareastate.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocareastate.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** ocareastate.cpp 26 Jul 2004 11:49:57 -0000 1.37 --- ocareastate.cpp 28 Jul 2004 16:51:49 -0000 1.38 *************** *** 185,353 **** return false; - csColliderHelper::InitializeCollisionWrappers(collide_system, engine); - serversys->GetVirtualClock()->Resume(); ! return true; ! } ! ! bool ocAreaState::RealTryToMove(ocEntity* entity, csVector3 delta) ! { ! if (delta.IsZero()) ! return true; ! ! /* Get info for the moving entity */ ! iCollider* entity_collider = entity->GetServerState()->GetCollider(); ! csReversibleTransform* entity_transform = entity->GetTransform(); ! ! /* List of meshes */ ! csRef<iMeshWrapperIterator> meshes; ! const float mesh_radius = entity->GetServerState()->GetRadius(); ! const float radius = 2 * delta.Norm() + mesh_radius; ! const float steps = delta.Norm() * 3.0 / mesh_radius; ! ! meshes = engine->GetNearbyMeshes(area->GetSector(), ! entity_transform->GetOrigin(), ! radius); ! ! size_t i = 0; ! iMeshWrapper* mesh; ! ! /* First, find the size of the list */ ! while (meshes->HasNext()) ! { ! mesh = meshes->Next(); ! if (mesh == entity->GetCSMesh()) ! continue; ! if (!csColliderWrapper::GetColliderWrapper(mesh->QueryObject())) ! continue; ! i++; ! } ! ! ! iCollider** colliders = (iCollider**) malloc(sizeof(iCollider*) * i); ! csReversibleTransform* transforms_store = ! (csReversibleTransform*) malloc(sizeof(csReversibleTransform) * i); ! csReversibleTransform** transforms = ! (csReversibleTransform**) malloc(sizeof(csReversibleTransform*) * i); ! ! /* Now, re-read the list, but store the info */ ! meshes->Reset(); ! ! i = 0; ! ! while (meshes->HasNext()) ! { ! mesh = meshes->Next(); ! ! if (mesh == entity->GetCSMesh()) ! continue; ! ! csColliderWrapper* wrap; ! wrap = csColliderWrapper::GetColliderWrapper(mesh->QueryObject()); ! if (!wrap) ! continue; ! colliders[i] = wrap->GetCollider(); ! transforms_store[i] = mesh->GetMovable()->GetFullTransform(); ! transforms[i] = transforms_store + i; ! #ifdef COLLIDE_DEBUG ! printf("Collider %d: at (%f, %f, %f)\n", i+1, transforms[i]->GetOrigin().x, ! transforms[i]->GetOrigin().y, transforms[i]->GetOrigin().z); ! #endif ! i++; ! } ! ! csVector3 newpos = entity->GetPosition() + delta; ! ! #ifdef COLLIDE_DEBUG ! printf("Colliding %s (%f, %f, %f) (%f) with %i colliders (numsteps %f).\n", ! entity->GetAppearance()->Get3DObjectName().GetData(), ! entity_transform->GetOrigin().x, ! entity_transform->GetOrigin().y, ! entity_transform->GetOrigin().z, ! mesh_radius, i, steps); ! ! printf("Wanting to move to (%f, %f, %f).\n", newpos.x, newpos.y, newpos.z); ! #endif ! ! /* Do the real collision detection */ ! int result = csColliderHelper::CollidePath(collide_system, entity_collider, ! entity_transform, steps, ! newpos, i, colliders, ! transforms); ! ! #ifdef COLLIDE_DEBUG ! printf("result: %d (%s)\n", result, result == 1 ? "success" : "failure"); ! printf("new position: (%f, %f, %f)\n\n", newpos.x, newpos.y, newpos.z); ! #endif ! ! if (result != -1) ! entity->SetPosition(newpos); ! ! free(colliders); ! free(transforms); ! ! return result == 1; ! } ! ! void ocAreaState::TryToMoveFree(ocEntity* entity, int elapsed_time) ! { ! csVector3 delta = entity->GetSpeed() * elapsed_time / 200; ! ! RealTryToMove(entity, delta); ! } ! ! void ocAreaState::TryToMove(ocEntity* entity, int elapsed_time, int _steep) ! { ! const float steep = ((float) _steep) / 1000.0; ! const float available_norm = Z_COLLISION_THRESHOLD / steep; ! ! csVector3 speed = entity->GetSpeed() * elapsed_time / 200; ! csVector3 total_speed(speed.x, 0, speed.z); ! const float horizontal_norm = total_speed.Norm(); ! total_speed.y = horizontal_norm * steep; ! ! const int ratio = (int) (horizontal_norm / available_norm) + 1; ! const csVector3 speed_part_1(total_speed / ratio); ! const csVector3 speed_part_2(0, speed.y - speed_part_1.y, 0); ! ! bool hit_floor = false; ! ! for (int i = 0; i < ratio; i++) ! { ! #ifdef COLLIDE_DEBUG2 ! { ! csVector3 pos = entity->GetPosition(); ! printf ("First step: (%f, %f, %f) ", pos.x, pos.y, pos.z); ! } ! #endif ! ! RealTryToMove(entity, speed_part_1); ! ! #ifdef COLLIDE_DEBUG2 ! { ! csVector3 pos = entity->GetPosition(); ! printf ("to (%f, %f, %f) with attempted (%f, %f, %f).\n", ! pos.x, pos.y, pos.z, ! speed_part_1.x, speed_part_1.y, speed_part_1.z); ! printf ("Second step: (%f, %f, %f) ", pos.x, pos.y, pos.z); ! } ! #endif ! ! if (!RealTryToMove(entity, speed_part_2)) ! hit_floor = true; ! ! #ifdef COLLIDE_DEBUG2 ! { ! csVector3 pos = entity->GetPosition(); ! printf ("to (%f, %f, %f) with attempted (%f, %f, %f).\n\n", ! pos.x, pos.y, pos.z, ! speed_part_2.x, speed_part_2.y, speed_part_2.z); ! } ! #endif ! } ! if (hit_floor) ! entity->GetServerState()->ResetVerticalSpeed(); } --- 185,193 ---- return false; serversys->GetVirtualClock()->Resume(); ! csColliderHelper::InitializeCollisionWrappers(collide_system, engine, 0); ! return true; } *************** *** 367,378 **** size_t i; ! ! ! /* Try to move all the entity in the world */ ! for (i = 0; i < entity_list.Length(); i++) ! { ! entity_list[i]->ApplyGravity(elapsed); ! TryToMove(entity_list[i]->GetEntity(), elapsed, 1000); ! } } --- 207,213 ---- size_t i; ! ! for (i = 0; i < entity_list.Length(); i++) ! entity_list[i]->SyncWithCelObject(); } Index: ochdlplayeraction.h =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ochdlplayeraction.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ochdlplayeraction.h 30 Jun 2004 12:08:08 -0000 1.5 --- ochdlplayeraction.h 28 Jul 2004 16:51:49 -0000 1.6 *************** *** 43,47 **** class ocHandleRequestRotate : public iPacketHandlerServer { public: ! virtual int GetMessageType() { return ocRequestRotateMsg::ocClassID; } virtual bool HandleMessage(iSerial* msg, ocPlayerState* player); --- 43,47 ---- class ocHandleRequestRotate : public iPacketHandlerServer { public: ! virtual int GetMessageType() { return ocRequestRotateMsg::ocClassID; } virtual bool HandleMessage(iSerial* msg, ocPlayerState* player); Index: ocbl.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocbl.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ocbl.cpp 26 Jul 2004 11:49:57 -0000 1.1 --- ocbl.cpp 28 Jul 2004 16:51:49 -0000 1.2 *************** *** 27,30 **** --- 27,31 ---- #include "common/ocidentifier.h" #include "common/ocfactory.h" + #include "common/ocblcommon.h" #include "server/behaviours/ocarea_bl.h" *************** *** 33,73 **** - /******************************* ocBehaviourBase *****************************/ - SCF_IMPLEMENT_IBASE(ocBehaviourBase) - SCF_IMPLEMENTS_INTERFACE(iCelBehaviour) - SCF_IMPLEMENT_IBASE_END - - ocBehaviourBase::ocBehaviourBase(ocBehaviourLayer* _bl) - { - bl = _bl; - pl = _bl->GetPhysicalLayer(); - SCF_CONSTRUCT_IBASE(0); - } - - ocBehaviourBase::~ocBehaviourBase() - { - SCF_DESTRUCT_IBASE(); - } - - bool ocBehaviourBase::SendMessage(const char* msg, celData& ret, - iCelParameterBlock* params, ...) - { - va_list arg; - va_start(arg, params); - bool res = SendMessageV(msg, ret, params, arg); - va_end(arg); - return res; - } - - bool ocBehaviourBase::SendMessageV(const char* msg, celData& ret, - iCelParameterBlock* params, va_list args) - { - csStringID msg_id = pl->FetchStringID(msg); - return SendMessageID(msg_id, ret, params, args); - } - - - - /*************************** ocBehaviourLayer ********************************/ SCF_IMPLEMENT_IBASE(ocBehaviourLayer) --- 34,37 ---- *************** *** 99,103 **** const char* name) { ! ocBehaviourBase* behaviour = factory.CreateInstance(name, this); CS_ASSERT(behaviour); --- 63,67 ---- const char* name) { ! ocBehaviourBase* behaviour = factory.CreateInstance(name, entity, this); CS_ASSERT(behaviour); Index: ocbl.h =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocbl.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ocbl.h 26 Jul 2004 11:49:57 -0000 1.1 --- ocbl.h 28 Jul 2004 16:51:49 -0000 1.2 *************** *** 21,24 **** --- 21,25 ---- struct iCelPlLayer; + struct iCelEntity; class ocBehaviourLayer; class ocBehaviourBase; *************** *** 28,33 **** #include "common/ocfactory.h" ! class ocBehaviourLayer : public iCelBlLayer { private: --- 29,35 ---- #include "common/ocfactory.h" + #include "common/ocblcommon.h" ! class ocBehaviourLayer : public iBehaviourLayer { private: *************** *** 53,57 **** /** Returns physical layer */ ! iCelPlLayer* GetPhysicalLayer() { return pl; } /** Create a behaviour class according to the name. */ --- 55,59 ---- /** Returns physical layer */ ! virtual iCelPlLayer* GetPhysicalLayer() const { return pl; } /** Create a behaviour class according to the name. */ *************** *** 59,93 **** }; - class ocBehaviourBase : public iCelBehaviour - { - private: - ocBehaviourLayer* bl; - iCelPlLayer* pl; - - public: - /** Contructor */ - ocBehaviourBase(ocBehaviourLayer* layer); - /** Destructor */ - virtual ~ocBehaviourBase(); - - /** Declare iBase */ - SCF_DECLARE_IBASE; - - /** Returns the behaviour layer */ - virtual iCelBlLayer* GetBehaviourLayer() const { return bl; } - /** Used when the entity receives a message. Wrapper of SendMessageV */ - virtual bool SendMessage(const char* msg, celData& ret, - iCelParameterBlock* params, ...); - /** Used when the entity received a message. Wrapper of - * SendMessageID that subclasses must define. */ - virtual bool SendMessageV(const char* msg, celData& ret, - iCelParameterBlock* params, va_list args); - /** Sub classes must define this. All messages will come through this - * function */ - virtual bool SendMessageID(csStringID msg_id, celData& ret, - iCelParameterBlock* params, va_list args) = 0; - /** Returns ... something. No idea of what this function should do */ - virtual void* GetInternalObject() { return 0; } - }; - #endif --- 61,63 ---- Index: ocareastate.h =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocareastate.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ocareastate.h 26 Jul 2004 11:49:57 -0000 1.25 --- ocareastate.h 28 Jul 2004 16:51:49 -0000 1.26 *************** *** 42,49 **** class ocAreaState : public iSerial { private: - /// A link to the iCollideSystem and iEngine plugin csRef<iCollideSystem> collide_system; csRef<iEngine> engine; ! /// the area this state belongs to ocArea* area; --- 42,48 ---- class ocAreaState : public iSerial { private: csRef<iCollideSystem> collide_system; csRef<iEngine> engine; ! /// the area this state belongs to ocArea* area; *************** *** 60,68 **** csSchedule *player_schedule; - private: - /** This function performs the real collision detection/move. - * Return true if the move succeed, false if something was hit. */ - bool RealTryToMove(ocEntity* entity, csVector3 delta); - public: static int ocClassID; --- 59,62 ---- *************** *** 91,128 **** bool LoadMap(); - /** This function perform a normal collision detection. - * Wrapper of RealTryToMove */ - void TryToMoveFree(ocEntity* entity, int elapsed_ticks); - /** Returns the starting position for this area and race. */ csVector3 GetStartingPosition(ocRaceSettings* race); - /** See below */ - #define Z_COLLISION_THRESHOLD 0.2 - - /** Try to move the entity according to its speed vector. Collision detection - * is performed. If the entity hit another entity, the speed vector is - * set to 0. Collision detection will be done in two steps. - * First, the entity will be moved horizontally with a small steep to allow - * for example a player to climb stairs. (collision sets horizontal speed to - * 0) - * Then, the gravity will be applied to translate the entity on the floor. - * (collision sets vertical speed to 0) - * - * If the z offset during the first step exceed Z_COLLISION_THRESHOLD, the - * collision detection will be done more than once to avoid the entity - * colliding with the roof. - * - * If the entity should not be affected by stairs or others steep (for - * example an arrow or like), use TryToMoveFree above. - * - * Parameters: - * - elapsed_time: number of ticks elapsed since last move - * - steep: steep used during the first step: - * speed.z = norm(speed) * steep / 1000 - * - * This function calls RealTryToMove to do the collision detection. */ - void TryToMove(ocEntity* entity, int elapsed_time, int steep); - /// simulate elapsed time in msec (ticks). void Simulate(int elapsed); --- 85,91 ---- Index: ocentitystate.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocentitystate.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ocentitystate.cpp 26 Jul 2004 11:49:57 -0000 1.14 --- ocentitystate.cpp 28 Jul 2004 16:51:49 -0000 1.15 *************** *** 25,28 **** --- 25,31 ---- #include "iengine/engine.h" + #include "physicallayer/propclas.h" + #include "propclass/linmove.h" + #include "common/ocarea.h" #include "common/ocentity.h" *************** *** 43,47 **** scriptstore = new ocScriptStore(); - gravity = 1; type = ENTITY_TYPE_STATIC; } --- 46,49 ---- *************** *** 57,61 **** scriptstore = new ocScriptStore(); scriptstore->SetupFor(entity->GetID(), entity->GetCurrentArea()); - gravity = 1; type = ENTITY_TYPE_STATIC; } --- 59,62 ---- *************** *** 101,118 **** } - void ocEntityState::ApplyGravity(int elapsed_time) - { - csVector3 speed = entity->GetSpeed(); - - speed.y -= (gravity * (float) elapsed_time) / 1000.0; - - entity->SetSpeed(speed); - } - - void ocEntityState::SetHorizontalSpeed(csVector3 vect) - { - entity->SetSpeed(csVector3(vect.x, entity->GetSpeed().y, vect.z)); - } - bool ocEntityState::UpdateMesh() { --- 102,105 ---- *************** *** 125,156 **** } - csRef<iCollideSystem> colsys; - colsys = entity->GetCurrentArea()->GetServerState()->GetCollideSystem(); - - iMeshWrapper* mesh = entity->GetCSMesh(); - csColliderHelper::InitializeCollisionWrapper(colsys, mesh); - return true; } ! csRef<iCollider> ocEntityState::GetCollider() { ! csColliderWrapper* wrap; ! iObject* object = entity->GetCSMesh()->QueryObject(); ! wrap = csColliderWrapper::GetColliderWrapper(object); ! ! CS_ASSERT(wrap); ! return wrap->GetCollider(); ! } ! float ocEntityState::GetRadius() ! { ! iMeshWrapper* wrap = entity->GetCSMesh(); ! CS_ASSERT(wrap); ! csVector3 rad, cent; ! wrap->GetRadius(rad, cent); ! return rad.Norm(); } --- 112,139 ---- } return true; } ! void ocEntityState::SyncWithCelObject() { ! csRef<iPcLinearMovement> linmove; ! linmove = CEL_QUERY_PROPCLASS_ENT(entity->celobject, iPcLinearMovement); ! float speed, dummy_speed; ! csVector3 velocity; ! iSector* dummy_sector; ! linmove->GetDRData(entity->on_ground, ! speed, ! entity->position, ! entity->y_rotation, ! dummy_sector, ! velocity, ! dummy_speed); ! printf("New DR data: (%03f, %03f, %03f) - %f\n", entity->position.x, ! entity->position.y, entity->position.z, entity->y_rotation); ! ! entity->Changed(); } Index: ocplayerstate.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocplayerstate.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ocplayerstate.cpp 26 Jul 2004 11:49:57 -0000 1.28 --- ocplayerstate.cpp 28 Jul 2004 16:51:49 -0000 1.29 *************** *** 28,31 **** --- 28,33 ---- #include "iengine/camera.h" + #include "celtool/stdparams.h" + #include "common/ocplayer.h" #include "common/ocarea.h" *************** *** 60,66 **** player->SetServerState(this); player->GetID().SetPtr(player); - - move_type = PLAYER_ACTION_MOVE_NONE; - move_timeout = 0; } --- 62,65 ---- *************** *** 116,170 **** } - void ocPlayerState::UpdateHorizontalSpeed() - { - ocID<ocEntity> avatar = player->GetAvatar(); - ocEntityState* state = avatar->GetServerState(); - - if (move_type != PLAYER_ACTION_MOVE_NONE) { - const float speed = 1; - float y_rot = avatar->GetYRotation(); - - csVector3 delta; - csQuaternion q; - - q.PrepRotation(y_rot, CS_VEC_UP); - - if (move_type == PLAYER_ACTION_MOVE_FORWARDS) { - delta = q.Rotate(CS_VEC_FORWARD * speed); - } else { - CS_ASSERT(move_type == PLAYER_ACTION_MOVE_BACKWARD); - delta = q.Rotate(CS_VEC_BACKWARD * speed); - } - - state->SetHorizontalSpeed(delta); - } else { - state->SetHorizontalSpeed(csVector3(0, 0, 0)); - } - } - - void ocPlayerState::SetMoveType(enum player_move_type action) - { - CS_ASSERT(action == PLAYER_ACTION_MOVE_FORWARDS || - action == PLAYER_ACTION_MOVE_BACKWARD || - action == PLAYER_ACTION_MOVE_NONE); - bool different = move_type != action; - move_type = action; - move_timeout = 0; - - if (different) - UpdateHorizontalSpeed(); - } - - enum player_move_type ocPlayerState::GetMoveType(int elapsed_ticks) - { - if (move_timeout > 2 * PLAYER_REQUEST_MOVE_VALIDITY) { - SetMoveType(PLAYER_ACTION_MOVE_NONE); - } - - move_timeout += elapsed_ticks; - - return move_type; - } - /// quick class to store data for callback routines. class ocPlayerUpdateData { --- 115,118 ---- *************** *** 233,234 **** --- 181,186 ---- } + iCelBehaviour* ocPlayerState::GetBehaviour() + { + return GetPlayer()->GetAvatar()->GetCelObject()->GetBehaviour(); + } Index: ochdlplayeraction.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ochdlplayeraction.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ochdlplayeraction.cpp 24 Jul 2004 11:29:11 -0000 1.8 --- ochdlplayeraction.cpp 28 Jul 2004 16:51:49 -0000 1.9 *************** *** 25,28 **** --- 25,30 ---- #include "ocserver.h" + #include "celtool/stdparams.h" + #include "ochdlplayeraction.h" *************** *** 30,34 **** bool ocHandleRequestMove::HandleMessage(iSerial* msg, ocPlayerState* player) { ! player->SetMoveType(((ocRequestMoveMsg*) msg)->action); return true; --- 32,51 ---- bool ocHandleRequestMove::HandleMessage(iSerial* msg, ocPlayerState* player) { ! iCelBehaviour* behave = player->GetBehaviour(); ! enum player_move_type type = (((ocRequestMoveMsg*) msg)->action); ! celData ret; ! ! switch (type) ! { ! case PLAYER_ACTION_MOVE_FORWARDS: ! behave->SendMessage("network.move.forward", ret, 0); ! break; ! case PLAYER_ACTION_MOVE_BACKWARD: ! behave->SendMessage("network.move.backward", ret, 0); ! break; ! case PLAYER_ACTION_MOVE_NONE: ! behave->SendMessage("network.move.none", ret, 0); ! break; ! } return true; *************** *** 41,46 **** { ocRequestRotateMsg* msg = (ocRequestRotateMsg*) ser_msg; ! player->GetPlayer()->GetAvatar()->SetYRotation(msg->angle); ! player->UpdateHorizontalSpeed(); return true; --- 58,67 ---- { ocRequestRotateMsg* msg = (ocRequestRotateMsg*) ser_msg; ! iCelBehaviour* behave = player->GetBehaviour(); ! celOneParameterBlock params; ! celData ret; ! params.GetParameter(0).Set(msg->angle); ! ! behave->SendMessage("network.rotate", ret, ¶ms); return true; Index: ocserver.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocserver.cpp,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** ocserver.cpp 26 Jul 2004 11:49:57 -0000 1.57 --- ocserver.cpp 28 Jul 2004 16:51:49 -0000 1.58 *************** *** 175,180 **** conin->SetExecuteCallback(concallback); conin->SetPrompt("# "); - iTextureManager* txtmgr = g3d->GetTextureManager (); - txtmgr->PrepareTextures (); // load chat filter --- 175,178 ---- Index: ocplayerstate.h =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocplayerstate.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ocplayerstate.h 26 Jul 2004 11:49:57 -0000 1.20 --- ocplayerstate.h 28 Jul 2004 16:51:49 -0000 1.21 *************** *** 30,33 **** --- 30,34 ---- #include "common/ocplayeractionmsg.h" + struct iCelBehaviour; class ocWorld; class ocServer; *************** *** 62,71 **** ocNetworkConnection* netlink; - /// Move type - enum player_move_type move_type; - /// Timeout of move_type: if no new packet is received in a laps of time - /// equal to 2 * PLAYER_REQUEST_MOVE_VALIDITY, move is stopped - int move_timeout; - /// send subscription start to player static void SendPlayerStart(iocSubscribable *able, void* _data); --- 63,66 ---- *************** *** 91,103 **** void Update(int elapsed_time); - /// Update speed of player, depending of move_type and rotation - void UpdateHorizontalSpeed(); - - /// Change move type - void SetMoveType(enum player_move_type type); - /// Get move type. Call this function only once for each frame because - /// it take care of the timeout - enum player_move_type GetMoveType(int elapsed_ticks); - /** Initialize completely the player, including creation of the avatar and * adding the pointer to the world list. --- 86,89 ---- *************** *** 113,116 **** --- 99,105 ---- /** Return the common class */ ocPlayer* GetPlayer() { return player; } + + /** Returns the behaviour of the player. */ + iCelBehaviour* GetBehaviour(); }; Index: ocentitystate.h =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocentitystate.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ocentitystate.h 26 Jul 2004 11:49:57 -0000 1.13 --- ocentitystate.h 28 Jul 2004 16:51:49 -0000 1.14 *************** *** 59,65 **** ocScriptStore* scriptstore; - /// Gravity that the entity receives - float gravity; - public: static int ocClassID; --- 59,62 ---- *************** *** 74,95 **** virtual ~ocEntityState(); - /** Return the collider for this entity. - * 0 if no collider */ - csRef<iCollider> GetCollider(); - - /// Get the radius of this entity. @@@@ Inefficient function provided for - /// compatibility. Must be removed - float GetRadius(); - - /** Set the horizontal speed of the entity, without changing its vertical - * speed */ - void SetHorizontalSpeed(csVector3 vect); - - /** When floor is hit, we reset vertical speed. */ - void ResetVerticalSpeed() { entity->speed.y = 0; } - - /** Modify the speed vector according to elapsed_time. */ - void ApplyGravity(int elapsed_time); - /** Perform all the initialization routines. Must be called when the * different fields of the entity. --- 71,74 ---- *************** *** 100,103 **** --- 79,85 ---- bool UpdateMesh(); + /** Sync with the CEL object (HACK) */ + void SyncWithCelObject(); + /** This functions must be used instead of the entity one on server side */ void SetObjectName(csString name); |
Update of /cvsroot/once/oncecode/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13342/src/common Modified Files: ocapplication.cpp ocarea.h ocentity.cpp ocentity.h ocfactory.cpp ocfactory.h ocloader.cpp Added Files: ocblcommon.cpp ocblcommon.h Log Message: docs/ Index: ocentity.h =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocentity.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ocentity.h 26 Jul 2004 11:49:56 -0000 1.26 --- ocentity.h 28 Jul 2004 16:51:49 -0000 1.27 *************** *** 79,82 **** --- 79,84 ---- /// is the entity visible in the world bool visible_in_world; + /// Is the entity on the ground? + bool on_ground; /// changenumber for move/position only --- NEW FILE: ocblcommon.cpp --- /* * ocbl.cpp * Copyright (C) 2003-2004 by The Once developement team * * 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 "config.h" #include "iutil/strset.h" #include "physicallayer/pl.h" #include "physicallayer/propclas.h" #include "behaviourlayer/bl.h" #include "propclass/linmove.h" #include "common/ocblcommon.h" /******************************* ocBehaviourBase *****************************/ SCF_IMPLEMENT_IBASE(ocBehaviourBase) SCF_IMPLEMENTS_INTERFACE(iCelBehaviour) SCF_IMPLEMENT_IBASE_END ocBehaviourBase::ocBehaviourBase(iBehaviourLayer* _bl, iCelEntity* _entity) : entity(_entity), bl(_bl) { pl = bl->GetPhysicalLayer(); SCF_CONSTRUCT_IBASE(0); } ocBehaviourBase::~ocBehaviourBase() { SCF_DESTRUCT_IBASE(); } void ocBehaviourBase::SetCelYRotation(iPcLinearMovement* pclinmove, float y) { csVector3 position; iSector* sector; float dummy; pclinmove->GetLastPosition(position, dummy, sector); pclinmove->SetPosition(position, y, sector); } bool ocBehaviourBase::SendMessage(const char* msg, celData& ret, iCelParameterBlock* params, ...) { va_list arg; va_start(arg, params); bool res = SendMessageV(msg, ret, params, arg); va_end(arg); return res; } bool ocBehaviourBase::SendMessageV(const char* msg, celData& ret, iCelParameterBlock* params, va_list args) { csStringID msg_id = pl->FetchStringID(msg); return SendMessageID(msg_id, ret, params, args); } Index: ocarea.h =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocarea.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ocarea.h 25 Jul 2004 16:37:26 -0000 1.12 --- ocarea.h 28 Jul 2004 16:51:49 -0000 1.13 *************** *** 95,99 **** /// Get the cel sector of this area iSector* GetSector(); - /// get identifier for area --- 95,98 ---- Index: ocfactory.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocfactory.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ocfactory.cpp 26 Jul 2004 11:49:56 -0000 1.4 --- ocfactory.cpp 28 Jul 2004 16:51:49 -0000 1.5 *************** *** 30,33 **** --- 30,34 ---- ocBehaviourBase* ocBehaviourFactory::CreateInstance(const char* classname, + iCelEntity* entity, ocBehaviourLayer* layer) { *************** *** 36,39 **** if (!factory) return 0; ! return factory(layer); } --- 37,40 ---- if (!factory) return 0; ! return factory(layer, entity); } Index: ocfactory.h =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocfactory.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ocfactory.h 25 Jul 2004 16:37:26 -0000 1.2 --- ocfactory.h 28 Jul 2004 16:51:49 -0000 1.3 *************** *** 25,28 **** --- 25,30 ---- #include "common/ocidentifier.h" + struct iCelEntity; + struct iCelPlLayer; class ocBehaviourBase; class ocBehaviourLayer; *************** *** 64,68 **** { private: ! typedef ocBehaviourBase* (*CreateFunc) (ocBehaviourLayer*); csHash<CreateFunc, const char*, csConstCharHashKeyHandler> hash; --- 66,70 ---- { private: ! typedef ocBehaviourBase* (*CreateFunc) (ocBehaviourLayer*, iCelEntity*); csHash<CreateFunc, const char*, csConstCharHashKeyHandler> hash; *************** *** 76,80 **** } /** Create an instance of the class */ ! ocBehaviourBase* CreateInstance(const char* name, ocBehaviourLayer* layer); }; --- 78,83 ---- } /** Create an instance of the class */ ! ocBehaviourBase* CreateInstance(const char* name, iCelEntity* entity, ! ocBehaviourLayer* layer); }; Index: ocapplication.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocapplication.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ocapplication.cpp 26 Jul 2004 11:49:56 -0000 1.3 --- ocapplication.cpp 28 Jul 2004 16:51:49 -0000 1.4 *************** *** 142,145 **** --- 142,147 ---- OC_QUERY_FOR_PROPCLASS("solid"); OC_QUERY_FOR_PROPCLASS("linmove"); + OC_QUERY_FOR_PROPCLASS("colldet"); + OC_QUERY_FOR_PROPCLASS("solid"); // Load our mounts path Index: ocentity.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocentity.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ocentity.cpp 26 Jul 2004 11:49:56 -0000 1.16 --- ocentity.cpp 28 Jul 2004 16:51:49 -0000 1.17 *************** *** 116,119 **** --- 116,120 ---- buf.WriteFloat(position.y); buf.WriteFloat(position.z); + buf.WriteBool(on_ground); } *************** *** 167,170 **** --- 168,172 ---- if (!buf.ReadFloat(position.z)) return false; transform.SetOrigin(position); + if (!buf.ReadBool(on_ground)) return false; } --- NEW FILE: ocblcommon.h --- /* * ocblcommon.h * Copyright (C) 2003-2004 by The Once developement team * * 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 */ #ifndef OCBLCOMMON_H #define OCBLCOMMON_H struct iCelBlLayer; struct iCelPlLayer; struct iCelEntity; struct iPcLinearMovement; #include "behaviourlayer/behave.h" #include "behaviourlayer/bl.h" /** * An improved interface for use in Once. */ struct iBehaviourLayer : public iCelBlLayer { /** Returns the physical layer. */ virtual iCelPlLayer* GetPhysicalLayer() const = 0; }; /** * All Once behaviours will inherit from this class. It provides some shared * facilities. */ class ocBehaviourBase : public iCelBehaviour { protected: /** A link to the behaviour layer. */ iBehaviourLayer* bl; /** A link to the physical layer. */ iCelPlLayer* pl; /** A link to the cel entity (to fetch properties classes) */ iCelEntity* entity; protected: /** Helper function to set the y rotation of the object (hack, will be * removed once cel interface is changed. */ void SetCelYRotation(iPcLinearMovement* linmove, float y); public: /** Contructor */ ocBehaviourBase(iBehaviourLayer* layer, iCelEntity* entity); /** Destructor */ virtual ~ocBehaviourBase(); /** Declare iBase */ SCF_DECLARE_IBASE; /** Returns the behaviour layer */ virtual iCelBlLayer* GetBehaviourLayer() const { return bl; } /** Used when the entity receives a message. Wrapper of SendMessageV */ virtual bool SendMessage(const char* msg, celData& ret, iCelParameterBlock* params, ...); /** Used when the entity received a message. Wrapper of * SendMessageID that subclasses must define. */ virtual bool SendMessageV(const char* msg, celData& ret, iCelParameterBlock* params, va_list args); /** Sub classes must define this. All messages will come through this * function */ virtual bool SendMessageID(csStringID msg_id, celData& ret, iCelParameterBlock* params, va_list args) = 0; /** Returns ... something. No idea of what this function should do */ virtual void* GetInternalObject() { return 0; } }; #endif Index: ocloader.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocloader.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ocloader.cpp 26 Jul 2004 11:49:56 -0000 1.14 --- ocloader.cpp 28 Jul 2004 16:51:49 -0000 1.15 *************** *** 30,34 **** --- 30,37 ---- #include "physicallayer/pl.h" #include "physicallayer/propclas.h" + #include "physicallayer/entity.h" #include "propclass/region.h" + #include "behaviourlayer/behave.h" + #include "celtool/stdparams.h" #include "common/ocapplication.h" *************** *** 167,172 **** --- 170,188 ---- } + celData ret; + celentity->GetBehaviour()->SendMessage("behaviour.init", ret, 0); + + celGenericParameterBlock params(3); + params.SetParameterDef(0, 0, "position"); + params.GetParameter(0).Set(entity->GetPosition()); + params.SetParameterDef(1, 1, "y_rotation"); + params.GetParameter(1).Set(entity->GetYRotation()); + params.SetParameterDef(2, 2, "sector"); + params.GetParameter(2).SetIBase(entity->GetCurrentArea()->GetSector()); + celentity->GetBehaviour()->SendMessage("entity.set.position", ret, ¶ms); + entity->SetCelObject(celentity); + return true; } |
From: Remi Bonnet <elscouta@us...> - 2004-07-28 16:51:58
|
Update of /cvsroot/once/oncecode/src/server/behaviours In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13342/src/server/behaviours Modified Files: ocarea_bl.cpp ocarea_bl.h ocplayer_bl.cpp ocplayer_bl.h Log Message: docs/ Index: ocplayer_bl.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/server/behaviours/ocplayer_bl.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ocplayer_bl.cpp 26 Jul 2004 11:49:57 -0000 1.1 --- ocplayer_bl.cpp 28 Jul 2004 16:51:49 -0000 1.2 *************** *** 19,38 **** #include "config.h" #include "physicallayer/pl.h" #include "server/behaviours/ocplayer_bl.h" const char* ocPlayerBehaviour::ocClassName = "ocPlayerBehaviour"; ! csStringID ocPlayerBehaviour::id_pckeyinput_forward_on; ! csStringID ocPlayerBehaviour::id_pckeyinput_forward_off; ! csStringID ocPlayerBehaviour::id_pckeyinput_backward_on; ! csStringID ocPlayerBehaviour::id_pckeyinput_backward_off; ! csStringID ocPlayerBehaviour::id_pckeyinput_rotate_left_on; ! csStringID ocPlayerBehaviour::id_pckeyinput_rotate_left_off; ! csStringID ocPlayerBehaviour::id_pckeyinput_rotate_right_on; ! csStringID ocPlayerBehaviour::id_pckeyinput_rotate_right_off; ! ocPlayerBehaviour::ocPlayerBehaviour(ocBehaviourLayer* bl) : ! ocBehaviourBase(bl) { } --- 19,44 ---- #include "config.h" + #include "ivaria/reporter.h" + + #include "physicallayer/datatype.h" + #include "physicallayer/entity.h" #include "physicallayer/pl.h" + #include "physicallayer/propclas.h" + #include "propclass/linmove.h" + #include "celtool/stdparams.h" #include "server/behaviours/ocplayer_bl.h" + #include "server/ocserver.h" const char* ocPlayerBehaviour::ocClassName = "ocPlayerBehaviour"; ! csStringID ocPlayerBehaviour::id_network_move_forward; ! csStringID ocPlayerBehaviour::id_network_move_backward; ! csStringID ocPlayerBehaviour::id_network_move_none; ! csStringID ocPlayerBehaviour::id_network_rotate; ! csStringID ocPlayerBehaviour::id_behaviour_init; ! csStringID ocPlayerBehaviour::id_entity_set_position; ! ocPlayerBehaviour::ocPlayerBehaviour(ocBehaviourLayer* bl, iCelEntity* ent) : ! ocBehaviourBase(bl, ent) { } *************** *** 42,57 **** } ! void ocPlayerBehaviour::RegisterStringIDs(iCelPlLayer* pl) { ! /* C macros are pure fun ^_^ */ ! #define FETCH_ID(id) \ ! id_pckeyinput_##id##_on = pl->FetchStringID ("pckeyinput_" #id "1"); \ ! id_pckeyinput_##id##_off = pl->FetchStringID ("pckeyinput_" #id "0"); ! FETCH_ID(forward); ! FETCH_ID(backward); ! FETCH_ID(rotate_left); ! FETCH_ID(rotate_right); ! #undef FETCH_ID } --- 48,71 ---- } ! bool ocPlayerBehaviour::Initialize() { ! pclinmove = CEL_QUERY_PROPCLASS_ENT(entity, iPcLinearMovement); ! if (!pclinmove) { ! serversys->Report (CS_REPORTER_SEVERITY_ERROR, "Entity doesn't have " ! "iPcLinearMovement interface"); ! return false; ! } ! return true; ! } ! ! void ocPlayerBehaviour::RegisterStringIDs(iCelPlLayer* pl) ! { ! id_behaviour_init = pl->FetchStringID("behaviour.init"); ! id_entity_set_position = pl->FetchStringID("entity.set.position"); ! id_network_move_forward = pl->FetchStringID("network.move.forward"); ! id_network_move_backward = pl->FetchStringID("network.move.backward"); ! id_network_move_none = pl->FetchStringID("network.move.none"); ! id_network_rotate = pl->FetchStringID("network.rotate"); } *************** *** 59,62 **** iCelParameterBlock* params, va_list args) { ! return false; } --- 73,117 ---- iCelParameterBlock* params, va_list args) { ! if (msg_id == id_behaviour_init) ! { ! return Initialize(); ! } ! else if (msg_id == id_entity_set_position) ! { ! CEL_FETCH_VECTOR3_VAR(pos, params, 0); ! float y_rot = params->GetParameter(1)->value.f; ! iSector* sector = (iSector*) params->GetParameter(2)->value.ibase; ! pclinmove->SetPosition(pos, y_rot, sector); ! return true; ! } ! if (msg_id == id_network_move_forward) ! { ! pclinmove->SetVelocity(csVector3(0, 0, 1)); ! return true; ! } ! else if (msg_id == id_network_move_backward) ! { ! pclinmove->SetVelocity(csVector3(0, 0, -1)); ! return true; ! } ! else if (msg_id == id_network_move_none) ! { ! pclinmove->SetVelocity(csVector3(0, 0, 0)); ! return true; ! } ! else if (msg_id == id_network_rotate) ! { ! CS_ASSERT(params->GetParameterCount() == 0); ! const celData* data = params->GetParameter(0); ! CS_ASSERT(data->type == CEL_DATA_FLOAT); ! SetCelYRotation(pclinmove, data->value.f); ! return true; ! } ! else ! { ! serversys->Report(CS_REPORTER_SEVERITY_ERROR, "Unknown message in " ! "ocPlayerBehaviour"); ! CS_ASSERT(0); ! return false; ! } } Index: ocplayer_bl.h =================================================================== RCS file: /cvsroot/once/oncecode/src/server/behaviours/ocplayer_bl.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ocplayer_bl.h 26 Jul 2004 11:49:57 -0000 1.1 --- ocplayer_bl.h 28 Jul 2004 16:51:49 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- #define OCBL_PLAYER_H + struct iCelEntity; + struct iPcLinearMovement; + #include "server/ocbl.h" *************** *** 26,41 **** private: /** All the IDs */ ! static csStringID id_pckeyinput_forward_on; ! static csStringID id_pckeyinput_forward_off; ! static csStringID id_pckeyinput_backward_on; ! static csStringID id_pckeyinput_backward_off; ! static csStringID id_pckeyinput_rotate_left_on; ! static csStringID id_pckeyinput_rotate_left_off; ! static csStringID id_pckeyinput_rotate_right_on; ! static csStringID id_pckeyinput_rotate_right_off; public: /** Constructor. Do nothing */ ! ocPlayerBehaviour(ocBehaviourLayer* bl); /** Destructor. Do nothing */ virtual ~ocPlayerBehaviour(); --- 29,49 ---- private: /** All the IDs */ ! static csStringID id_network_move_forward; ! static csStringID id_network_move_backward; ! static csStringID id_network_move_none; ! static csStringID id_network_rotate; ! static csStringID id_behaviour_init; ! static csStringID id_entity_set_position; ! ! /** Properties classes. */ ! csRef<iPcLinearMovement> pclinmove; ! ! private: ! /** Initialize. Fetch properties classes. */ ! bool Initialize(); public: /** Constructor. Do nothing */ ! ocPlayerBehaviour(ocBehaviourLayer* bl, iCelEntity* e); /** Destructor. Do nothing */ virtual ~ocPlayerBehaviour(); *************** *** 44,49 **** static const char* ocClassName; /** A factory func. Used by behaviour factory. */ ! static ocBehaviourBase* ocCreateInstance(ocBehaviourLayer* bl) ! { return new ocPlayerBehaviour(bl); } /** Register all the string IDs. This function must be called once, before * any object is created. */ --- 52,57 ---- static const char* ocClassName; /** A factory func. Used by behaviour factory. */ ! static ocBehaviourBase* ocCreateInstance(ocBehaviourLayer* bl, iCelEntity* e) ! { return new ocPlayerBehaviour(bl, e); } /** Register all the string IDs. This function must be called once, before * any object is created. */ Index: ocarea_bl.h =================================================================== RCS file: /cvsroot/once/oncecode/src/server/behaviours/ocarea_bl.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ocarea_bl.h 26 Jul 2004 11:49:57 -0000 1.1 --- ocarea_bl.h 28 Jul 2004 16:51:49 -0000 1.2 *************** *** 22,30 **** #include "server/ocbl.h" class ocAreaBehaviour : public ocBehaviourBase { public: /** Constructor */ ! ocAreaBehaviour(ocBehaviourLayer* bl); /** Destructor */ ~ocAreaBehaviour(); --- 22,32 ---- #include "server/ocbl.h" + struct iCelEntity; + class ocAreaBehaviour : public ocBehaviourBase { public: /** Constructor */ ! ocAreaBehaviour(ocBehaviourLayer* bl, iCelEntity* ent); /** Destructor */ ~ocAreaBehaviour(); *************** *** 33,38 **** static const char* ocClassName; /** A factory func. Used by behaviour factory. */ ! static ocBehaviourBase* ocCreateInstance(ocBehaviourLayer* bl) ! { return new ocAreaBehaviour(bl); } /** Receives messages. */ --- 35,40 ---- static const char* ocClassName; /** A factory func. Used by behaviour factory. */ ! static ocBehaviourBase* ocCreateInstance(ocBehaviourLayer* bl, iCelEntity* e) ! { return new ocAreaBehaviour(bl, e); } /** Receives messages. */ Index: ocarea_bl.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/server/behaviours/ocarea_bl.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ocarea_bl.cpp 26 Jul 2004 11:49:57 -0000 1.1 --- ocarea_bl.cpp 28 Jul 2004 16:51:49 -0000 1.2 *************** *** 25,30 **** const char* ocAreaBehaviour::ocClassName = "ocAreaBehaviour"; ! ocAreaBehaviour::ocAreaBehaviour(ocBehaviourLayer* bl) : ! ocBehaviourBase(bl) { } --- 25,30 ---- const char* ocAreaBehaviour::ocClassName = "ocAreaBehaviour"; ! ocAreaBehaviour::ocAreaBehaviour(ocBehaviourLayer* bl, iCelEntity* ent) : ! ocBehaviourBase(bl, ent) { } |
From: Remi Bonnet <elscouta@us...> - 2004-07-28 16:51:57
|
Update of /cvsroot/once/oncecode/server_data/entities In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13342/server_data/entities Modified Files: dwarf.xml Log Message: docs/ Index: dwarf.xml =================================================================== RCS file: /cvsroot/once/oncecode/server_data/entities/dwarf.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dwarf.xml 26 Jul 2004 11:49:58 -0000 1.1 --- dwarf.xml 28 Jul 2004 16:51:48 -0000 1.2 *************** *** 13,15 **** --- 13,27 ---- </propclass> + <propclass name="pclinearmovement"> + <action name="InitCD"> + <!-- Size of the body for the purpose of collision detection (usually a + bit bigger then the model itself). --> + <par name="body" vector="0.5,0.8,0.5" /> + <!-- Size of the legs for the purpose of collision detection. --> + <par name="legs" vector="0.5,0.4,0.5" /> + <!-- Offset for the model boxes --> + <par name="offset" vector="0,-1,0" /> + </action> + </propclass> + </entity> |
From: Remi Bonnet <elscouta@us...> - 2004-07-28 16:51:57
|
Update of /cvsroot/once/oncecode/src/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13342/src/client Modified Files: ocbl.cpp ocbl.h occlient.cpp occltbehave.cpp occltbehave.h Log Message: docs/ Index: occltbehave.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/client/occltbehave.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** occltbehave.cpp 26 Jul 2004 11:49:56 -0000 1.1 --- occltbehave.cpp 28 Jul 2004 16:51:48 -0000 1.2 *************** *** 26,31 **** const char* ocNullBehaviour::ocNullBehaviourName = "ocNullBehaviour"; ! ocNullBehaviour::ocNullBehaviour(ocBehaviourLayer* bl, const char* _name) : ! ocBehaviourBase(bl), name(_name) { --- 26,32 ---- const char* ocNullBehaviour::ocNullBehaviourName = "ocNullBehaviour"; ! ocNullBehaviour::ocNullBehaviour(ocBehaviourLayer* bl, iCelEntity* _entity, ! const char* _name) : ! ocBehaviourBase(bl, _entity), name(_name) { Index: occltbehave.h =================================================================== RCS file: /cvsroot/once/oncecode/src/client/occltbehave.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** occltbehave.h 26 Jul 2004 11:49:56 -0000 1.1 --- occltbehave.h 28 Jul 2004 16:51:48 -0000 1.2 *************** *** 34,38 **** public: /** Constructor */ ! ocNullBehaviour(ocBehaviourLayer* bl, const char* name); /** Destructor */ ~ocNullBehaviour(); --- 34,38 ---- public: /** Constructor */ ! ocNullBehaviour(ocBehaviourLayer* bl, iCelEntity* entity, const char* name); /** Destructor */ ~ocNullBehaviour(); *************** *** 44,52 **** /** The factory func, used by the behaviour factory. */ ! static ocBehaviourBase* ocCreateAreaInstance(ocBehaviourLayer* bl) ! { return new ocNullBehaviour(bl, ocAreaBehaviourName); } /** The factory func, used by the behaviour factory. */ ! static ocBehaviourBase* ocCreateNullInstance(ocBehaviourLayer* bl) ! { return new ocNullBehaviour(bl, ocNullBehaviourName); } /** Receives message IDs */ --- 44,54 ---- /** The factory func, used by the behaviour factory. */ ! static ocBehaviourBase* ocCreateAreaInstance(ocBehaviourLayer* bl, ! iCelEntity* entity) ! { return new ocNullBehaviour(bl, entity, ocAreaBehaviourName); } /** The factory func, used by the behaviour factory. */ ! static ocBehaviourBase* ocCreateNullInstance(ocBehaviourLayer* bl, ! iCelEntity* entity) ! { return new ocNullBehaviour(bl, entity, ocNullBehaviourName); } /** Receives message IDs */ Index: ocbl.h =================================================================== RCS file: /cvsroot/once/oncecode/src/client/ocbl.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ocbl.h 26 Jul 2004 11:49:56 -0000 1.1 --- ocbl.h 28 Jul 2004 16:51:48 -0000 1.2 *************** *** 27,33 **** #include "behaviourlayer/behave.h" #include "common/ocfactory.h" ! class ocBehaviourLayer : public iCelBlLayer { private: --- 27,34 ---- #include "behaviourlayer/behave.h" + #include "common/ocblcommon.h" #include "common/ocfactory.h" ! class ocBehaviourLayer : public iBehaviourLayer { private: *************** *** 53,57 **** /** Returns physical layer */ ! iCelPlLayer* GetPhysicalLayer() { return pl; } /** Create a behaviour class according to the name. */ --- 54,58 ---- /** Returns physical layer */ ! virtual iCelPlLayer* GetPhysicalLayer() const { return pl; } /** Create a behaviour class according to the name. */ *************** *** 59,93 **** }; - class ocBehaviourBase : public iCelBehaviour - { - private: - ocBehaviourLayer* bl; - iCelPlLayer* pl; - - public: - /** Contructor */ - ocBehaviourBase(ocBehaviourLayer* layer); - /** Destructor */ - virtual ~ocBehaviourBase(); - - /** Declare iBase */ - SCF_DECLARE_IBASE; - - /** Returns the behaviour layer */ - virtual iCelBlLayer* GetBehaviourLayer() const { return bl; } - /** Used when the entity receives a message. Wrapper of SendMessageV */ - virtual bool SendMessage(const char* msg, celData& ret, - iCelParameterBlock* params, ...); - /** Used when the entity received a message. Wrapper of - * SendMessageID that subclasses must define. */ - virtual bool SendMessageV(const char* msg, celData& ret, - iCelParameterBlock* params, va_list args); - /** Sub classes must define this. All messages will come through this - * function */ - virtual bool SendMessageID(csStringID msg_id, celData& ret, - iCelParameterBlock* params, va_list args) = 0; - /** Returns ... something. No idea of what this function should do */ - virtual void* GetInternalObject() { return 0; } - }; - #endif --- 60,62 ---- Index: occlient.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/client/occlient.cpp,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** occlient.cpp 26 Jul 2004 11:49:56 -0000 1.65 --- occlient.cpp 28 Jul 2004 16:51:48 -0000 1.66 *************** *** 175,180 **** conin->SetExecuteCallback(concallback); conin->SetPrompt("> "); - iTextureManager* txtmgr = g3d->GetTextureManager (); - txtmgr->PrepareTextures (); focus = FOCUS_CONSOLE; --- 175,178 ---- Index: ocbl.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/client/ocbl.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ocbl.cpp 26 Jul 2004 11:49:56 -0000 1.1 --- ocbl.cpp 28 Jul 2004 16:51:48 -0000 1.2 *************** *** 32,72 **** - /******************************* ocBehaviourBase *****************************/ - SCF_IMPLEMENT_IBASE(ocBehaviourBase) - SCF_IMPLEMENTS_INTERFACE(iCelBehaviour) - SCF_IMPLEMENT_IBASE_END - - ocBehaviourBase::ocBehaviourBase(ocBehaviourLayer* _bl) - { - bl = _bl; - pl = _bl->GetPhysicalLayer(); - SCF_CONSTRUCT_IBASE(0); - } - - ocBehaviourBase::~ocBehaviourBase() - { - SCF_DESTRUCT_IBASE(); - } - - bool ocBehaviourBase::SendMessage(const char* msg, celData& ret, - iCelParameterBlock* params, ...) - { - va_list arg; - va_start(arg, params); - bool res = SendMessageV(msg, ret, params, arg); - va_end(arg); - return res; - } - - bool ocBehaviourBase::SendMessageV(const char* msg, celData& ret, - iCelParameterBlock* params, va_list args) - { - csStringID msg_id = pl->FetchStringID(msg); - return SendMessageID(msg_id, ret, params, args); - } - - - - /*************************** ocBehaviourLayer ********************************/ SCF_IMPLEMENT_IBASE(ocBehaviourLayer) --- 32,35 ---- *************** *** 98,102 **** const char* name) { ! ocBehaviourBase* behaviour = factory.CreateInstance(name, this); CS_ASSERT(behaviour); --- 61,65 ---- const char* name) { ! ocBehaviourBase* behaviour = factory.CreateInstance(name, entity, this); CS_ASSERT(behaviour); |
From: Remi Bonnet <elscouta@us...> - 2004-07-26 11:50:08
|
Update of /cvsroot/once/oncecode/server_data/entities In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21100/server_data/entities Added Files: dwarf.xml entity.cfg Log Message: New step towards cel. Look at history.txt for details. Sorry for ghost dirs/files. --- NEW FILE: entity.cfg --- Entity.Dwarf = /this/server_data/entities/dwarf.xml --- NEW FILE: dwarf.xml --- <entity> <behaviour name="ocPlayerBehaviour" /> <propclass name="pcmesh"> <action name="LoadMesh"> <!-- This is the modelfile to use for this creature (name of a mesh factory file). --> <par name="filename" string="/once/content/global/door.xml" /> <!-- Name of the factory as specified in the model file. This MUST be equal to the name that is given to the 'meshfact' there. --> <par name="factoryname" string="door" /> </action> </propclass> </entity> |
Update of /cvsroot/once/oncecode/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21100/src/common Modified Files: ocapplication.cpp ocapplication.h ocentity.cpp ocentity.h ocfactory.cpp ocloader.cpp ocloader.h Removed Files: ocentitymesh.cpp ocentitymesh.h Log Message: New step towards cel. Look at history.txt for details. Sorry for ghost dirs/files. Index: ocentity.h =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocentity.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ocentity.h 25 Jul 2004 16:37:26 -0000 1.25 --- ocentity.h 26 Jul 2004 11:49:56 -0000 1.26 *************** *** 31,34 **** --- 31,36 ---- #include "csgeom/transfrm.h" + + struct iCelEntity; struct iMeshWrapper; struct csReversibleTransform; *************** *** 104,108 **** protected: ! iocEntityMesh *mesh; private: --- 106,110 ---- protected: ! iCelEntity *celobject; private: *************** *** 134,137 **** --- 136,146 ---- {subscriberlist.RemoveSubscriber(sub);} + /// Update the cel object position, syncing it with the position of the once + /// entity + void UpdateCelObjectPosition(); + /// @@@ Returns CS mesh. This function is only here for compatibility and + /// must be removed as soon as possible + iMeshWrapper* GetCSMesh(); + /// get the ID ocID<ocEntity> GetID() const {return this_id;} *************** *** 156,163 **** /// get speed csVector3 GetSpeed() const { return speed; } - /// get iocEntityMesh object (if any) - iocEntityMesh* GetMesh() { return mesh; } /// get the entity transform csReversibleTransform* GetTransform(); /// Set the name of the entity --- 165,172 ---- /// get speed csVector3 GetSpeed() const { return speed; } /// get the entity transform csReversibleTransform* GetTransform(); + /// Get the cel object + iCelEntity* GetCelObject() { return celobject; } /// Set the name of the entity *************** *** 169,175 **** { position = p; - if (mesh) - mesh->SetPosition(p); transform.SetOrigin(p); Changed(DIFF_ENTITY_POSITION); } --- 178,186 ---- { position = p; transform.SetOrigin(p); + + if (celobject) + UpdateCelObjectPosition(); + Changed(DIFF_ENTITY_POSITION); } *************** *** 195,200 **** /// Set visible in world of entity void SetVisibleInWorld(bool v) {visible_in_world = v; Changed();} ! /// Set iocEntityMesh object ! void SetMesh(iocEntityMesh* em) { delete mesh; mesh = em; } /// Get the server state --- 206,212 ---- /// Set visible in world of entity void SetVisibleInWorld(bool v) {visible_in_world = v; Changed();} ! /// Set CEL object ! void SetCelObject(iCelEntity* e) ! { CS_ASSERT(celobject == 0); celobject = e; } /// Get the server state --- ocentitymesh.cpp DELETED --- Index: ocapplication.h =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocapplication.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ocapplication.h 25 Jul 2004 16:37:26 -0000 1.2 --- ocapplication.h 26 Jul 2004 11:49:56 -0000 1.3 *************** *** 27,32 **** #include "tools/entityloader.h" - #include "common/bl/ocbl.h" - struct iVFS; struct iConfigManager; --- 27,30 ---- *************** *** 46,50 **** class ocLoader; class ocCommandSet; - class ocBehaviourLayer; class ocContentDirTree; class ocSettingsMgr; --- 44,47 ---- *************** *** 73,78 **** csRef<iEntityLoader> entity_loader; - /// Behaviour layer - csRef<ocBehaviourLayer> bl; /// Command set, to process command lines. ocCommandSet* cmdset; --- 70,73 ---- *************** *** 86,95 **** ocSettingsMgr* settings_mgr; ! public: ! /** Constructor */ ! ocApplication(); ! /** Destructor */ ! virtual ~ocApplication(); ! /** Initialize various common stuff, including common plugins, cel paths */ bool InitializeCommon(int argc, const char* const argv[], --- 81,87 ---- ocSettingsMgr* settings_mgr; ! protected: ! /** Register the behaviour layer and returns false if failure. */ ! bool RegisterBehaviourLayer(iCelBlLayer* bl); /** Initialize various common stuff, including common plugins, cel paths */ bool InitializeCommon(int argc, const char* const argv[], *************** *** 100,103 **** --- 92,102 ---- /** Cleanup common stuff */ void CleanupCommon(); + + public: + /** Constructor */ + ocApplication(); + /** Destructor */ + virtual ~ocApplication(); + /** Used to report an error. Use this for error/debug info. Player directed * info should go to PrintMessage output. Note that this behaviour is *************** *** 111,116 **** /** Returns content dir tree */ ocContentDirTree* GetContentTree() { return content_tree; } - /** Returns behaviour layer */ - csRef<ocBehaviourLayer> GetBehaviourLayer() { return bl; } /** Returns VFS plugin */ csRef<iVFS> GetVFS() { return vfs; } --- 110,113 ---- --- ocentitymesh.h DELETED --- Index: ocfactory.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocfactory.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ocfactory.cpp 25 Jul 2004 16:37:26 -0000 1.3 --- ocfactory.cpp 26 Jul 2004 11:49:56 -0000 1.4 *************** *** 21,26 **** #include "csutil/hash.h" - #include "common/bl/ocbl.h" - #include "common/ocfactory.h" --- 21,24 ---- Index: ocapplication.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocapplication.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ocapplication.cpp 25 Jul 2004 16:37:26 -0000 1.2 --- ocapplication.cpp 26 Jul 2004 11:49:56 -0000 1.3 *************** *** 45,49 **** #include "common/ocarea.h" #include "common/occontentfile.h" - #include "common/bl/ocbl.h" #include "common/ocapplication.h" --- 45,48 ---- *************** *** 164,171 **** } ! bool ocApplication::InitializeCommon2() { - // Create modules: Behaviour layer - bl = new ocBehaviourLayer(pl); pl->RegisterBehaviourLayer(bl); if (!object_reg->Register(bl, "iCelBlLayer")) --- 163,168 ---- } ! bool ocApplication::RegisterBehaviourLayer(iCelBlLayer* bl) { pl->RegisterBehaviourLayer(bl); if (!object_reg->Register(bl, "iCelBlLayer")) *************** *** 175,179 **** return false; } ! // Create modules: Serial Factory factory = new ocFactory<iSerial>(); --- 172,180 ---- return false; } ! return true; ! } ! ! bool ocApplication::InitializeCommon2() ! { // Create modules: Serial Factory factory = new ocFactory<iSerial>(); Index: ocentity.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocentity.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ocentity.cpp 24 Jul 2004 11:29:10 -0000 1.15 --- ocentity.cpp 26 Jul 2004 11:49:56 -0000 1.16 *************** *** 23,26 **** --- 23,31 ---- #include "iengine/mesh.h" + #include "physicallayer/pl.h" + #include "physicallayer/propclas.h" + #include "physicallayer/entity.h" + #include "propclass/mesh.h" + #include "ocentity.h" *************** *** 33,37 **** visible_in_world = false; // no appearance or desc yet. y_rotation = 0; ! mesh = 0; transform.Identity(); speed = csVector3(0.0f, 0.0f, 0.0f); --- 38,42 ---- visible_in_world = false; // no appearance or desc yet. y_rotation = 0; ! celobject = 0; transform.Identity(); speed = csVector3(0.0f, 0.0f, 0.0f); *************** *** 44,48 **** visible_in_world = false; // no appearance or desc yet. y_rotation = 0; ! mesh = 0; transform.Identity(); speed = csVector3(0.0f, 0.0f, 0.0f); --- 49,53 ---- visible_in_world = false; // no appearance or desc yet. y_rotation = 0; ! celobject = 0; transform.Identity(); speed = csVector3(0.0f, 0.0f, 0.0f); *************** *** 53,57 **** : iSerial(), iocSubscribable() { ! this_id = e.this_id; object_cn = e.object_cn; subscriberlist = e.subscriberlist; --- 58,63 ---- : iSerial(), iocSubscribable() { ! CS_ASSERT(0); /* unsupported */ ! /* this_id = e.this_id; object_cn = e.object_cn; subscriberlist = e.subscriberlist; *************** *** 70,77 **** gui_action = e.gui_action; svrstate = e.svrstate; ! if (e.mesh) mesh = e.mesh->Clone(); else ! mesh = 0; } --- 76,83 ---- gui_action = e.gui_action; svrstate = e.svrstate; ! if (e.cel) mesh = e.mesh->Clone(); else ! mesh = 0; */ } *************** *** 79,84 **** { svrstate = 0; ! if (mesh) ! delete mesh; } --- 85,89 ---- { svrstate = 0; ! CS_ASSERT(mesh == 0); } *************** *** 207,208 **** --- 212,228 ---- return &transform; } + + void ocEntity::UpdateCelObjectPosition() + { + csRef<iPcMesh> pcmesh = CEL_QUERY_PROPCLASS_ENT(celobject, iPcMesh); + pcmesh->MoveMesh(0, position); + } + + iMeshWrapper* ocEntity::GetCSMesh() + { + if (!celobject) + return 0; + + csRef<iPcMesh> pcmesh = CEL_QUERY_PROPCLASS_ENT(celobject, iPcMesh); + return pcmesh->GetMesh(); + } Index: ocloader.h =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocloader.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ocloader.h 25 Jul 2004 16:37:26 -0000 1.7 --- ocloader.h 26 Jul 2004 11:49:56 -0000 1.8 *************** *** 29,32 **** --- 29,33 ---- class ocArea; class ocAreaID; + class ocEntity; class ocApplication; class ocBehaviourLayer; *************** *** 46,51 **** /** The CS document system */ csRef<iDocumentSystem> ds; - /** Our behaviour layer */ - csRef<ocBehaviourLayer> bl; /** Config file. We use our own config file for all the art specification. */ --- 47,50 ---- *************** *** 55,59 **** ocApplication* app; ! /** An hash from entity name to filename. */ csHash<csString, csStrKey, csConstCharHashKeyHandler> entity_files; --- 54,58 ---- ocApplication* app; ! /** An hash from entity name to filename. (unused currently) */ csHash<csString, csStrKey, csConstCharHashKeyHandler> entity_files; *************** *** 70,81 **** /** Load the map for given area. Will use ocApplication* to output ! * messages on console */ ! bool LoadMap(ocAreaID area); /** Unload the map for given area. */ void UnloadMap(ocArea* area); ! /** Return CEL entity for given appearance. The entity will be created in ! * given area. */ ! csRef<iCelEntity> GetEntity(ocAppearance* appear); }; --- 69,82 ---- /** Load the map for given area. Will use ocApplication* to output ! * messages on console. */ ! bool LoadMap(ocAreaID area, iCelBlLayer* bl); /** Unload the map for given area. */ void UnloadMap(ocArea* area); ! /** Load CEL entity for given once entity. The entity will be created with ! * given behaviour layer. */ ! bool LoadEntity(ocEntity* entity, iCelBlLayer* bl); ! /** Destroy the cel entity. */ ! void UnloadEntity(ocEntity* entity); }; Index: ocloader.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocloader.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ocloader.cpp 25 Jul 2004 16:37:26 -0000 1.13 --- ocloader.cpp 26 Jul 2004 11:49:56 -0000 1.14 *************** *** 45,49 **** pl = app->GetPhysicalLayer(); ds = app->GetDocumentSystem(); - bl = app->GetBehaviourLayer(); entity_loader = app->GetEntityLoader(); --- 45,48 ---- *************** *** 76,86 **** } ! csPtr<iDocumentNode> ocLoader::GetEntityNodeInFile(const char* file) ! { ! csRef<iDocument> doc = LoadFileAsXML(file); ! return csPtr<iDocumentNode>(doc->GetRoot()->GetNode("entity")); ! } ! ! bool ocLoader::LoadMap(ocAreaID area) { csString msg; --- 75,79 ---- } ! bool ocLoader::LoadMap(ocAreaID area, iCelBlLayer* bl) { csString msg; *************** *** 92,95 **** --- 85,96 ---- csRef<iCelEntity> celobject = pl->CreateEntity("area", bl, "ocAreaBehaviour", "pcregion", 0); + if (!celobject) + { + app->PrintMessage("\nUnable to create CEL entity. Possible reasons are:\n" + "- missing or unregistered pcregion factory.\n" + "- missing or unregistered ocAreaBehaviour.\n"); + return false; + } + area->SetCelObject(celobject); *************** *** 119,160 **** } ! csRef<iCelEntity> ocLoader::GetEntity(ocAppearance* appear) { ! csString objectname = appear->GetObjectName(); const char* vfspath = config_file->GetStr("Entity." + objectname, 0); if (!vfspath) { ! app->PrintMessage("Can't find object %s specifications in art.cfg.\n", objectname.GetData()); ! return 0; } ! csRef<iDocumentNode> entity_node = GetEntityNodeInFile(vfspath); ! if (!entity_node) { app->PrintMessage("Can't parse entity file %s.\n", vfspath); ! return 0; } ! csRef<iCelEntity> entity = entity_loader->Load(entity_node); ! if (!entity) { app->PrintMessage("Error loading entity file %s.\n", vfspath); ! return 0; } ! return csPtr<iCelEntity>(entity); } ! void ocLoader::UnloadMap(ocArea* area) { ! csRef<iCelEntity> celentity = area->GetCelObject(); if (!celentity) return; - csRef<iPcRegion> pcregion = CEL_QUERY_PROPCLASS_ENT(celentity, iPcRegion); - pcregion->Unload(); - pl->RemoveEntity(celentity); ! area->SetCelObject(0); } --- 120,182 ---- } ! void ocLoader::UnloadMap(ocArea* area) { ! csRef<iCelEntity> celentity = area->GetCelObject(); ! if (!celentity) ! return; ! ! csRef<iPcRegion> pcregion = CEL_QUERY_PROPCLASS_ENT(celentity, iPcRegion); ! pcregion->Unload(); ! ! pl->RemoveEntity(celentity); ! area->SetCelObject(0); ! } ! ! bool ocLoader::LoadEntity(ocEntity* entity, iCelBlLayer* bl) ! { ! csString objectname = entity->GetAppearance()->GetObjectName(); const char* vfspath = config_file->GetStr("Entity." + objectname, 0); if (!vfspath) { ! app->PrintMessage("Can't find object %s specifications in entity config " ! "file.\n", objectname.GetData()); ! return false; } ! csRef<iDocument> entity_document = LoadFileAsXML(vfspath); ! if (!entity_document) { app->PrintMessage("Can't parse entity file %s.\n", vfspath); ! return false; } ! csRef<iDocumentNode> entity_node; ! entity_node = entity_document->GetRoot()->GetNode("entity"); ! if (!entity_node) ! { ! app->PrintMessage("File %s doesn't have an 'entity' node.\n", vfspath); ! return false; ! } ! ! csRef<iCelEntity> celentity = entity_loader->Load(entity_node); ! if (!celentity) { app->PrintMessage("Error loading entity file %s.\n", vfspath); ! return false; } ! entity->SetCelObject(celentity); ! ! return true; } ! void ocLoader::UnloadEntity(ocEntity* entity) { ! csRef<iCelEntity> celentity = entity->GetCelObject(); if (!celentity) return; pl->RemoveEntity(celentity); ! entity->SetCelObject(0); } |
From: Remi Bonnet <elscouta@us...> - 2004-07-26 11:50:08
|
Update of /cvsroot/once/oncecode/src/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21100/src/server Modified Files: ocareastate.cpp ocareastate.h ocentitystate.cpp ocentitystate.h ochdllogin.cpp ocplayerstate.cpp ocplayerstate.h ocserver.cpp ocserver.h Added Files: ocbl.cpp ocbl.h Log Message: New step towards cel. Look at history.txt for details. Sorry for ghost dirs/files. Index: ocserver.h =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocserver.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ocserver.h 24 Jul 2004 11:29:11 -0000 1.30 --- ocserver.h 26 Jul 2004 11:49:57 -0000 1.31 *************** *** 32,35 **** --- 32,39 ---- struct iConsoleInput; struct iObjectRegistry; + struct iVirtualClock; + struct iNetworkDriver; + struct iNetworkListener; + struct iNetworkConnection; class ocCommandSet; class ocWorld; *************** *** 43,61 **** class iocDatabase; class ocSettingsMgr; template<class T> class ocFactory; - struct iVirtualClock; - struct iNetworkDriver; - struct iNetworkListener; - struct iNetworkConnection; #include "ivaria/conin.h" #include "csutil/refarr.h" #include "csutil/stringarray.h" #include "common/ocidentifier.h" #include "common/ocapplication.h" ! #include "ocmsghandler.h" ! #include "ocNameGen.h" ! class ocServer; ! class ocLoader; /** --- 47,63 ---- class iocDatabase; class ocSettingsMgr; + class ocServer; + class ocLoader; template<class T> class ocFactory; #include "ivaria/conin.h" #include "csutil/refarr.h" #include "csutil/stringarray.h" + #include "common/ocidentifier.h" #include "common/ocapplication.h" ! #include "server/ocmsghandler.h" ! #include "server/ocNameGen.h" ! #include "server/ocbl.h" /** *************** *** 97,100 **** --- 99,104 ---- /// the database manager iocDatabase* dbmgr; + /// the behaviour layer + csRef<ocBehaviourLayer> bl; /// message of the day *************** *** 159,162 **** --- 163,168 ---- /** Get Network manager */ ocServerNetworkMgr* GetNetworkMgr() const { return networkmgr; } + /** Get Behaviour layer */ + ocBehaviourLayer* GetBehaviourLayer() const { return bl; } /// get the message of the day Index: ocareastate.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocareastate.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** ocareastate.cpp 25 Jul 2004 16:37:26 -0000 1.36 --- ocareastate.cpp 26 Jul 2004 11:49:57 -0000 1.37 *************** *** 181,185 **** serversys->GetVirtualClock()->Suspend(); ! if (!serversys->GetLoader()->LoadMap(area->GetID())) return false; --- 181,186 ---- serversys->GetVirtualClock()->Suspend(); ! if (!serversys->GetLoader()->LoadMap(area->GetID(), ! serversys->GetBehaviourLayer())) return false; *************** *** 217,221 **** { mesh = meshes->Next(); ! if (mesh == entity->GetMesh()->GetCSMesh()) continue; if (!csColliderWrapper::GetColliderWrapper(mesh->QueryObject())) --- 218,222 ---- { mesh = meshes->Next(); ! if (mesh == entity->GetCSMesh()) continue; if (!csColliderWrapper::GetColliderWrapper(mesh->QueryObject())) *************** *** 240,244 **** mesh = meshes->Next(); ! if (mesh == entity->GetMesh()->GetCSMesh()) continue; --- 241,245 ---- mesh = meshes->Next(); ! if (mesh == entity->GetCSMesh()) continue; *************** *** 376,382 **** } ! void ocAreaState::AddPlayerOnline(ocPlayerState* player_state) { ! player_state->Login(this); bool was_logged = players_online.Delete(player_state); --- 377,384 ---- } ! bool ocAreaState::AddPlayerOnline(ocPlayerState* player_state) { ! if (!player_state->Login(this)) ! return false; bool was_logged = players_online.Delete(player_state); *************** *** 388,392 **** // Subscribe to area content serversys->GetContentMgr()->SubscribePlayerToArea(area->GetID(), ! player_state); // first subscription to entities Resubscribe(player_state); --- 390,394 ---- // Subscribe to area content serversys->GetContentMgr()->SubscribePlayerToArea(area->GetID(), ! player_state); // first subscription to entities Resubscribe(player_state); --- NEW FILE: ocbl.cpp --- /* * ocbl.cpp * Copyright (C) 2003-2004 by The Once developement team * * 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 "config.h" #include "iutil/strset.h" #include "physicallayer/entity.h" #include "physicallayer/pl.h" #include "behaviourlayer/behave.h" #include "common/ocidentifier.h" #include "common/ocfactory.h" #include "server/behaviours/ocarea_bl.h" #include "server/behaviours/ocplayer_bl.h" #include "server/ocbl.h" /******************************* ocBehaviourBase *****************************/ SCF_IMPLEMENT_IBASE(ocBehaviourBase) SCF_IMPLEMENTS_INTERFACE(iCelBehaviour) SCF_IMPLEMENT_IBASE_END ocBehaviourBase::ocBehaviourBase(ocBehaviourLayer* _bl) { bl = _bl; pl = _bl->GetPhysicalLayer(); SCF_CONSTRUCT_IBASE(0); } ocBehaviourBase::~ocBehaviourBase() { SCF_DESTRUCT_IBASE(); } bool ocBehaviourBase::SendMessage(const char* msg, celData& ret, iCelParameterBlock* params, ...) { va_list arg; va_start(arg, params); bool res = SendMessageV(msg, ret, params, arg); va_end(arg); return res; } bool ocBehaviourBase::SendMessageV(const char* msg, celData& ret, iCelParameterBlock* params, va_list args) { csStringID msg_id = pl->FetchStringID(msg); return SendMessageID(msg_id, ret, params, args); } /*************************** ocBehaviourLayer ********************************/ SCF_IMPLEMENT_IBASE(ocBehaviourLayer) SCF_IMPLEMENTS_INTERFACE(iCelBlLayer) SCF_IMPLEMENT_IBASE_END ocBehaviourLayer::ocBehaviourLayer(iCelPlLayer* _pl) { SCF_CONSTRUCT_IBASE(0); pl = _pl; InitializeBehaviours(); } ocBehaviourLayer::~ocBehaviourLayer() { SCF_DESTRUCT_IBASE(); } void ocBehaviourLayer::InitializeBehaviours() { factory.RegClass<ocPlayerBehaviour>(); ocPlayerBehaviour::RegisterStringIDs(pl); factory.RegClass<ocAreaBehaviour>(); } iCelBehaviour* ocBehaviourLayer::CreateBehaviour(iCelEntity* entity, const char* name) { ocBehaviourBase* behaviour = factory.CreateInstance(name, this); CS_ASSERT(behaviour); entity->SetBehaviour(behaviour); return behaviour; } --- NEW FILE: ocbl.h --- /* * ocbl.h * Copyright (C) 2003-2004 by The Once developement team * * 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 */ #ifndef OCBL_H #define OCBL_H struct iCelPlLayer; class ocBehaviourLayer; class ocBehaviourBase; #include "behaviourlayer/bl.h" #include "behaviourlayer/behave.h" #include "common/ocfactory.h" class ocBehaviourLayer : public iCelBlLayer { private: /** The factory to create the behaviours. */ ocBehaviourFactory factory; /** The physical layer */ iCelPlLayer* pl; private: void InitializeBehaviours(); public: /** Constructor */ ocBehaviourLayer(iCelPlLayer* pl); /** Destructor */ virtual ~ocBehaviourLayer(); /* Declare iBase */ SCF_DECLARE_IBASE; /** Returns the name of this layer. */ virtual const char* GetName () const { return "OnceBehaviourLayer"; } /** Returns physical layer */ iCelPlLayer* GetPhysicalLayer() { return pl; } /** Create a behaviour class according to the name. */ virtual iCelBehaviour* CreateBehaviour(iCelEntity* entity, const char* name); }; class ocBehaviourBase : public iCelBehaviour { private: ocBehaviourLayer* bl; iCelPlLayer* pl; public: /** Contructor */ ocBehaviourBase(ocBehaviourLayer* layer); /** Destructor */ virtual ~ocBehaviourBase(); /** Declare iBase */ SCF_DECLARE_IBASE; /** Returns the behaviour layer */ virtual iCelBlLayer* GetBehaviourLayer() const { return bl; } /** Used when the entity receives a message. Wrapper of SendMessageV */ virtual bool SendMessage(const char* msg, celData& ret, iCelParameterBlock* params, ...); /** Used when the entity received a message. Wrapper of * SendMessageID that subclasses must define. */ virtual bool SendMessageV(const char* msg, celData& ret, iCelParameterBlock* params, va_list args); /** Sub classes must define this. All messages will come through this * function */ virtual bool SendMessageID(csStringID msg_id, celData& ret, iCelParameterBlock* params, va_list args) = 0; /** Returns ... something. No idea of what this function should do */ virtual void* GetInternalObject() { return 0; } }; #endif Index: ocareastate.h =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocareastate.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ocareastate.h 12 Jul 2004 19:53:05 -0000 1.24 --- ocareastate.h 26 Jul 2004 11:49:57 -0000 1.25 *************** *** 80,84 **** /** Add a player online and call all the initialization procedures. This is * the function you must call to log a player */ ! void AddPlayerOnline(ocPlayerState* player_state); /** Remove a player online. This is the function you must call to logout * a player (or delete the area) */ --- 80,84 ---- /** Add a player online and call all the initialization procedures. This is * the function you must call to log a player */ ! bool AddPlayerOnline(ocPlayerState* player_state); /** Remove a player online. This is the function you must call to logout * a player (or delete the area) */ Index: ochdllogin.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ochdllogin.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ochdllogin.cpp 24 Jul 2004 11:29:11 -0000 1.14 --- ochdllogin.cpp 26 Jul 2004 11:49:57 -0000 1.15 *************** *** 126,130 **** * procedures, including creating the avatar and add the player state * both to the area and world list */ ! area_state->AddPlayerOnline(pstate); /* Send reply packets */ --- 126,136 ---- * procedures, including creating the avatar and add the player state * both to the area and world list */ ! if (!area_state->AddPlayerOnline(pstate)) ! { ! serversys->PrintMessage("Unable to log player (internal server error)"); ! SendReply(conn, "Login failed (internal server error)"); ! delete pstate; ! return 0; ! } /* Send reply packets */ *************** *** 174,178 **** ocPlayerState* pstate = area_state->CreatePlayer(msg->username.GetData()); pstate->SetNetLink(conn); ! area_state->AddPlayerOnline(pstate); serversys->PrintMessage("Player %s created.\n", --- 180,190 ---- ocPlayerState* pstate = area_state->CreatePlayer(msg->username.GetData()); pstate->SetNetLink(conn); ! if (!area_state->AddPlayerOnline(pstate)) ! { ! serversys->PrintMessage("Unable to log player (internal server error)"); ! SendReply(conn, "Login failed (internal server error)"); ! delete pstate; ! return 0; ! } serversys->PrintMessage("Player %s created.\n", Index: ocentitystate.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocentitystate.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ocentitystate.cpp 25 Jul 2004 16:37:26 -0000 1.13 --- ocentitystate.cpp 26 Jul 2004 11:49:57 -0000 1.14 *************** *** 27,31 **** #include "common/ocarea.h" #include "common/ocentity.h" - #include "common/ocentitymesh.h" #include "common/ocloader.h" #include "ocscript.h" --- 27,30 ---- *************** *** 116,137 **** } ! void ocEntityState::UpdateMesh() { csRef<iCollideSystem> colsys; colsys = entity->GetCurrentArea()->GetServerState()->GetCollideSystem(); ! entity->SetMesh(new ocEntityMesh(entity, serversys->GetLoader())); ! iMeshWrapper* mesh = entity->GetMesh()->GetCSMesh(); csColliderHelper::InitializeCollisionWrapper(colsys, mesh); } csRef<iCollider> ocEntityState::GetCollider() { - iocEntityMesh* mesh = entity->GetMesh(); - if (!mesh) - return 0; - csColliderWrapper* wrap; ! iObject* object = mesh->GetCSMesh()->QueryObject(); wrap = csColliderWrapper::GetColliderWrapper(object); --- 115,141 ---- } ! bool ocEntityState::UpdateMesh() { + ocLoader* loader = serversys->GetLoader(); + loader->UnloadEntity(entity); + if (!loader->LoadEntity(entity, serversys->GetBehaviourLayer())) + { + serversys->PrintMessage("Unable to create cel entity.\n"); + return false; + } + csRef<iCollideSystem> colsys; colsys = entity->GetCurrentArea()->GetServerState()->GetCollideSystem(); ! iMeshWrapper* mesh = entity->GetCSMesh(); csColliderHelper::InitializeCollisionWrapper(colsys, mesh); + + return true; } csRef<iCollider> ocEntityState::GetCollider() { csColliderWrapper* wrap; ! iObject* object = entity->GetCSMesh()->QueryObject(); wrap = csColliderWrapper::GetColliderWrapper(object); *************** *** 143,154 **** float ocEntityState::GetRadius() { ! CS_ASSERT(entity->GetMesh()); ! return entity->GetMesh()->GetRadius(); } bool ocEntityState::Initialize() { ! UpdateMesh(); return true; --- 147,162 ---- float ocEntityState::GetRadius() { ! iMeshWrapper* wrap = entity->GetCSMesh(); ! CS_ASSERT(wrap); ! csVector3 rad, cent; ! wrap->GetRadius(rad, cent); ! return rad.Norm(); } bool ocEntityState::Initialize() { ! if (!UpdateMesh()) ! return false; return true; Index: ocplayerstate.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocplayerstate.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ocplayerstate.cpp 25 Jul 2004 16:37:26 -0000 1.27 --- ocplayerstate.cpp 26 Jul 2004 11:49:57 -0000 1.28 *************** *** 71,79 **** } ! void ocPlayerState::Login(ocAreaState* area_state) { - serversys->GetWorld()->AddPlayer(this); - ocEntityState* avatar_state = area_state->CreateEntity(); avatar_state->SetType(ENTITY_TYPE_PLAYER); --- 71,78 ---- } ! bool ocPlayerState::Login(ocAreaState* area_state) { ocEntityState* avatar_state = area_state->CreateEntity(); + avatar_state->SetType(ENTITY_TYPE_PLAYER); *************** *** 87,97 **** avatar->SetSpeed(csVector3(0.0f, 0.0f, 0.0f)); ! area_state->AddEntity(avatar_state); player->SetAvatar(avatar_state->GetEntity()->GetID()); // subscribe player to 'main' objects: player->AddSubscriber(&subscriptionlist); player->GetCurrentArea()->AddSubscriber(&subscriptionlist); player->GetAvatar()->AddSubscriber(&subscriptionlist); } --- 86,105 ---- avatar->SetSpeed(csVector3(0.0f, 0.0f, 0.0f)); ! if (!area_state->AddEntity(avatar_state)) ! { ! serversys->PrintMessage("Failed initializing player avatar.\n"); ! return false; ! } ! player->SetAvatar(avatar_state->GetEntity()->GetID()); + serversys->GetWorld()->AddPlayer(this); + // subscribe player to 'main' objects: player->AddSubscriber(&subscriptionlist); player->GetCurrentArea()->AddSubscriber(&subscriptionlist); player->GetAvatar()->AddSubscriber(&subscriptionlist); + + return true; } Index: ocserver.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocserver.cpp,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** ocserver.cpp 24 Jul 2004 20:38:47 -0000 1.56 --- ocserver.cpp 26 Jul 2004 11:49:57 -0000 1.57 *************** *** 185,188 **** --- 185,192 ---- RegisterServerCmd(cmdset); + // Initialize behaviour factories + bl = new ocBehaviourLayer(pl); + RegisterBehaviourLayer(bl); + // load MOTD LoadMOTD(); Index: ocplayerstate.h =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocplayerstate.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ocplayerstate.h 30 Jun 2004 12:08:08 -0000 1.19 --- ocplayerstate.h 26 Jul 2004 11:49:57 -0000 1.20 *************** *** 103,107 **** * adding the pointer to the world list. * This is called in ocAreaState::AddPlayer. */ ! void Login(ocAreaState* area); /** Undo all the things made by Login. After this function the player * state should be deleted. */ --- 103,107 ---- * adding the pointer to the world list. * This is called in ocAreaState::AddPlayer. */ ! bool Login(ocAreaState* area); /** Undo all the things made by Login. After this function the player * state should be deleted. */ Index: ocentitystate.h =================================================================== RCS file: /cvsroot/once/oncecode/src/server/ocentitystate.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ocentitystate.h 25 Jul 2004 16:37:26 -0000 1.12 --- ocentitystate.h 26 Jul 2004 11:49:57 -0000 1.13 *************** *** 78,82 **** csRef<iCollider> GetCollider(); ! /// Get the radius of this entity float GetRadius(); --- 78,83 ---- csRef<iCollider> GetCollider(); ! /// Get the radius of this entity. @@@@ Inefficient function provided for ! /// compatibility. Must be removed float GetRadius(); *************** *** 93,101 **** /** Perform all the initialization routines. Must be called when the * different fields of the entity. ! * Return false of failure. You must delete the entity in that case*/ bool Initialize(); ! /** Update the mesh in the entity, the collider ... */ ! void UpdateMesh(); /** This functions must be used instead of the entity one on server side */ --- 94,102 ---- /** Perform all the initialization routines. Must be called when the * different fields of the entity. ! * Return false of failure. You must delete the entity in that case */ bool Initialize(); ! /** Update the mesh in the entity, the collider ... Returns success */ ! bool UpdateMesh(); /** This functions must be used instead of the entity one on server side */ |
From: Remi Bonnet <elscouta@us...> - 2004-07-26 11:50:08
|
Update of /cvsroot/once/oncecode/server_data/common/global In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21100/server_data/common/global Modified Files: dwarf.xml Added Files: entity.cfg Log Message: New step towards cel. Look at history.txt for details. Sorry for ghost dirs/files. --- NEW FILE: entity.cfg --- Entity.Dwarf = /once/content/global/dwarf.xml Index: dwarf.xml =================================================================== RCS file: /cvsroot/once/oncecode/server_data/common/global/dwarf.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dwarf.xml 25 Jul 2004 16:37:27 -0000 1.1 --- dwarf.xml 26 Jul 2004 11:49:57 -0000 1.2 *************** *** 1,4 **** <entity> ! <behaviour name="ocPlayerBehaviour" /> <propclass name="pcmesh"> --- 1,4 ---- <entity> ! <behaviour name="ocNullBehaviour" /> <propclass name="pcmesh"> |
From: Remi Bonnet <elscouta@us...> - 2004-07-26 11:50:07
|
Update of /cvsroot/once/oncecode/src/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21100/src/client Modified Files: occlient.cpp occlient.h ocdisplay.cpp ocdisplay.h Added Files: ocbl.cpp ocbl.h occltbehave.cpp occltbehave.h Log Message: New step towards cel. Look at history.txt for details. Sorry for ghost dirs/files. --- NEW FILE: occltbehave.cpp --- /* * occltbehave.cpp * Copyright (C) 2003-2004 by The Once developement team * * 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 "config.h" #include "common/ocfactory.h" #include "client/occltbehave.h" const char* ocNullBehaviour::ocAreaBehaviourName = "ocAreaBehaviour"; const char* ocNullBehaviour::ocNullBehaviourName = "ocNullBehaviour"; ocNullBehaviour::ocNullBehaviour(ocBehaviourLayer* bl, const char* _name) : ocBehaviourBase(bl), name(_name) { } ocNullBehaviour::~ocNullBehaviour() { } --- NEW FILE: occltbehave.h --- /* * occltbehave.h * Copyright (C) 2003-2004 by The Once developement team * * 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 */ #ifndef OCCLTBEHAVE_H #define OCCLTBEHAVE_H #include "client/ocbl.h" /** This class is a dummy behaviour for all client classes. Currently, clients * entities have no other behaviour than syncing themselves with server ones * (that are controlled by true behaviours) */ class ocNullBehaviour : public ocBehaviourBase { private: /** The name of this instance, either ocAreaBehaviourName or * ocNullBehaviourName */ const char* name; public: /** Constructor */ ocNullBehaviour(ocBehaviourLayer* bl, const char* name); /** Destructor */ ~ocNullBehaviour(); /** Stores the string so that instances can refer to it. */ static const char* ocAreaBehaviourName; /** Stores the string so that instances can refer to it. */ static const char* ocNullBehaviourName; /** The factory func, used by the behaviour factory. */ static ocBehaviourBase* ocCreateAreaInstance(ocBehaviourLayer* bl) { return new ocNullBehaviour(bl, ocAreaBehaviourName); } /** The factory func, used by the behaviour factory. */ static ocBehaviourBase* ocCreateNullInstance(ocBehaviourLayer* bl) { return new ocNullBehaviour(bl, ocNullBehaviourName); } /** Receives message IDs */ bool SendMessageID(csStringID, celData&, iCelParameterBlock*, va_list) { return false; } /** Returns the name of the behaviour */ const char* GetName() const { return name; } }; #endif --- NEW FILE: ocbl.h --- /* * ocbl.h * Copyright (C) 2003-2004 by The Once developement team * * 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 */ #ifndef OCBL_H #define OCBL_H struct iCelPlLayer; class ocBehaviourLayer; class ocBehaviourBase; #include "behaviourlayer/bl.h" #include "behaviourlayer/behave.h" #include "common/ocfactory.h" class ocBehaviourLayer : public iCelBlLayer { private: /** The factory to create the behaviours. */ ocBehaviourFactory factory; /** The physical layer */ iCelPlLayer* pl; private: void InitializeBehaviours(); public: /** Constructor */ ocBehaviourLayer(iCelPlLayer* pl); /** Destructor */ virtual ~ocBehaviourLayer(); /* Declare iBase */ SCF_DECLARE_IBASE; /** Returns the name of this layer. */ virtual const char* GetName () const { return "OnceBehaviourLayer"; } /** Returns physical layer */ iCelPlLayer* GetPhysicalLayer() { return pl; } /** Create a behaviour class according to the name. */ virtual iCelBehaviour* CreateBehaviour(iCelEntity* entity, const char* name); }; class ocBehaviourBase : public iCelBehaviour { private: ocBehaviourLayer* bl; iCelPlLayer* pl; public: /** Contructor */ ocBehaviourBase(ocBehaviourLayer* layer); /** Destructor */ virtual ~ocBehaviourBase(); /** Declare iBase */ SCF_DECLARE_IBASE; /** Returns the behaviour layer */ virtual iCelBlLayer* GetBehaviourLayer() const { return bl; } /** Used when the entity receives a message. Wrapper of SendMessageV */ virtual bool SendMessage(const char* msg, celData& ret, iCelParameterBlock* params, ...); /** Used when the entity received a message. Wrapper of * SendMessageID that subclasses must define. */ virtual bool SendMessageV(const char* msg, celData& ret, iCelParameterBlock* params, va_list args); /** Sub classes must define this. All messages will come through this * function */ virtual bool SendMessageID(csStringID msg_id, celData& ret, iCelParameterBlock* params, va_list args) = 0; /** Returns ... something. No idea of what this function should do */ virtual void* GetInternalObject() { return 0; } }; #endif Index: occlient.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/client/occlient.cpp,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** occlient.cpp 24 Jul 2004 11:29:10 -0000 1.64 --- occlient.cpp 26 Jul 2004 11:49:56 -0000 1.65 *************** *** 61,77 **** #include "common/ocloader.h" #include "common/ocfactory.h" - #include "common/bl/ocbl.h" ! #include "ocmsghandler.h" ! #include "occltcmd.h" ! #include "ocoverlay.h" ! #include "ocdisplay.h" ! #include "ocsubscripmgr.h" ! #include "occltcontmanager.h" ! #include "ocknowledge.h" ! #include "ocplrinput.h" ! #include "ocawsmgr.h" ! #include "occlient.h" CS_IMPLEMENT_APPLICATION --- 61,78 ---- #include "common/ocloader.h" #include "common/ocfactory.h" ! #include "client/ocmsghandler.h" ! #include "client/occltcmd.h" ! #include "client/ocoverlay.h" ! #include "client/ocdisplay.h" ! #include "client/ocsubscripmgr.h" ! #include "client/occltcontmanager.h" ! #include "client/occltbehave.h" ! #include "client/ocbl.h" ! #include "client/ocknowledge.h" ! #include "client/ocplrinput.h" ! #include "client/ocawsmgr.h" ! #include "client/occlient.h" CS_IMPLEMENT_APPLICATION *************** *** 194,197 **** --- 195,202 ---- RegisterClientCmd(cmdset); + // Initialize behaviour layer + bl = new ocBehaviourLayer(pl); + RegisterBehaviourLayer(bl); + // create gui awsmgr = new ocAwsMgr(this, fsvr, mainfont); --- NEW FILE: ocbl.cpp --- /* * ocbl.cpp * Copyright (C) 2003-2004 by The Once developement team * * 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 "config.h" #include "iutil/strset.h" #include "physicallayer/entity.h" #include "physicallayer/pl.h" #include "behaviourlayer/behave.h" #include "common/ocidentifier.h" #include "common/ocfactory.h" #include "client/occltbehave.h" #include "client/ocbl.h" /******************************* ocBehaviourBase *****************************/ SCF_IMPLEMENT_IBASE(ocBehaviourBase) SCF_IMPLEMENTS_INTERFACE(iCelBehaviour) SCF_IMPLEMENT_IBASE_END ocBehaviourBase::ocBehaviourBase(ocBehaviourLayer* _bl) { bl = _bl; pl = _bl->GetPhysicalLayer(); SCF_CONSTRUCT_IBASE(0); } ocBehaviourBase::~ocBehaviourBase() { SCF_DESTRUCT_IBASE(); } bool ocBehaviourBase::SendMessage(const char* msg, celData& ret, iCelParameterBlock* params, ...) { va_list arg; va_start(arg, params); bool res = SendMessageV(msg, ret, params, arg); va_end(arg); return res; } bool ocBehaviourBase::SendMessageV(const char* msg, celData& ret, iCelParameterBlock* params, va_list args) { csStringID msg_id = pl->FetchStringID(msg); return SendMessageID(msg_id, ret, params, args); } /*************************** ocBehaviourLayer ********************************/ SCF_IMPLEMENT_IBASE(ocBehaviourLayer) SCF_IMPLEMENTS_INTERFACE(iCelBlLayer) SCF_IMPLEMENT_IBASE_END ocBehaviourLayer::ocBehaviourLayer(iCelPlLayer* _pl) { SCF_CONSTRUCT_IBASE(0); pl = _pl; InitializeBehaviours(); } ocBehaviourLayer::~ocBehaviourLayer() { SCF_DESTRUCT_IBASE(); } void ocBehaviourLayer::InitializeBehaviours() { factory.Register(ocNullBehaviour::ocAreaBehaviourName, ocNullBehaviour::ocCreateAreaInstance); factory.Register(ocNullBehaviour::ocNullBehaviourName, ocNullBehaviour::ocCreateNullInstance); } iCelBehaviour* ocBehaviourLayer::CreateBehaviour(iCelEntity* entity, const char* name) { ocBehaviourBase* behaviour = factory.CreateInstance(name, this); CS_ASSERT(behaviour); entity->SetBehaviour(behaviour); return behaviour; } Index: occlient.h =================================================================== RCS file: /cvsroot/once/oncecode/src/client/occlient.h,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** occlient.h 24 Jul 2004 11:29:10 -0000 1.33 --- occlient.h 26 Jul 2004 11:49:56 -0000 1.34 *************** *** 64,67 **** --- 64,68 ---- #include "common/occontentfile.h" #include "common/ocapplication.h" + #include "client/ocbl.h" *************** *** 102,105 **** --- 103,108 ---- /// Knowledge manager ocKnowledgeMgr* knowledge_mgr; + /// Behaviour layer + csRef<ocBehaviourLayer> bl; /// the current state of the client. This state is independant with the Index: ocdisplay.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/client/ocdisplay.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** ocdisplay.cpp 25 Jul 2004 16:37:25 -0000 1.46 --- ocdisplay.cpp 26 Jul 2004 11:49:56 -0000 1.47 *************** *** 48,52 **** #include "common/ocarea.h" #include "common/ocloader.h" ! #include "common/ocentitymesh.h" #include "occlient.h" #include "ocdisplay.h" --- 48,52 ---- #include "common/ocarea.h" #include "common/ocloader.h" ! #include "occlient.h" #include "ocdisplay.h" *************** *** 67,70 **** --- 67,71 ---- engine = CS_QUERY_REGISTRY(clientsys->object_reg, iEngine); loader = clientsys->GetLoader(); + bl = clientsys->GetBehaviourLayer(); g3d = CS_QUERY_REGISTRY(clientsys->object_reg, iGraphics3D); *************** *** 89,93 **** CS_ASSERT(map_loaded == false); ! if (!loader->LoadMap(area)) return false; view = csPtr<iView>(new csView(engine, g3d)); --- 90,94 ---- CS_ASSERT(map_loaded == false); ! if (!loader->LoadMap(area, bl)) return false; view = csPtr<iView>(new csView(engine, g3d)); *************** *** 102,107 **** void ocDisplay::AddEntity(ocEntity* entity) { ! entity->SetMesh(new ocEntityMesh(entity, loader)); ! entity->GetMesh()->SetPosition(entity->GetPosition()); } --- 103,108 ---- void ocDisplay::AddEntity(ocEntity* entity) { ! loader->LoadEntity(entity, bl); ! entity->UpdateCelObjectPosition(); } *************** *** 267,272 **** ocEntity* entity = (ocEntity*) obj; ! if (entity->GetMesh()) ! entity->GetMesh()->SetPosition(entity->GetPosition()); if (entity == display->player->GetAvatar()) --- 268,272 ---- ocEntity* entity = (ocEntity*) obj; ! entity->UpdateCelObjectPosition(); if (entity == display->player->GetAvatar()) Index: ocdisplay.h =================================================================== RCS file: /cvsroot/once/oncecode/src/client/ocdisplay.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ocdisplay.h 16 Jun 2004 16:08:10 -0000 1.16 --- ocdisplay.h 26 Jul 2004 11:49:56 -0000 1.17 *************** *** 43,49 **** csRef<iVFS> vfs; csRef<iEngine> engine; - ocLoader* loader; csRef<iGraphics3D> g3d; csRef<iView> view; bool enabled; /* The display is required to draw stuff */ --- 43,50 ---- csRef<iVFS> vfs; csRef<iEngine> engine; csRef<iGraphics3D> g3d; csRef<iView> view; + ocLoader* loader; + ocBehaviourLayer* bl; bool enabled; /* The display is required to draw stuff */ |
From: Remi Bonnet <elscouta@us...> - 2004-07-26 11:50:07
|
Update of /cvsroot/once/oncecode/src/server/behaviours In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21100/src/server/behaviours Added Files: ocarea_bl.cpp ocarea_bl.h ocplayer_bl.cpp ocplayer_bl.h Log Message: New step towards cel. Look at history.txt for details. Sorry for ghost dirs/files. --- NEW FILE: ocplayer_bl.cpp --- /* * ocbl_player.cpp * Copyright (C) 2003-2004 by The Once developement team * * 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 "config.h" #include "physicallayer/pl.h" #include "server/behaviours/ocplayer_bl.h" const char* ocPlayerBehaviour::ocClassName = "ocPlayerBehaviour"; csStringID ocPlayerBehaviour::id_pckeyinput_forward_on; csStringID ocPlayerBehaviour::id_pckeyinput_forward_off; csStringID ocPlayerBehaviour::id_pckeyinput_backward_on; csStringID ocPlayerBehaviour::id_pckeyinput_backward_off; csStringID ocPlayerBehaviour::id_pckeyinput_rotate_left_on; csStringID ocPlayerBehaviour::id_pckeyinput_rotate_left_off; csStringID ocPlayerBehaviour::id_pckeyinput_rotate_right_on; csStringID ocPlayerBehaviour::id_pckeyinput_rotate_right_off; ocPlayerBehaviour::ocPlayerBehaviour(ocBehaviourLayer* bl) : ocBehaviourBase(bl) { } ocPlayerBehaviour::~ocPlayerBehaviour() { } void ocPlayerBehaviour::RegisterStringIDs(iCelPlLayer* pl) { /* C macros are pure fun ^_^ */ #define FETCH_ID(id) \ id_pckeyinput_##id##_on = pl->FetchStringID ("pckeyinput_" #id "1"); \ id_pckeyinput_##id##_off = pl->FetchStringID ("pckeyinput_" #id "0"); FETCH_ID(forward); FETCH_ID(backward); FETCH_ID(rotate_left); FETCH_ID(rotate_right); #undef FETCH_ID } bool ocPlayerBehaviour::SendMessageID(csStringID msg_id, celData& ret, iCelParameterBlock* params, va_list args) { return false; } --- NEW FILE: ocplayer_bl.h --- /* * ocplayer_bl.h * Copyright (C) 2003-2004 by The Once developement team * * 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 */ #ifndef OCBL_PLAYER_H #define OCBL_PLAYER_H #include "server/ocbl.h" class ocPlayerBehaviour : public ocBehaviourBase { private: /** All the IDs */ static csStringID id_pckeyinput_forward_on; static csStringID id_pckeyinput_forward_off; static csStringID id_pckeyinput_backward_on; static csStringID id_pckeyinput_backward_off; static csStringID id_pckeyinput_rotate_left_on; static csStringID id_pckeyinput_rotate_left_off; static csStringID id_pckeyinput_rotate_right_on; static csStringID id_pckeyinput_rotate_right_off; public: /** Constructor. Do nothing */ ocPlayerBehaviour(ocBehaviourLayer* bl); /** Destructor. Do nothing */ virtual ~ocPlayerBehaviour(); /** Class name. Used by behaviour factory. */ static const char* ocClassName; /** A factory func. Used by behaviour factory. */ static ocBehaviourBase* ocCreateInstance(ocBehaviourLayer* bl) { return new ocPlayerBehaviour(bl); } /** Register all the string IDs. This function must be called once, before * any object is created. */ static void RegisterStringIDs(iCelPlLayer* pl); /** Receives messages. */ virtual bool SendMessageID(csStringID msg_id, celData& ret, iCelParameterBlock* params, va_list args); /** Returns name. */ virtual const char* GetName() const { return ocClassName; } }; #endif --- NEW FILE: ocarea_bl.h --- /* * ocarea_bl.h * Copyright (C) 2003-2004 by The Once developement team * * 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 */ #ifndef OCBL_LEVEL_H #define OCBL_LEVEL_H #include "server/ocbl.h" class ocAreaBehaviour : public ocBehaviourBase { public: /** Constructor */ ocAreaBehaviour(ocBehaviourLayer* bl); /** Destructor */ ~ocAreaBehaviour(); /** Class name. Used by behaviour factory. */ static const char* ocClassName; /** A factory func. Used by behaviour factory. */ static ocBehaviourBase* ocCreateInstance(ocBehaviourLayer* bl) { return new ocAreaBehaviour(bl); } /** Receives messages. */ virtual bool SendMessageID(csStringID msg_id, celData& ret, iCelParameterBlock* params, va_list args); /** Returns name. */ virtual const char* GetName() const { return ocClassName; } }; #endif --- NEW FILE: ocarea_bl.cpp --- /* * ocarea_bl.cpp * Copyright (C) 2003-2004 by The Once developement team * * 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 "config.h" #include "physicallayer/pl.h" #include "server/behaviours/ocarea_bl.h" const char* ocAreaBehaviour::ocClassName = "ocAreaBehaviour"; ocAreaBehaviour::ocAreaBehaviour(ocBehaviourLayer* bl) : ocBehaviourBase(bl) { } ocAreaBehaviour::~ocAreaBehaviour() { } bool ocAreaBehaviour::SendMessageID(csStringID msg_id, celData& ret, iCelParameterBlock* params, va_list args) { return false; } |
From: Remi Bonnet <elscouta@us...> - 2004-07-26 11:50:06
|
Update of /cvsroot/once/oncecode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21100 Modified Files: ocserver.cfg occlient.cfg SConstruct Log Message: New step towards cel. Look at history.txt for details. Sorry for ghost dirs/files. Index: SConstruct =================================================================== RCS file: /cvsroot/once/oncecode/SConstruct,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SConstruct 24 Jul 2004 19:20:00 -0000 1.3 --- SConstruct 26 Jul 2004 11:49:56 -0000 1.4 *************** *** 36,43 **** # Some defines that won't change often: ! SOURCE_DIRS_COMMON=['common/', 'common/bl/'] SOURCE_DIRS_CLIENT=['client/'] SOURCE_DIRS_CLIENT.extend(SOURCE_DIRS_COMMON); ! SOURCE_DIRS_SERVER=['server/'] SOURCE_DIRS_SERVER.extend(SOURCE_DIRS_COMMON); --- 36,43 ---- # Some defines that won't change often: ! SOURCE_DIRS_COMMON=['common/'] SOURCE_DIRS_CLIENT=['client/'] SOURCE_DIRS_CLIENT.extend(SOURCE_DIRS_COMMON); ! SOURCE_DIRS_SERVER=['server/', 'server/behaviours/'] SOURCE_DIRS_SERVER.extend(SOURCE_DIRS_COMMON); Index: ocserver.cfg =================================================================== RCS file: /cvsroot/once/oncecode/ocserver.cfg,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ocserver.cfg 25 Jul 2004 16:37:25 -0000 1.16 --- ocserver.cfg 26 Jul 2004 11:49:54 -0000 1.17 *************** *** 40,42 **** Server.Database.Port=0 ! Once.EntityConfig = /this/server_data/entity.cfg --- 40,42 ---- Server.Database.Port=0 ! Once.EntityConfig = /this/server_data/entities/entity.cfg Index: occlient.cfg =================================================================== RCS file: /cvsroot/once/oncecode/occlient.cfg,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** occlient.cfg 25 Jul 2004 16:37:25 -0000 1.13 --- occlient.cfg 26 Jul 2004 11:49:56 -0000 1.14 *************** *** 37,40 **** Video.OpenGL.ClipOptional = SNP ! Once.EntityConfig = /this/client_data/entity.cfg --- 37,40 ---- Video.OpenGL.ClipOptional = SNP ! Once.EntityConfig = /once/content/global/entity.cfg |
From: Remi Bonnet <elscouta@us...> - 2004-07-26 11:50:06
|
Update of /cvsroot/once/oncecode/server_data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21100/server_data Removed Files: entity.cfg Log Message: New step towards cel. Look at history.txt for details. Sorry for ghost dirs/files. --- entity.cfg DELETED --- |
From: Remi Bonnet <elscouta@us...> - 2004-07-26 11:50:05
|
Update of /cvsroot/once/oncecode/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21100/docs Modified Files: history.txt Log Message: New step towards cel. Look at history.txt for details. Sorry for ghost dirs/files. Index: history.txt =================================================================== RCS file: /cvsroot/once/oncecode/docs/history.txt,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** history.txt 25 Jul 2004 16:37:25 -0000 1.156 --- history.txt 26 Jul 2004 11:49:56 -0000 1.157 *************** *** 4,7 **** --- 4,18 ---- The history order is reversed so that new features are at the top. + 26-July-2004 + - Remi made a new step towards cel: + - Reorgarnized files. Now server and client doesn't share any more behaviours + or behaviour layer. Design behind this is that client behaviour will only + send messages to server while server behaviours will do real management. + - Removed ocEntityMesh. We now keep directly an iCelEntity* in the ocEntity. + The compatibility hacks have been moved from ocEntityMesh to ocEntity and + ocEntityState. + - Added some checks to prevent server crashes if behaviours can't be loaded. + Client still crashes if any file is missing. + 25-July-2004 - Remi made the first serious move towards cel. Some code is now broken and a |
From: Remi Bonnet <elscouta@us...> - 2004-07-26 06:11:46
|
Update of /cvsroot/once/oncecode/server_data/entities In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5771/entities Log Message: Directory /cvsroot/once/oncecode/server_data/entities added to the repository |
From: Remi Bonnet <elscouta@us...> - 2004-07-25 17:24:21
|
Update of /cvsroot/once/oncecode/src/server/behaviours In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16559/behaviours Log Message: Directory /cvsroot/once/oncecode/src/server/behaviours added to the repository |
From: Remi Bonnet <elscouta@us...> - 2004-07-25 16:37:38
|
Update of /cvsroot/once/oncecode/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8746/src/common Modified Files: ocappearance.cpp ocappearance.h ocapplication.cpp ocapplication.h ocarea.cpp ocarea.h ocentity.h ocentitymesh.cpp ocfactory.cpp ocfactory.h ocidentifier.h ocloader.cpp ocloader.h Log Message: First serious move towards cel. Lots of code is now broken or incoherent. /full_load -> connect -> move around should still work though. Index: ocentity.h =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocentity.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ocentity.h 5 Jul 2004 10:17:53 -0000 1.24 --- ocentity.h 25 Jul 2004 16:37:26 -0000 1.25 *************** *** 197,217 **** /// Set iocEntityMesh object void SetMesh(iocEntityMesh* em) { delete mesh; mesh = em; } - /// Set 3D Appearance, as a normal mesh - void Set3DMeshAppearance(csString path) - { - appear.has_3d = true; - appear.path_3d = path; - appear.UpdateObjectName(); - Changed(); - } - /** Set 3D appearance, as a box thing mesh */ - void Set3DBoxAppearance(float x, float y, float z) - { - appear.has_3d = true; - appear.x_size = x; - appear.y_size = y; - appear.z_size = z; - Changed(); - } /// Get the server state --- 197,200 ---- Index: ocentitymesh.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocentitymesh.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ocentitymesh.cpp 24 Jul 2004 11:29:10 -0000 1.7 --- ocentitymesh.cpp 25 Jul 2004 16:37:26 -0000 1.8 *************** *** 28,31 **** --- 28,35 ---- #include "imesh/object.h" + #include "physicallayer/pl.h" + #include "physicallayer/propclas.h" + #include "propclass/mesh.h" + #include "common/occontentfile.h" #include "common/ocarea.h" *************** *** 38,78 **** ocEntityMesh::ocEntityMesh(ocEntity *e, ocLoader* loader) { - engine = loader->GetEngine(); ocAppearance* appear = e->GetAppearance(); ! CS_ASSERT(appear->Has3DAppearance()); ! ! iSector* sector = e->GetCurrentArea()->GetSector(); ! csString name = appear->Get3DObjectName(); ! ! csRef<iMeshFactoryWrapper> fact = loader->GetMeshFactory(appear); ! ! /* If we found a factory, that means we can create the mesh, if not, we ! * fall back on a mesh thing */ ! if (fact) ! { ! mesh = loader->GetEngine()->CreateMeshWrapper(fact, name, sector, ! e->GetPosition()); ! CS_ASSERT(mesh != 0); ! } ! else ! { ! mesh = loader->GetEngine()->CreateThingMesh(sector, name); ! ! csRef<iThingState> thing; ! thing = SCF_QUERY_INTERFACE(mesh->GetMeshObject(), iThingState); ! ! csRef<iThingFactoryState> fact = thing->GetFactory(); ! csBox3 box = appear->Get3DMeshBox(); ! ! fact->AddOutsideBox(box.Min(), box.Max()); ! fact->SetPolygonMaterial(csPolygonRange(0, fact->GetPolygonCount()), ! loader->GetTransparentMaterial()); ! ! mesh->SetZBufMode(CS_ZBUF_TEST); ! mesh->SetRenderPriority(4); ! mesh->SetFlagsRecursive(CS_ENTITY_INVISIBLE, CS_ENTITY_INVISIBLE); ! SetPosition(e->GetPosition()); ! } csVector3 center, rad; --- 42,50 ---- ocEntityMesh::ocEntityMesh(ocEntity *e, ocLoader* loader) { ocAppearance* appear = e->GetAppearance(); ! csRef<iCelEntity> celentity = loader->GetEntity(appear); ! csRef<iPcMesh> celmesh = CEL_QUERY_PROPCLASS_ENT(celentity, iPcMesh); ! mesh = celmesh->GetMesh(); csVector3 center, rad; *************** *** 89,94 **** ocEntityMesh::~ocEntityMesh() { ! bool was_deleted = engine->GetMeshes()->Remove(mesh); ! CS_ASSERT(was_deleted); } --- 61,66 ---- ocEntityMesh::~ocEntityMesh() { ! // @@@@ We don't free the mesh. Yeah, that's bad(tm). But only cel entity ! // can do this correctly, and we have lost all refs to it in constructor } Index: ocapplication.h =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocapplication.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ocapplication.h 24 Jul 2004 11:29:10 -0000 1.1 --- ocapplication.h 25 Jul 2004 16:37:26 -0000 1.2 *************** *** 21,27 **** #include "iutil/vfs.h" struct iVFS; ! struct iConfigManager; struct iGraphics2D; struct iGraphics3D; --- 21,34 ---- #include "iutil/vfs.h" + #include "iutil/document.h" + #include "iengine/engine.h" + + #include "physicallayer/pl.h" + #include "tools/entityloader.h" + + #include "common/bl/ocbl.h" struct iVFS; ! struct iConfigManager; struct iGraphics2D; struct iGraphics3D; *************** *** 64,67 **** --- 71,75 ---- csRef<iCelPlLayer> pl; csRef<iDocumentSystem> ds; + csRef<iEntityLoader> entity_loader; /// Behaviour layer *************** *** 103,108 **** --- 111,126 ---- /** Returns content dir tree */ ocContentDirTree* GetContentTree() { return content_tree; } + /** Returns behaviour layer */ + csRef<ocBehaviourLayer> GetBehaviourLayer() { return bl; } /** Returns VFS plugin */ csRef<iVFS> GetVFS() { return vfs; } + /** Returns document system plugin */ + csRef<iDocumentSystem> GetDocumentSystem() { return ds; } + /** Returns the engine */ + csRef<iEngine> GetEngine() { return engine; } + /** Returns physical layer plugin */ + csRef<iCelPlLayer> GetPhysicalLayer() { return pl; } + /** Returns CEL entity loader */ + csRef<iEntityLoader> GetEntityLoader() { return entity_loader; } }; Index: ocarea.h =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocarea.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ocarea.h 16 Jun 2004 16:08:10 -0000 1.11 --- ocarea.h 25 Jul 2004 16:37:26 -0000 1.12 *************** *** 21,28 **** #define OCAREA_H #include "common/ocidentifier.h" #include "common/occhangenumber.h" #include "common/ocserialize.h" - #include "csutil/csstring.h" #include "common/ocsubscription.h" --- 21,32 ---- #define OCAREA_H + #include "csutil/csstring.h" + + #include "physicallayer/pl.h" + #include "physicallayer/entity.h" + #include "common/ocidentifier.h" #include "common/occhangenumber.h" #include "common/ocserialize.h" #include "common/ocsubscription.h" *************** *** 30,33 **** --- 34,38 ---- struct iRegion; struct iEngine; + struct iPcRegion; class ocAreaState; *************** *** 55,60 **** ocAreaState *svrstate; ! /** Region containing all the objects of the area */ ! iRegion* region; public: --- 60,65 ---- ocAreaState *svrstate; ! /** The CEL object, implementing iPcRegion */ ! csRef<iCelEntity> celobject; public: *************** *** 81,90 **** {subscriberlist.RemoveSubscriber(sub);} ! /// Set the region ! void SetRegion(iRegion* r) { region = r; } ! /// Get a region containing the sector of this area ! iRegion* GetRegion() { return region; } ! /// Get the sector of this area iSector* GetSector(); /// get identifier for area --- 86,99 ---- {subscriberlist.RemoveSubscriber(sub);} ! /// Set the cel object associated to the area. Done when LoadMap is called ! /// on this area. ! void SetCelObject(csRef<iCelEntity> o) { celobject = o; } ! /// Get the cel object of this area ! csRef<iCelEntity> GetCelObject() { return celobject; } ! /// Get the cel region of this area ! csRef<iPcRegion> GetCelRegion(); ! /// Get the cel sector of this area iSector* GetSector(); + /// get identifier for area Index: ocfactory.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocfactory.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ocfactory.cpp 24 Jul 2004 11:29:10 -0000 1.2 --- ocfactory.cpp 25 Jul 2004 16:37:26 -0000 1.3 *************** *** 25,46 **** #include "common/ocfactory.h" ! void ocBehaviourFactory::Register(int classtype, CreateFunc factory) ! { ! CS_ASSERT(hash.DeleteAll(classtype) == false); ! hash.Put(classtype, factory); ! } ! ! template<class T> void ocBehaviourFactory::RegClass() { ! const char* str = T::ocClassName; ! Register(CLASSTYPE_FROM_STRING(str), T::ocCreateInstance); } ! ocBehaviourBase* ocBehaviourFactory::CreateInstance(int t, ocBehaviourLayer* l) { ! CreateFunc factory = hash.Get(t, 0); if (!factory) return 0; ! return factory(l); } --- 25,41 ---- #include "common/ocfactory.h" ! void ocBehaviourFactory::Register(const char* classname, CreateFunc factory) { ! CS_ASSERT(hash.DeleteAll(classname) == false); ! hash.Put(classname, factory); } ! ocBehaviourBase* ocBehaviourFactory::CreateInstance(const char* classname, ! ocBehaviourLayer* layer) { ! CreateFunc factory = hash.Get(classname, 0); if (!factory) return 0; ! return factory(layer); } Index: ocidentifier.h =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocidentifier.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ocidentifier.h 18 Jul 2004 15:03:26 -0000 1.18 --- ocidentifier.h 25 Jul 2004 16:37:26 -0000 1.19 *************** *** 29,35 **** /// this macro makes an int from 4 characters #define CLASSTYPE(a,b,c,d) ((int(a)<<24)|(int(b)<<16)|(int(c)<<8)|int(d)) - /// this macro makes an int from a string. Only four first character are used - /// You should check the strings is more than 4 characters. - #define CLASSTYPE_FROM_STRING(str) (CLASSTYPE(str[0], str[1], str[2], str[3])) /** --- 29,32 ---- Index: ocfactory.h =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocfactory.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ocfactory.h 18 Jul 2004 15:05:03 -0000 1.1 --- ocfactory.h 25 Jul 2004 16:37:26 -0000 1.2 *************** *** 21,24 **** --- 21,26 ---- #include "csutil/hash.h" + #include "csutil/hashhandlers.h" + #include "common/ocidentifier.h" *************** *** 63,75 **** private: typedef ocBehaviourBase* (*CreateFunc) (ocBehaviourLayer*); ! csHash<CreateFunc> hash; public: /** Register a class */ ! void Register(int classtype, CreateFunc factory); /** Register helper for classes that have ocClassName and ocCreateInstance */ ! template<class T> void RegClass(); /** Create an instance of the class */ ! ocBehaviourBase* CreateInstance(int classtype, ocBehaviourLayer* layer); }; --- 65,80 ---- private: typedef ocBehaviourBase* (*CreateFunc) (ocBehaviourLayer*); ! csHash<CreateFunc, const char*, csConstCharHashKeyHandler> hash; public: /** Register a class */ ! void Register(const char* classname, CreateFunc factory); /** Register helper for classes that have ocClassName and ocCreateInstance */ ! template<class T> void RegClass() ! { ! Register(T::ocClassName, T::ocCreateInstance); ! } /** Create an instance of the class */ ! ocBehaviourBase* CreateInstance(const char* name, ocBehaviourLayer* layer); }; Index: ocapplication.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocapplication.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ocapplication.cpp 24 Jul 2004 11:29:10 -0000 1.1 --- ocapplication.cpp 25 Jul 2004 16:37:26 -0000 1.2 *************** *** 129,132 **** --- 129,146 ---- OC_QUERY_FOR_PLUGIN(csloader, iLoader); OC_QUERY_FOR_PLUGIN(ds, iDocumentSystem); + OC_QUERY_FOR_PLUGIN(entity_loader, iEntityLoader); + + // Load properties class + #define OC_QUERY_FOR_PROPCLASS(id) \ + if (!pl->LoadPropertyClassFactory("cel.pcfactory." id)) \ + { \ + Report(CS_REPORTER_SEVERITY_ERROR, "Can't load " id " property class " \ + "factory"); \ + return false; \ + } + OC_QUERY_FOR_PROPCLASS("region"); + OC_QUERY_FOR_PROPCLASS("mesh"); + OC_QUERY_FOR_PROPCLASS("solid"); + OC_QUERY_FOR_PROPCLASS("linmove"); // Load our mounts path *************** *** 154,158 **** // Create modules: Behaviour layer bl = new ocBehaviourLayer(pl); ! // Create modules: Serial Factory factory = new ocFactory<iSerial>(); --- 168,179 ---- // Create modules: Behaviour layer bl = new ocBehaviourLayer(pl); ! pl->RegisterBehaviourLayer(bl); ! if (!object_reg->Register(bl, "iCelBlLayer")) ! { ! Report(CS_REPORTER_SEVERITY_ERROR, "Can't register our behaviour layer " ! "to the object registry."); ! return false; ! } ! // Create modules: Serial Factory factory = new ocFactory<iSerial>(); *************** *** 165,169 **** // Create modules: Loader ! loader = new ocLoader(this, engine, csloader); // Create modules: Settings manager --- 186,197 ---- // Create modules: Loader ! const char* entity_config = cfg->GetStr("Once.EntityConfig", 0); ! if (entity_config == 0) ! { ! Report(CS_REPORTER_SEVERITY_ERROR, "Can't find required key " ! "'Once.EntityConfig' in config file."); ! return false; ! } ! loader = new ocLoader(this, entity_config); // Create modules: Settings manager Index: ocarea.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocarea.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ocarea.cpp 24 Jul 2004 11:29:10 -0000 1.13 --- ocarea.cpp 25 Jul 2004 16:37:26 -0000 1.14 *************** *** 24,27 **** --- 24,30 ---- #include "iengine/region.h" + #include "physicallayer/propclas.h" + #include "propclass/region.h" + #include "ocarea.h" *************** *** 36,40 **** subscriberlist.SetSubject(this); ! region = 0; } --- 39,43 ---- subscriberlist.SetSubject(this); ! celobject = 0; } *************** *** 47,51 **** svrstate = 0; subscriberlist.SetSubject(this); ! region = 0; } --- 50,54 ---- svrstate = 0; subscriberlist.SetSubject(this); ! celobject = 0; } *************** *** 62,71 **** area_name = a.area_name; svrstate = a.svrstate; ! region = a.region; } ocArea::~ocArea() { ! CS_ASSERT(region == 0); } --- 65,74 ---- area_name = a.area_name; svrstate = a.svrstate; ! celobject = a.celobject; } ocArea::~ocArea() { ! CS_ASSERT(celobject == 0); } *************** *** 98,103 **** } iSector* ocArea::GetSector() { ! return region->FindSector(GetName()); } --- 101,111 ---- } + csRef<iPcRegion> ocArea::GetCelRegion() + { + return CEL_QUERY_PROPCLASS_ENT(this->GetCelObject(), iPcRegion); + } + iSector* ocArea::GetSector() { ! return GetCelRegion()->FindSector(this->GetName()); } Index: ocappearance.h =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocappearance.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ocappearance.h 16 Jun 2004 16:08:10 -0000 1.14 --- ocappearance.h 25 Jul 2004 16:37:26 -0000 1.15 *************** *** 45,69 **** ocChangeNumber object_cn; ! /// appearance holds a 3d view ! bool has_3d; ! /// Type of the mesh. True mesh, or thing box? ! enum mesh_type type_3d; ! ! /** Object name. No need to know the file, all files being loaded when they ! * are received */ ! csString path_3d; ! ! /** Not serialized! */ ! csString object_name_3d; ! ! /** Until mesh is loaded, a coloured ovoid is shown. ! * On server, if mesh file is not available, these values are used to ! * create a collider box. */ ! float x_size, y_size, z_size; ! ! /// appearance holds a 2d view ! bool has_2d; ! /// 2d pixmap specification ! csString pixmap_file; public: --- 45,50 ---- ocChangeNumber object_cn; ! /// Object name ! csString object_name; public: *************** *** 73,94 **** static iSerial* ocCreateInstance() {return new ocAppearance;} ! /// Returns if the entity has a 3d appearance ! bool Has3DAppearance() ! { return has_3d; } ! ! /** Returns the type of the mesh */ ! enum mesh_type Get3DMeshType() { return type_3d; } ! ! /** Returns a box that can be used as a collider. */ ! csBox3 Get3DMeshBox(); ! ! /** Returns the name of the factory mesh */ ! csString Get3DObjectName(); ! ! /** Returns the path (relative to root node) of the 3d file */ ! csString Get3DVFSPath() { return path_3d; } ! /** Update the object name. Call this each time you change the path */ ! void UpdateObjectName(); //------- iSerial interface ------------------------- --- 54,62 ---- static iSerial* ocCreateInstance() {return new ocAppearance;} ! /** Hack for compatibility. */ ! csString GetObjectName() { return object_name; } ! /** Set the object name. */ ! void SetObjectName(csString name) { object_name = name; } //------- iSerial interface ------------------------- Index: ocloader.h =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocloader.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ocloader.h 24 Jul 2004 11:29:10 -0000 1.6 --- ocloader.h 25 Jul 2004 16:37:26 -0000 1.7 *************** *** 23,30 **** --- 23,36 ---- struct iLoader; struct iMeshFactoryWrapper; + struct iEntityLoader; + struct iDocumentSystem; + struct iDocumentNode; class ocAppearance; class ocArea; class ocAreaID; class ocApplication; + class ocBehaviourLayer; + + #include "csutil/hashhandlers.h" /** *************** *** 34,69 **** { private: ! csRef<iEngine> engine; ! csRef<iLoader> loader; /** Used as an interface to display messages about loading */ ocApplication* app; ! /** This is a pointer to a completely transparent texture (used for empty ! * colliders */ ! csRef<iMaterialWrapper> empty_material; public: /** Constructor: takes various plugins and modules as parameters */ ! ocLoader(ocApplication* app, csRef<iEngine> engine, csRef<iLoader> loader); ~ocLoader(); ! /** Load the map for given area. Will use iocOutput* to output * messages on console */ bool LoadMap(ocAreaID area); ! /** Return mesh factory for given filename. Will load it if required */ ! csRef<iMeshFactoryWrapper> GetMeshFactory(ocAppearance* appear); ! ! /** Load into the engine the mesh factory for the given file */ ! csRef<iMeshFactoryWrapper> LoadMeshFactory(ocAppearance* appear); ! ! /** Returns the engine */ ! csRef<iEngine> GetEngine() { return engine; } ! ! /** Returns a transparent texture */ ! csRef<iMaterialWrapper> GetTransparentMaterial(); ! ! /** Delete all the element presents in given region */ ! void FreeRegionArea(ocArea* area); }; --- 40,81 ---- { private: ! /** The cel physical layer */ ! csRef<iCelPlLayer> pl; ! /** The cel entity loader */ ! csRef<iEntityLoader> entity_loader; ! /** The CS document system */ ! csRef<iDocumentSystem> ds; ! /** Our behaviour layer */ ! csRef<ocBehaviourLayer> bl; ! ! /** Config file. We use our own config file for all the art specification. */ ! csRef<iConfigFile> config_file; /** Used as an interface to display messages about loading */ ocApplication* app; ! ! /** An hash from entity name to filename. */ ! csHash<csString, csStrKey, csConstCharHashKeyHandler> entity_files; ! ! private: ! /** Returns the file as an XML document */ ! csPtr<iDocument> LoadFileAsXML(const char* file); ! /** Returns the <entity> node of an XML document */ ! csPtr<iDocumentNode> GetEntityNodeInFile(const char* file); public: /** Constructor: takes various plugins and modules as parameters */ ! ocLoader(ocApplication* app, const char* config_file); ~ocLoader(); ! /** Load the map for given area. Will use ocApplication* to output * messages on console */ bool LoadMap(ocAreaID area); + /** Unload the map for given area. */ + void UnloadMap(ocArea* area); ! /** Return CEL entity for given appearance. The entity will be created in ! * given area. */ ! csRef<iCelEntity> GetEntity(ocAppearance* appear); }; Index: ocappearance.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocappearance.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ocappearance.cpp 24 Jul 2004 11:29:10 -0000 1.11 --- ocappearance.cpp 25 Jul 2004 16:37:26 -0000 1.12 *************** *** 29,37 **** ocAppearance::ocAppearance() { - has_3d = false; - x_size = 1; - y_size = 1; - z_size = 1; - has_2d = false; } --- 29,32 ---- *************** *** 51,61 **** { object_cn.Write(buf); ! buf.WriteBool(has_3d); ! buf.WriteString(path_3d); ! buf.WriteShortFloat(x_size); ! buf.WriteShortFloat(y_size); ! buf.WriteShortFloat(z_size); ! buf.WriteBool(has_2d); ! buf.WriteString(pixmap_file); } --- 46,50 ---- { object_cn.Write(buf); ! buf.WriteString(object_name); } *************** *** 63,100 **** { if(!object_cn.Read(buf)) return false; ! if(!buf.ReadBool(has_3d)) return false; ! if(!buf.ReadString(path_3d)) return false; ! if(!buf.ReadShortFloat(x_size)) return false; ! if(!buf.ReadShortFloat(y_size)) return false; ! if(!buf.ReadShortFloat(z_size)) return false; ! if(!buf.ReadBool(has_2d)) return false; ! if(!buf.ReadString(pixmap_file)) return false; ! ! UpdateObjectName(); return true; } - csBox3 ocAppearance::Get3DMeshBox() - { - csBox3 box; - box.SetCenter(csVector3(0,0,0)); - box.SetSize(csVector3(x_size, y_size, z_size)); - return box; - } - - csString ocAppearance::Get3DObjectName() - { - return object_name_3d; - } - - void ocAppearance::UpdateObjectName() - { - if (!ocContentDir::SplitBasename(path_3d, 0, &object_name_3d)) - object_name_3d = path_3d; - - /* @@@ This is wrong. Asserts shouldn't be triggered due to network - * messages */ - CS_ASSERT(ocContentDir::IsImmediateChildren(object_name_3d)); - CS_ASSERT(!ocContentDir::IsDir(object_name_3d)); - } --- 52,58 ---- { if(!object_cn.Read(buf)) return false; ! if(!buf.ReadString(object_name)) return false; return true; } Index: ocloader.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/common/ocloader.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ocloader.cpp 24 Jul 2004 11:29:10 -0000 1.12 --- ocloader.cpp 25 Jul 2004 16:37:26 -0000 1.13 *************** *** 26,30 **** #include "iengine/texture.h" #include "imap/loader.h" ! #include "csgfx/memimage.h" #include "common/ocapplication.h" --- 26,34 ---- #include "iengine/texture.h" #include "imap/loader.h" ! #include "csutil/cfgfile.h" ! ! #include "physicallayer/pl.h" ! #include "physicallayer/propclas.h" ! #include "propclass/region.h" #include "common/ocapplication.h" *************** *** 36,92 **** #include "common/ocloader.h" ! ocLoader::ocLoader(ocApplication* _app, csRef<iEngine> _engine, ! csRef<iLoader> _loader) { app = _app; ! engine = _engine; ! loader = _loader; ! csImageMemory* csimage = new csImageMemory(1, 1); ! csimage->Clear(csRGBpixel(0, 0, 0, 0)); ! csRef<iTextureWrapper> empty_texture; ! empty_texture = engine->CreateBlackTexture("transparent", 1, 1, ! new csColor(0, 0, 0), ! CS_TEXTURE_3D); ! empty_texture->SetImageFile(csimage); ! empty_material = engine->CreateMaterial("transparent", empty_texture); } ! ocLoader::~ocLoader() { } bool ocLoader::LoadMap(ocAreaID area) { - csString path = app->GetContentTree()->GetRootPath(area, "world"); - csString msg; ! msg.Format("Loading map %s (please wait)...", path.GetData()); app->ForceMessage(msg); csString dir_path = app->GetContentTree()->GetAreaDir(area)->GetVFSPath(); - app->GetVFS()->ChDir(dir_path); ! iRegion* region = engine->CreateRegion(area->GetName()); ! area->SetRegion(region); ! /* We don't clean the engine, textures and entites have been preloaded */ ! if (!loader->LoadMapFile(path, false, region)) { ! app->PrintMessage("\nCan't load map %s.\n", path.GetData()); return false; } ! if (!area->GetSector()) { ! app->PrintMessage("\nCan't find sector in world file %s.\n", ! path.GetData()); return false; } - - app->ForceMessage("..."); ! engine->Prepare(); ! app->ForceMessage("...\n"); --- 40,117 ---- #include "common/ocloader.h" ! ocLoader::ocLoader(ocApplication* _app, const char* config_file_path) { app = _app; ! pl = app->GetPhysicalLayer(); ! ds = app->GetDocumentSystem(); ! bl = app->GetBehaviourLayer(); ! entity_loader = app->GetEntityLoader(); ! config_file = new csConfigFile(config_file_path, app->GetVFS()); ! } ! ocLoader::~ocLoader() ! { ! } ! csPtr<iDocument> ocLoader::LoadFileAsXML(const char* path) ! { ! csRef<iDocument> doc = ds->CreateDocument(); ! ! csRef<iDataBuffer> buf = app->GetVFS()->ReadFile(path); ! if (!buf) ! { ! app->PrintMessage("Couldn't load XML file '%s'!\n", path); ! return 0; ! } ! ! const char* error = doc->Parse(buf); ! if (error != 0) ! { ! app->PrintMessage("XML parser error for file '%s': %s!\n", path, error); ! return 0; ! } ! ! return csPtr<iDocument>(doc); } ! csPtr<iDocumentNode> ocLoader::GetEntityNodeInFile(const char* file) { + csRef<iDocument> doc = LoadFileAsXML(file); + return csPtr<iDocumentNode>(doc->GetRoot()->GetNode("entity")); } bool ocLoader::LoadMap(ocAreaID area) { csString msg; ! msg.Format("Loading map (please wait)..."); app->ForceMessage(msg); csString dir_path = app->GetContentTree()->GetAreaDir(area)->GetVFSPath(); ! csRef<iCelEntity> celobject = pl->CreateEntity("area", bl, "ocAreaBehaviour", ! "pcregion", 0); ! area->SetCelObject(celobject); ! csRef<iPcRegion> pcregion = CEL_QUERY_PROPCLASS_ENT(celobject, iPcRegion); ! pcregion->SetRegionName(area->GetName()); ! pcregion->SetWorldFile(dir_path, "world"); ! ! if (!pcregion->Load()) ! { ! app->PrintMessage("\nUnable to load map file.\n"); ! UnloadMap(area); return false; } + app->ForceMessage("..."); ! if (area->GetSector() == 0) ! { ! app->PrintMessage("\nCan't find area sector in world file.\n"); ! UnloadMap(area); return false; } ! app->GetEngine()->Prepare(); app->ForceMessage("...\n"); *************** *** 94,138 **** } ! csRef<iMeshFactoryWrapper> ocLoader::GetMeshFactory(ocAppearance* appear) ! { ! csRef<iMeshFactoryWrapper> factory; ! factory = engine->FindMeshFactory(appear->Get3DObjectName()); ! if (factory) return factory; ! ! factory = LoadMeshFactory(appear); ! return factory; ! } ! ! csRef<iMeshFactoryWrapper> ocLoader::LoadMeshFactory(ocAppearance* appear) { ! csRef<iMeshFactoryWrapper> factory; ! csString path = app->GetContentTree()->GetRootPath(appear->Get3DVFSPath()); ! factory = loader->LoadMeshObjectFactory(path); ! if (!factory) { ! app->PrintMessage("Error: Unable to load mesh factory %s\n", ! path.GetData()); return 0; } ! factory->QueryObject()->SetName(appear->Get3DObjectName()); ! ! return factory; ! } ! csRef<iMaterialWrapper> ocLoader::GetTransparentMaterial() ! { ! return empty_material; } ! void ocLoader::FreeRegionArea(ocArea* area) { ! if (area->GetRegion() == 0) return; ! iRegion* region = area->GetRegion(); ! region->DeleteAll(); ! engine->GetRegions()->Remove(region); ! area->SetRegion(0); } --- 119,160 ---- } ! csRef<iCelEntity> ocLoader::GetEntity(ocAppearance* appear) { ! csString objectname = appear->GetObjectName(); ! const char* vfspath = config_file->GetStr("Entity." + objectname, 0); ! if (!vfspath) ! { ! app->PrintMessage("Can't find object %s specifications in art.cfg.\n", ! objectname.GetData()); ! return 0; ! } ! csRef<iDocumentNode> entity_node = GetEntityNodeInFile(vfspath); ! if (!entity_node) { ! app->PrintMessage("Can't parse entity file %s.\n", vfspath); return 0; } ! csRef<iCelEntity> entity = entity_loader->Load(entity_node); ! if (!entity) ! { ! app->PrintMessage("Error loading entity file %s.\n", vfspath); ! return 0; ! } ! return csPtr<iCelEntity>(entity); } ! void ocLoader::UnloadMap(ocArea* area) { ! csRef<iCelEntity> celentity = area->GetCelObject(); ! if (!celentity) return; ! csRef<iPcRegion> pcregion = CEL_QUERY_PROPCLASS_ENT(celentity, iPcRegion); ! pcregion->Unload(); ! ! pl->RemoveEntity(celentity); ! area->SetCelObject(0); } |
From: Remi Bonnet <elscouta@us...> - 2004-07-25 16:37:37
|
Update of /cvsroot/once/oncecode/server_data/common/global In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8746/server_data/common/global Modified Files: races.def Added Files: dwarf.xml Log Message: First serious move towards cel. Lots of code is now broken or incoherent. /full_load -> connect -> move around should still work though. Index: races.def =================================================================== RCS file: /cvsroot/once/oncecode/server_data/common/global/races.def,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** races.def 12 Jul 2004 19:49:50 -0000 1.1 --- races.def 25 Jul 2004 16:37:27 -0000 1.2 *************** *** 7,11 **** <id>0</id> <name>Dwarf</name> ! <model>global/door.xml</model> <x_size>1</x_size> <y_size>1</y_size> --- 7,11 ---- <id>0</id> <name>Dwarf</name> ! <model>Dwarf</model> <x_size>1</x_size> <y_size>1</y_size> --- NEW FILE: dwarf.xml --- <entity> <behaviour name="ocPlayerBehaviour" /> <propclass name="pcmesh"> <action name="LoadMesh"> <!-- This is the modelfile to use for this creature (name of a mesh factory file). --> <par name="filename" string="/once/content/global/door.xml" /> <!-- Name of the factory as specified in the model file. This MUST be equal to the name that is given to the 'meshfact' there. --> <par name="factoryname" string="door" /> </action> </propclass> </entity> |