00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef UCMACHINE_H
00023 #define UCMACHINE_H
00024
00025 #ifndef ALPHA_LINUX_CXX
00026 # include <iosfwd>
00027 #endif
00028
00029 class Game_window;
00030 class Usecode_machine;
00031 class Conversation;
00032 class Keyring;
00033 class Game_object;
00034 class Actor;
00035
00036 #include "exceptions.h"
00037 #include "singles.h"
00038
00039
00040
00041
00042
00043 class Usecode_machine : public Game_singletons
00044 {
00045 UNREPLICATABLE_CLASS(Usecode_machine);
00046 protected:
00047 unsigned char gflags[1024];
00048 Keyring* keyring;
00049 Conversation *conv;
00050 public:
00051 friend class Usecode_script;
00052
00053 static Usecode_machine *create();
00054 Usecode_machine();
00055 virtual ~Usecode_machine();
00056
00057 virtual void read_usecode(std::istream& file, bool patch = false) = 0;
00058
00059 enum Usecode_events {
00060 npc_proximity = 0,
00061 double_click = 1,
00062 internal_exec = 2,
00063 egg_proximity = 3,
00064 weapon = 4,
00065 readied = 5,
00066 unreadied = 6,
00067 died = 7,
00068 chat = 9
00069 };
00070 enum Global_flag_names {
00071 did_first_scene = 0x3b,
00072 have_trinsic_password = 0x3d,
00073 found_stable_key = 0x48,
00074 left_trinsic = 0x57,
00075 avatar_is_thief = 0x2eb
00076 };
00077 int get_global_flag(int i)
00078 { return gflags[i]; }
00079 void set_global_flag(int i, int val = 1)
00080 { gflags[i] = (val == 1); }
00081
00082 virtual void do_speech(int num) = 0;
00083 virtual int in_usecode() = 0;
00084 Keyring* getKeyring() const { return keyring; }
00085
00086 virtual int call_usecode(int id, Game_object *obj,
00087 Usecode_events event) = 0;
00088 virtual void write() = 0;
00089 virtual void read() = 0;
00090
00091 void init_conversation();
00092 int get_num_faces_on_screen() const;
00093
00094
00095 virtual void intercept_click_on_item(Game_object *obj) = 0;
00096
00097 };
00098
00099 #endif