00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _MOUSE_H_
00022 #define _MOUSE_H_
00023
00024 #include "rect.h"
00025 #include "dir.h"
00026 #include "iwin8.h"
00027 #include "vgafile.h"
00028 #include "glshape.h"
00029
00030 class Game_window;
00031
00032
00033
00034
00035 class Mouse
00036 {
00037 protected:
00038 Shape_file pointers;
00039 Game_window *gwin;
00040 Image_window8 *iwin;
00041 Image_buffer *backup;
00042 Rectangle box;
00043 Rectangle dirty;
00044 int mousex, mousey;
00045 int cur_framenum;
00046 Shape_frame *cur;
00047 unsigned char focus;
00048 unsigned char onscreen;
00049 static short short_arrows[8];
00050
00051 static short med_arrows[8];
00052 static short long_arrows[8];
00053 static short short_combat_arrows[8];
00054 static short med_combat_arrows[8];
00055 void set_shape0(int framenum);
00056 void Init();
00057
00058 public:
00059 enum Mouse_shapes
00060 {
00061 dontchange = 1000,
00062 hand = 0,
00063 redx = 1,
00064 greenselect = 2,
00065 tooheavy = 3,
00066 outofrange = 4,
00067 outofammo = 5,
00068 wontfit = 6,
00069 hourglass = 7,
00070 greensquare = 23,
00071 blocked = 49
00072 };
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 enum Avatar_Speed_Factors
00093 {
00094 slow_speed_factor = 100,
00095 medium_combat_speed_factor = 133,
00096 medium_speed_factor = 200,
00097 fast_speed_factor = 400
00098 };
00099 int avatar_speed;
00100
00101 static bool mouse_update;
00102 static Mouse* mouse;
00103
00104 Mouse(Game_window *gw);
00105 Mouse(Game_window *gw, DataSource& shapes);
00106 ~Mouse();
00107
00108 void show();
00109 void hide()
00110 {
00111 if (onscreen)
00112 {
00113 onscreen = 0;
00114 iwin->put(backup, box.x, box.y);
00115 dirty = box;
00116 }
00117 }
00118 void set_shape(int framenum)
00119 {
00120 if (framenum != cur_framenum)
00121 set_shape0(framenum);
00122 }
00123 void set_shape(Mouse_shapes shape)
00124 { set_shape(static_cast<int>(shape)); }
00125 Mouse_shapes get_shape()
00126 { return (Mouse_shapes) cur_framenum; }
00127 void move(int x, int y);
00128 void blit_dirty()
00129 {
00130 if (!GL_manager::get_instance())
00131 iwin->show(dirty.x - 1, dirty.y - 1, dirty.w + 2,
00132 dirty.h + 2);
00133 }
00134 void set_location(int x, int y);
00135
00136 void flash_shape(Mouse_shapes flash);
00137
00138 int get_short_arrow(Direction dir)
00139 { return (short_arrows[static_cast<int>(dir)]); }
00140
00141 int get_medium_arrow(Direction dir)
00142 { return (med_arrows[static_cast<int>(dir)]); }
00143
00144 int get_long_arrow(Direction dir)
00145 { return (long_arrows[static_cast<int>(dir)]); }
00146
00147 int get_short_combat_arrow(Direction dir)
00148 { return (short_combat_arrows[static_cast<int>(dir)]); }
00149
00150 int get_medium_combat_arrow(Direction dir)
00151 { return (med_combat_arrows[static_cast<int>(dir)]); }
00152
00153 unsigned char is_onscreen() { return onscreen; }
00154
00155
00156
00157
00158
00159 void set_speed_cursor();
00160 };
00161
00162 #endif