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
;
52 std::list
<std::pair
<boost::shared_ptr
<class AudioSource
>, bool> > uncontrolled_sounds
; // audio, followingviewport
54 std::map
<int, boost::weak_ptr
<Agent
> > unidmap
;
55 std::vector
<caosVM
*> vmpool
;
58 bool quitting
, saving
, paused
;
62 std::multiset
<CompoundPart
*, partzorder
> zorder
; // sorted from top to bottom
63 std::multiset
<renderable
*, renderablezorder
> renders
; // sorted from bottom to top
64 std::list
<boost::shared_ptr
<Agent
> > agents
;
66 std::map
<unsigned int, std::map
<unsigned int, cainfo
> > carates
;
67 std::map
<std::string
, caosVar
> variables
;
69 std::vector
<boost::filesystem::path
> data_directories
;
70 Scriptorium scriptorium
;
71 prayManager praymanager
;
73 historyManager history
;
78 unsigned int ticktime
, tickcount
;
79 unsigned int worldtickcount
;
80 unsigned int timeofday
, dayofseason
, season
, year
;
82 bool showrooms
, autokill
, autostop
;
84 std::vector
<unsigned int> groundlevels
;
86 AgentRef selectedcreature
;
87 void selectCreature(boost::shared_ptr
<Agent
> c
);
88 AgentRef focusagent
; unsigned int focuspart
;
89 void setFocus(class TextEntryPart
*p
);
91 Agent
*agentAt(unsigned int x
, unsigned int y
, bool obey_all_transparency
= true, bool needs_mouseable
= false);
92 CompoundPart
*partAt(unsigned int x
, unsigned int y
, bool obey_all_transparency
= true, bool needs_mouseable
= false);
93 class PointerAgent
*hand() { return theHand
; }
95 caosVM
*getVM(Agent
*owner
);
96 void freeVM(caosVM
*);
97 void queueScript(unsigned short event
, AgentRef agent
, AgentRef from
= AgentRef(), caosVar p0
= caosVar(), caosVar p1
= caosVar());
102 void initCatalogue();
105 void executeInitScript(boost::filesystem::path p
);
106 void executeBootstrap(boost::filesystem::path p
);
107 void executeBootstrap(bool switcher
);
109 std::string
getUserDataDir();
110 std::string
findFile(std::string path
);
111 std::vector
<std::string
> findFiles(std::string dir
, std::string wild
);
113 boost::shared_ptr
<AudioSource
> playAudio(std::string filename
, AgentRef agent
, bool controlled
, bool loop
, bool followviewport
= false);
115 void newMoniker(shared_ptr
<genomeFile
> g
, std::string genefile
, AgentRef agent
);
116 shared_ptr
<genomeFile
> loadGenome(std::string
&filename
);
117 std::string
generateMoniker(std::string basename
);
119 int findCategory(unsigned char family
, unsigned char genus
, unsigned short species
);
123 void drawWorld(Camera
*cam
, Surface
*surface
);
125 int newUNID(Agent
*whofor
);
126 void setUNID(Agent
*whofor
, int unid
);
127 void freeUNID(int unid
);
129 shared_ptr
<Agent
> lookupUNID(int unid
);