00001 /* 00002 Copyright (C) 2004-2007 The Pentagram team 00003 00004 This program is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU General Public License 00006 as published by the Free Software Foundation; either version 2 00007 of the License, or (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #include "pent_include.h" 00020 00021 #include "AvatarDeathProcess.h" 00022 #include "MainActor.h" 00023 #include "ReadableGump.h" 00024 #include "GameData.h" 00025 #include "Kernel.h" 00026 #include "MainMenuProcess.h" 00027 #include "GumpNotifyProcess.h" 00028 #include "MusicProcess.h" 00029 #include "getObject.h" 00030 00031 #include "IDataSource.h" 00032 #include "ODataSource.h" 00033 00034 // p_dynamic_cast stuff 00035 DEFINE_RUNTIME_CLASSTYPE_CODE(AvatarDeathProcess,Process); 00036 00037 AvatarDeathProcess::AvatarDeathProcess() : Process() 00038 { 00039 item_num = 1; 00040 type = 1; // CONSTANT ! 00041 } 00042 00043 bool AvatarDeathProcess::run(const uint32 /*framenum*/) 00044 { 00045 MainActor *av = getMainActor(); 00046 00047 if (!av) { 00048 perr << "AvatarDeathProcess: MainActor object missing" << std::endl; 00049 // avatar gone?? 00050 terminate(); 00051 return false; 00052 } 00053 00054 if (!(av->getActorFlags() & Actor::ACT_DEAD)) { 00055 perr << "AvatarDeathProcess: MainActor not dead" << std::endl; 00056 // avatar not dead? 00057 terminate(); 00058 return false; 00059 } 00060 00061 ReadableGump *gump = new ReadableGump(1, 27, 11, 00062 _TL_("HERE LIES*THE AVATAR*REST IN PEACE")); 00063 gump->InitGump(0); 00064 gump->setRelativePosition(Gump::CENTER); 00065 Process* gumpproc = gump->GetNotifyProcess(); 00066 00067 Process* menuproc = new MainMenuProcess(); 00068 Kernel::get_instance()->addProcess(menuproc); 00069 menuproc->waitFor(gumpproc); 00070 00071 MusicProcess::get_instance()->unqueueMusic(); 00072 MusicProcess::get_instance()->playCombatMusic(44); // CONSTANT!! 00073 00074 // done 00075 terminate(); 00076 00077 return true; 00078 } 00079 00080 void AvatarDeathProcess::saveData(ODataSource* ods) 00081 { 00082 Process::saveData(ods); 00083 } 00084 00085 bool AvatarDeathProcess::loadData(IDataSource* ids, uint32 version) 00086 { 00087 if (!Process::loadData(ids, version)) return false; 00088 00089 return true; 00090 }