00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "pent_include.h"
00020
00021 #include "StartU8Process.h"
00022 #include "Game.h"
00023 #include "LoopScript.h"
00024 #include "UCList.h"
00025 #include "CurrentMap.h"
00026 #include "Egg.h"
00027 #include "CameraProcess.h"
00028 #include "World.h"
00029 #include "GUIApp.h"
00030 #include "Kernel.h"
00031 #include "MenuGump.h"
00032 #include "SettingManager.h"
00033 #include "getObject.h"
00034
00035 #include "IDataSource.h"
00036 #include "ODataSource.h"
00037
00038
00039 DEFINE_RUNTIME_CLASSTYPE_CODE(StartU8Process,Process);
00040
00041 StartU8Process::StartU8Process() : Process()
00042 {
00043 init = false;
00044
00045 SettingManager::get_instance()->get("skipstart", skipstart);
00046 }
00047
00048
00049 bool StartU8Process::run(const uint32 )
00050 {
00051 if (!skipstart && !init) {
00052 init = true;
00053 ProcId moviepid = Game::get_instance()->playIntroMovie();
00054 Process* movieproc = Kernel::get_instance()->getProcess(moviepid);
00055 if (movieproc) {
00056 waitFor(movieproc);
00057 return false;
00058 }
00059 }
00060
00061 CurrentMap* currentmap = World::get_instance()->getCurrentMap();
00062 UCList uclist(2);
00063
00064 if (!skipstart) {
00065 LOOPSCRIPT(script, LS_AND(LS_SHAPE_EQUAL1(73), LS_Q_EQUAL(36)));
00066 currentmap->areaSearch(&uclist, script, sizeof(script),
00067 0, 256, false, 16188, 7500);
00068 if (uclist.getSize() < 1) {
00069 perr << "Unable to find FIRST egg!" << std::endl;
00070 return false;
00071 }
00072
00073 uint16 objid = uclist.getuint16(0);
00074 Egg* egg = p_dynamic_cast<Egg*>(getObject(objid));
00075 sint32 ix, iy, iz;
00076 egg->getLocation(ix,iy,iz);
00077
00078 CameraProcess::SetCameraProcess(new CameraProcess(ix,iy,iz));
00079 egg->hatch();
00080 }
00081
00082
00083
00084 uclist.free();
00085 LOOPSCRIPT(musicscript, LS_SHAPE_EQUAL1(562));
00086 currentmap->areaSearch(&uclist, musicscript, sizeof(musicscript),
00087 0, 256, false, 11551, 2079);
00088
00089 if (uclist.getSize() < 1) {
00090 perr << "Unable to find MUSIC egg!" << std::endl;
00091 }
00092 else {
00093 ObjId objid = uclist.getuint16(0);
00094 Item *musicEgg = getItem(objid);
00095 musicEgg->callUsecodeEvent_cachein();
00096 }
00097
00098 if (!skipstart)
00099 MenuGump::inputName();
00100 else
00101 GUIApp::get_instance()->setAvatarInStasis(false);
00102
00103
00104 terminate();
00105
00106 return false;
00107 }
00108
00109 void StartU8Process::saveData(ODataSource* ods)
00110 {
00111 CANT_HAPPEN();
00112
00113 Process::saveData(ods);
00114 }
00115
00116 bool StartU8Process::loadData(IDataSource* ids, uint32 version)
00117 {
00118 if (!Process::loadData(ids, version)) return false;
00119
00120 return true;
00121 }