00001 //Filename : OTERRAIN.h 00002 //Description : TerrainRes Class Declaration 00003 00004 #ifndef __OTERRAIN_H 00005 #define __OTERRAIN_H 00006 00007 #ifndef __ORESX_H 00008 #include <ORESX.H> 00009 #endif 00010 00011 //------ Define terrain types ------// 00012 00013 enum { TERRAIN_GRASS=1 }; 00014 00015 //------- Define TerrainRec --------// 00016 00019 struct TerrainRec { 00020 enum { TYPE_LEN=8 }; 00021 enum { FILE_NAME_LEN=8 }; 00022 00023 char type[TYPE_LEN]; 00024 char file_name[FILE_NAME_LEN]; 00025 }; 00026 00027 //------ Define struct TerrainInfo --------// 00028 00030 struct TerrainInfo { 00031 enum { FILE_NAME_LEN=8 }; 00032 00033 char type; 00034 char file_name[FILE_NAME_LEN+1]; 00035 00036 char* bitmap_ptr[MAX_ZOOM_LEVEL]; 00037 }; 00038 00039 //------- Define class TerrainRes ---------// 00040 00042 class TerrainRes { 00043 public: 00044 bool init_flag; 00045 00046 short terrain_count; 00047 TerrainInfo* info_array; 00048 00049 ResourceIdx res_bitmap[MAX_ZOOM_LEVEL]; 00050 00051 public: 00052 TerrainRes(); 00053 ~TerrainRes(); // public for compilation error if private 00054 00055 void init(); 00056 void deinit(); 00057 00058 TerrainInfo* operator[](int terrainId); 00059 00060 private: 00061 void load_info(); 00062 void load_bmp_info(char* fileName); 00063 00064 void load_res(int bmpSizeType, char* namePrefix, char* nameSuffix); 00065 }; 00066 00067 extern TerrainRes terrain_res; 00068 00069 //-----------------------------------------------// 00070 #endif