00001 /* 00002 SagaEngine library 00003 Copyright (c) 2002-2006 Skalden Studio AS 00004 00005 This software is provided 'as-is', without any express or implied 00006 warranty. In no event will the authors be held liable for any 00007 damages arising from the use of this software. 00008 00009 Permission is granted to distribute the library under the terms of the 00010 Q Public License version 1.0. Be sure to read and understand the license 00011 before using the library. It should be included here, or you may read it 00012 at http://www.trolltech.com/products/qt/licenses/licensing/qpl 00013 00014 The original version of this library can be located at: 00015 http://www.sagaengine.com/ 00016 00017 Rune Myrland 00018 rune@skalden.com 00019 */ 00020 00021 00022 #include "Cutscene.hpp" 00023 #include "ShowingCutscene.hpp" 00024 #include "../config/sim_config.hpp" 00025 #include "../schema/SimSchema.hpp" 00026 #include "../script/Script.hpp" 00027 #include "../area/Area.hpp" 00028 #include "../thing/Actor.hpp" 00029 #include "util/type/TmpString.hpp" 00030 #include "util/type/String.hpp" 00031 #include "util/error/Log.hpp" 00032 #include <cstdio> 00033 00034 00035 namespace se_core { 00036 00037 00038 Cutscene 00039 ::Cutscene(String* name) 00040 : Object(got_CUTSCENE, name->get()), 00041 questGoal_(0), nameString_(name) { 00042 } 00043 00044 00045 Cutscene 00046 ::~Cutscene() { 00047 delete nameString_; 00048 } 00049 00050 00051 void Cutscene 00052 ::setScripts(const Area& area, Actor& performer, Actor* scriptTarget) { 00053 /* 00054 static ShowingCutscene showingCutscene; 00055 showingCutscene.freeMembers(); 00056 showingCutscene.setCutscene(this); 00057 SimSchema::scriptTracker = 0; 00058 SimSchema::didTrack = true; 00059 00060 int scriptTarid = -1; 00061 if(scriptTarget) scriptTarid = scriptTarget->id(); 00062 int performerId = performer.id(); 00063 00064 const Script* script ; 00065 TmpString tmp; 00066 sprintf(tmp.get(), "%s.performer", name()); 00067 if(SimSchema::sortedSimObjectList().has(got_SCRIPT, tmp.get())) { 00068 script = SimSchema::sortedSimObjectList().script(tmp.get()); 00069 performer.setShowingCutscene(&showingCutscene, script); 00070 } 00071 else { 00072 performerId = -1; // Allow name used as script identifier 00073 } 00074 00075 if(scriptTarget) { 00076 //scriptTarget->setTarget(&performer); 00077 sprintf(tmp.get(), "%s.target", name()); 00078 if(SimSchema::sortedSimObjectList().has(got_SCRIPT, tmp.get())) { 00079 WasHere(); 00080 script = SimSchema::sortedSimObjectList().script(tmp.get()); 00081 scriptTarget->setShowingCutscene(&showingCutscene, script); 00082 } 00083 else { 00084 scriptTarid = -1; // Allow name used as script identifier 00085 } 00086 } 00087 00088 SimObjectList::iterator_type it = area.multiSimObject(Area::MGOA_ACTORS).iterator(); 00089 while(it != SimObjectList::end()) { 00090 Actor* a = SimSchema::simObjectList.nextActor(it); 00091 if(a->id() == performerId || a->id() == scriptTarid) 00092 continue; 00093 00094 if(a->cutscenes().contains(*this) 00095 || a->cutsceneMemberships().contains(*this) 00096 ) { 00097 sprintf(tmp.get(), "%s.%s", name(), a->name()); 00098 script = SimSchema::sortedSimObjectList().script(tmp.get()); 00099 a->setShowingCutscene(&showingCutscene, script); 00100 } 00101 } 00102 */ 00103 } 00104 00108 void Cutscene 00109 ::setSingleScript(ShowingCutscene* showingCutscene, Actor& actor) { 00110 /* 00111 TmpString tmp; 00112 sprintf(tmp.get(), "%s.%s", name(), actor.name()); 00113 if(SimSchema::sortedSimObjectList().has(got_SCRIPT, tmp.get())) { 00114 const Script* script = SimSchema::sortedSimObjectList().script(tmp.get()); 00115 actor.setShowingCutscene(showingCutscene, script); 00116 } 00117 */ 00118 } 00119 00120 }
Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:11 2007 by Doxygen version 1.3.9.1.