00001
00002
00003
00004
00005 #ifndef __OSPRTRES_H
00006 #define __OSPRTRES_H
00007
00008 #include <ORESX.H>
00009
00010
00011
00013 struct SpriteRec {
00014 enum { TYPE_LEN=1, CODE_LEN=8, RECNO_LEN=5, COUNT_LEN=5, SPRITE_PARA_LEN=2, DAMAGE_LEN=3, TURN_RES_LEN=2 };
00015
00016 char sprite_type;
00017 char sprite_code[CODE_LEN];
00018
00019
00020
00021
00022
00023
00024 };
00025
00026
00027
00029 struct SpriteActionRec {
00030 enum { NAME_LEN=8, ACTION_LEN=2, DIR_ID_LEN=2, RECNO_LEN=5, COUNT_LEN=2 };
00031
00032 char sprite_name[NAME_LEN];
00033 char action[ACTION_LEN];
00034 char dir_id[DIR_ID_LEN];
00035 char first_frame_recno[RECNO_LEN];
00036 char frame_count[COUNT_LEN];
00037 };
00038
00039
00040
00043 struct SpriteMove {
00044 short first_frame_recno;
00045 char frame_count;
00046 };
00047
00048
00049
00052 struct SpriteStop {
00053 short frame_recno;
00054 char frame_count;
00055 };
00056
00057
00058
00061 class SpriteInfo {
00062 public:
00063 enum { CODE_LEN=8 };
00064
00065 char sprite_code[CODE_LEN+1];
00066 char sprite_type;
00067
00068 short loc_width;
00069 short loc_height;
00070
00071 char* bitmap_ptr[MAX_ZOOM_LEVEL];
00072 short bitmap_width[MAX_ZOOM_LEVEL];
00073 short bitmap_height[MAX_ZOOM_LEVEL];
00074
00075 int loaded_count;
00076 ResourceIdx res_bitmap[MAX_ZOOM_LEVEL];
00077
00078
00079
00080
00081
00082
00083 public:
00084 ~SpriteInfo();
00085
00086 void load_bitmap_res();
00087 void free_bitmap_res();
00088
00089 int is_loaded() { return loaded_count>0; }
00090
00091 private:
00092 void load_bitmap_res(int zoomLevel, char* namePrefix, char* nameSuffix);
00093 };
00094
00095
00096
00098 class SpriteRes {
00099 public:
00100 char init_flag;
00101 int sprite_info_count;
00102
00103 private:
00104 SpriteInfo* sprite_info_array;
00105
00106 public:
00107 SpriteRes() { init_flag=0; }
00108
00109 void init();
00110 void deinit();
00111
00112 void update_speed();
00113
00114 #ifdef DEBUG
00115 SpriteInfo* operator[](int recNo);
00116 #else
00117 SpriteInfo* operator[](int recNo) { return sprite_info_array+recNo-1; }
00118 #endif
00119
00120 private:
00121 void load_sprite_info();
00122 };
00123
00124 extern SpriteRes sprite_res;
00125
00126
00127 #endif