5 * Created by Alyssa Milburn on Tue May 25 2004.
6 * Copyright (c) 2004 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
24 #include "Scriptorium.h"
27 #include "CompoundPart.h"
28 #include "prayManager.h"
29 #include "historyManager.h"
30 #include "imageManager.h"
33 #include <boost/filesystem/path.hpp>
42 unsigned short scriptno
;
49 class PointerAgent
*theHand
;
50 std::list
<scriptevent
> scriptqueue
;
53 bool quitting
, saving
, paused
;
57 std::list
<boost::shared_ptr
<class AudioSource
> > uncontrolled_sounds
;
58 std::multiset
<CompoundPart
*, partzorder
> zorder
; // sorted from top to bottom
59 std::multiset
<renderable
*, renderablezorder
> renders
; // sorted from bottom to top
60 std::list
<boost::shared_ptr
<Agent
> > agents
;
62 std::map
<unsigned int, std::map
<unsigned int, cainfo
> > carates
;
63 std::map
<std::string
, caosVar
> variables
;
64 std::vector
<caosVM
*> vmpool
;
65 std::map
<int, boost::weak_ptr
<Agent
> > unidmap
;
67 std::vector
<boost::filesystem::path
> data_directories
;
68 Scriptorium scriptorium
;
69 prayManager praymanager
;
71 historyManager history
;
76 unsigned int ticktime
, tickcount
;
77 unsigned int worldtickcount
;
78 unsigned int timeofday
, dayofseason
, season
, year
;
80 bool showrooms
, autokill
, autostop
;
82 AgentRef selectedcreature
;
83 void selectCreature(boost::shared_ptr
<Agent
> c
);
84 AgentRef focusagent
; unsigned int focuspart
;
85 void setFocus(class TextEntryPart
*p
);
87 Agent
*agentAt(unsigned int x
, unsigned int y
, bool obey_all_transparency
= true, bool needs_mouseable
= false);
88 CompoundPart
*partAt(unsigned int x
, unsigned int y
, bool obey_all_transparency
= true, bool needs_mouseable
= false);
89 class PointerAgent
*hand() { return theHand
; }
91 caosVM
*getVM(Agent
*owner
);
92 void freeVM(caosVM
*);
93 void queueScript(unsigned short event
, AgentRef agent
, AgentRef from
= AgentRef(), caosVar p0
= caosVar(), caosVar p1
= caosVar());
101 void executeInitScript(boost::filesystem::path p
);
102 void executeBootstrap(boost::filesystem::path p
);
103 void executeBootstrap(bool switcher
);
105 std::string
getUserDataDir();
106 std::string
findFile(std::string path
);
107 std::vector
<std::string
> findFiles(std::string dir
, std::string wild
);
109 boost::shared_ptr
<AudioSource
> playAudio(std::string filename
, AgentRef agent
, bool controlled
, bool loop
);
111 void newMoniker(shared_ptr
<genomeFile
> g
, std::string genefile
, AgentRef agent
);
112 shared_ptr
<genomeFile
> loadGenome(std::string
&filename
);
113 std::string
generateMoniker(std::string basename
);
115 int findCategory(unsigned char family
, unsigned char genus
, unsigned short species
);
119 void drawWorld(Camera
*cam
, Surface
*surface
);
121 int newUNID(Agent
*whofor
);
122 void setUNID(Agent
*whofor
, int unid
);
123 void freeUNID(int unid
);
125 shared_ptr
<Agent
> lookupUNID(int unid
);