Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 336 vs 337 for /trunk/Source Code/Scenes/WarScene/WarScene.cpp

Diff revisions: vs.
  @@ -83,12 +83,12 @@
83 83 if(_sunAngle.y <= RADIANS(25) || _sunAngle.y >= RADIANS(70))
84 84 direction = !direction;
85 85
86 - _sunvector = vec3<F32>( -cosf(_sunAngle.x) * sinf(_sunAngle.y),
86 + _sunvector = vec3<F32>( -cosf(_sunAngle.x) * sinf(_sunAngle.y),
87 87 -cosf(_sunAngle.y),
88 88 -sinf(_sunAngle.x) * sinf(_sunAngle.y));
89 89
90 90 _sun->setDirection(_sunvector);
91 - _currentSky->getNode<Sky>()->setSunProperties(_sunvector, _sun->getDiffuseColor());
91 + _currentSky->getNode<Sky>()->setSunProperties(_sunvector, _sun->getDiffuseColor());
92 92
93 93 D32 BobTimer = getSecToMs(5);
94 94 D32 DwarfTimer = getSecToMs(8);
  @@ -226,9 +226,9 @@
226 226 //Load scene resources
227 227 bool loadState = SCENE_LOAD(name,cameraMgr,gui,true,true);
228 228 //Add a light
229 - _sun = addLight(LIGHT_TYPE_DIRECTIONAL)->getNode<DirectionalLight>();
229 + _sun = addLight(LIGHT_TYPE_DIRECTIONAL)->getNode<DirectionalLight>();
230 230 //Add a skybox
231 - _currentSky = addSky(CreateResource<Sky>(ResourceDescriptor("Default Sky")));
231 + _currentSky = addSky(CreateResource<Sky>(ResourceDescriptor("Default Sky")));
232 232 //Position camera
233 233 renderState().getCamera().setEye(vec3<F32>(54.5f, 25.5f, 1.5f));
234 234 renderState().getCamera().setGlobalRotation(-90/*yaw*/,35/*pitch*/);
  @@ -356,14 +356,14 @@
356 356 #endif
357 357 particleSystem._spread = 5.0f;
358 358
359 - SceneGraphNode* testSGN = addParticleEmitter( "TESTPARTICLES", particleSystem, _sceneGraph->getRoot() );
360 - ParticleEmitter* test = testSGN->getNode<ParticleEmitter>();
359 + SceneGraphNode* testSGN = addParticleEmitter( "TESTPARTICLES", particleSystem, _sceneGraph->getRoot() );
360 + ParticleEmitter* test = testSGN->getNode<ParticleEmitter>();
361 361 testSGN->getComponent<PhysicsComponent>()->translateY(5);
362 362 test->setDrawImpostor(true);
363 363 test->enableEmitter(true);
364 364
365 - state().getGeneralVisibility() *= 2;
366 - Application::getInstance().getKernel()->getCameraMgr().getActiveCamera()->setHorizontalFoV(135);
365 + state().getGeneralVisibility() *= 2;
366 + Application::getInstance().getKernel()->getCameraMgr().getActiveCamera()->setHorizontalFoV(135);
367 367
368 368 _sceneReady = true;
369 369 return loadState;
  @@ -396,48 +396,48 @@
396 396 SceneNode* currentMesh = nullptr;
397 397 SceneGraphNode* currentNode = nullptr;
398 398
399 - AI::ApproachFlag approachEnemyFlag("ApproachEnemyFlag");
400 - approachEnemyFlag.setPrecondition(AI::GOAPFact(AI::AtEnemyFlagLoc), AI::GOAPValue(false));
401 - approachEnemyFlag.setPrecondition(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(false));
402 - approachEnemyFlag.setEffect(AI::GOAPFact(AI::AtEnemyFlagLoc), AI::GOAPValue(true));
403 - approachEnemyFlag.setEffect(AI::GOAPFact(AI::AtHomeFlagLoc), AI::GOAPValue(false));
399 + AI::ApproachFlag approachEnemyFlag("ApproachEnemyFlag");
400 + approachEnemyFlag.setPrecondition(AI::GOAPFact(AI::AtEnemyFlagLoc), AI::GOAPValue(false));
401 + approachEnemyFlag.setPrecondition(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(false));
402 + approachEnemyFlag.setEffect(AI::GOAPFact(AI::AtEnemyFlagLoc), AI::GOAPValue(true));
403 + approachEnemyFlag.setEffect(AI::GOAPFact(AI::AtHomeFlagLoc), AI::GOAPValue(false));
404 404
405 405 AI::CaptureFlag captureEnemyFlag("CaptureEnemyFlag");
406 - captureEnemyFlag.setPrecondition(AI::GOAPFact(AI::AtEnemyFlagLoc), AI::GOAPValue(true));
407 - captureEnemyFlag.setPrecondition(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(false));
408 - captureEnemyFlag.setEffect(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(true));
406 + captureEnemyFlag.setPrecondition(AI::GOAPFact(AI::AtEnemyFlagLoc), AI::GOAPValue(true));
407 + captureEnemyFlag.setPrecondition(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(false));
408 + captureEnemyFlag.setEffect(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(true));
409 409
410 - AI::ReturnHome returnHome("ReturnHome");
411 - returnHome.setPrecondition(AI::GOAPFact(AI::AtHomeFlagLoc), AI::GOAPValue(false));
412 - returnHome.setEffect(AI::GOAPFact(AI::AtHomeFlagLoc), AI::GOAPValue(true));
413 - returnHome.setEffect(AI::GOAPFact(AI::AtEnemyFlagLoc), AI::GOAPValue(false));
410 + AI::ReturnHome returnHome("ReturnHome");
411 + returnHome.setPrecondition(AI::GOAPFact(AI::AtHomeFlagLoc), AI::GOAPValue(false));
412 + returnHome.setEffect(AI::GOAPFact(AI::AtHomeFlagLoc), AI::GOAPValue(true));
413 + returnHome.setEffect(AI::GOAPFact(AI::AtEnemyFlagLoc), AI::GOAPValue(false));
414 414
415 415 AI::ReturnFlag returnEnemyFlag("ReturnEnemyFlag");
416 - returnEnemyFlag.setPrecondition(AI::GOAPFact(AI::AtHomeFlagLoc), AI::GOAPValue(true));
417 - returnEnemyFlag.setPrecondition(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(true));
418 - returnEnemyFlag.setEffect(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(false));
419 -
420 - AI::RecoverFlag recoverFlag("RecoverOwnFlag");
421 - recoverFlag.setPrecondition(AI::GOAPFact(AI::EnemyDead), AI::GOAPValue(true));
422 - recoverFlag.setPrecondition(AI::GOAPFact(AI::EnemyHasFlag), AI::GOAPValue(false));
423 - recoverFlag.setEffect(AI::GOAPFact(AI::HasOwnFlag), AI::GOAPValue(true));
424 -
425 - AI::KillEnemy killEnemy("KillEnemy");
426 - recoverFlag.setPrecondition(AI::GOAPFact(AI::EnemyDead), AI::GOAPValue(false));
427 - recoverFlag.setEffect(AI::GOAPFact(AI::EnemyDead), AI::GOAPValue(true));
416 + returnEnemyFlag.setPrecondition(AI::GOAPFact(AI::AtHomeFlagLoc), AI::GOAPValue(true));
417 + returnEnemyFlag.setPrecondition(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(true));
418 + returnEnemyFlag.setEffect(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(false));
419 +
420 + AI::RecoverFlag recoverFlag("RecoverOwnFlag");
421 + recoverFlag.setPrecondition(AI::GOAPFact(AI::EnemyDead), AI::GOAPValue(true));
422 + recoverFlag.setPrecondition(AI::GOAPFact(AI::EnemyHasFlag), AI::GOAPValue(false));
423 + recoverFlag.setEffect(AI::GOAPFact(AI::HasOwnFlag), AI::GOAPValue(true));
424 +
425 + AI::KillEnemy killEnemy("KillEnemy");
426 + recoverFlag.setPrecondition(AI::GOAPFact(AI::EnemyDead), AI::GOAPValue(false));
427 + recoverFlag.setEffect(AI::GOAPFact(AI::EnemyDead), AI::GOAPValue(true));
428 428
429 429 AI::GOAPGoal findFlag("Find enemy flag");
430 - findFlag.setVariable(AI::GOAPFact(AI::AtEnemyFlagLoc), AI::GOAPValue(true));
430 + findFlag.setVariable(AI::GOAPFact(AI::AtEnemyFlagLoc), AI::GOAPValue(true));
431 431
432 432 AI::GOAPGoal captureFlag("Capture enemy flag");
433 - captureFlag.setVariable(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(true));
433 + captureFlag.setVariable(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(true));
434 434
435 435 AI::GOAPGoal returnFlag("Return enemy flag");
436 - captureFlag.setVariable(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(true));
437 - captureFlag.setVariable(AI::GOAPFact(AI::AtHomeFlagLoc), AI::GOAPValue(true));
436 + captureFlag.setVariable(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(true));
437 + captureFlag.setVariable(AI::GOAPFact(AI::AtHomeFlagLoc), AI::GOAPValue(true));
438 438
439 439 AI::GOAPGoal retrieveFlag("Retrieve flag");
440 - retrieveFlag.setVariable(AI::GOAPFact(AI::HasOwnFlag), AI::GOAPValue(true));
440 + retrieveFlag.setVariable(AI::GOAPFact(AI::HasOwnFlag), AI::GOAPValue(true));
441 441 retrieveFlag.setVariable(AI::GOAPFact(AI::AtHomeFlagLoc), AI::GOAPValue(true));
442 442
443 443 for(U8 k = 0; k < 2; ++k) {
  @@ -486,24 +486,24 @@
486 486
487 487 AI::WarSceneAISceneImpl* brain = MemoryManager_NEW AI::WarSceneAISceneImpl();
488 488
489 - //GOAP
490 - brain->worldState().setVariable(AI::GOAPFact(AI::AtHomeFlagLoc), AI::GOAPValue(true));
491 - brain->worldState().setVariable(AI::GOAPFact(AI::AtEnemyFlagLoc), AI::GOAPValue(false));
492 - brain->worldState().setVariable(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(false));
493 - brain->worldState().setVariable(AI::GOAPFact(AI::EnemyDead), AI::GOAPValue(false));
494 - brain->worldState().setVariable(AI::GOAPFact(AI::EnemyHasFlag), AI::GOAPValue(false));
495 - brain->worldState().setVariable(AI::GOAPFact(AI::HasOwnFlag), AI::GOAPValue(false));
496 - brain->worldState().setVariable(AI::GOAPFact(AI::FlagCarrierDead), AI::GOAPValue(false));
497 -
498 - brain->registerAction(&approachEnemyFlag);
499 - brain->registerAction(&captureEnemyFlag);
500 - brain->registerAction(&returnHome);
501 - brain->registerAction(&returnEnemyFlag);
502 - brain->registerAction(&recoverFlag);
503 - brain->registerAction(&killEnemy);
489 + //GOAP
490 + brain->worldState().setVariable(AI::GOAPFact(AI::AtHomeFlagLoc), AI::GOAPValue(true));
491 + brain->worldState().setVariable(AI::GOAPFact(AI::AtEnemyFlagLoc), AI::GOAPValue(false));
492 + brain->worldState().setVariable(AI::GOAPFact(AI::HasEnemyFlag), AI::GOAPValue(false));
493 + brain->worldState().setVariable(AI::GOAPFact(AI::EnemyDead), AI::GOAPValue(false));
494 + brain->worldState().setVariable(AI::GOAPFact(AI::EnemyHasFlag), AI::GOAPValue(false));
495 + brain->worldState().setVariable(AI::GOAPFact(AI::HasOwnFlag), AI::GOAPValue(false));
496 + brain->worldState().setVariable(AI::GOAPFact(AI::FlagCarrierDead), AI::GOAPValue(false));
497 +
498 + brain->registerAction(&approachEnemyFlag);
499 + brain->registerAction(&captureEnemyFlag);
500 + brain->registerAction(&returnHome);
501 + brain->registerAction(&returnEnemyFlag);
502 + brain->registerAction(&recoverFlag);
503 + brain->registerAction(&killEnemy);
504 504 brain->registerGoal(captureFlag);
505 505 brain->registerGoal(findFlag);
506 - brain->registerGoal(returnFlag);
506 + brain->registerGoal(returnFlag);
507 507 brain->registerGoal(retrieveFlag);
508 508
509 509 aiSoldier->addAISceneImpl(brain);
  @@ -622,7 +622,7 @@
622 622 static bool flyCameraActive = true;
623 623
624 624 bool keyState = Scene::onKeyUp(key);
625 - switch(key._key) {
625 + switch(key._key) {
626 626 default: break;
627 627
628 628 case Input::KeyCode::KC_TAB:{
  @@ -643,7 +643,7 @@
643 643 renderState().getCameraMgr().pushActiveCamera("defaultCamera");
644 644 tpsCameraActive = false; flyCameraActive = true;
645 645 }
646 - // renderState().getCamera().setTargetNode(_currentSelection);
646 + // renderState().getCamera().setTargetNode(_currentSelection);
647 647 }break;
648 648 }
649 649 return keyState;