OSFRMRES.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Seven Kingdoms: Ancient Adversaries
  3. *
  4. * Copyright 1997,1998 Enlight Software Ltd.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. //Filename : OSFRMRES.H
  21. //Description : Header file of Object SpriteFrame resource
  22. #ifndef __OSFRMRES_H
  23. #define __OSFRMRES_H
  24. #ifndef __ALL_H
  25. #include <ALL.h>
  26. #endif
  27. #ifndef __OSPRTRES_H
  28. #include <OSPRTRES.h>
  29. #endif
  30. //-------- Define struct SpriteFrameRec ----------//
  31. struct SpriteFrameRec
  32. {
  33. enum { NAME_LEN=8, ACTION_LEN=2, DIR_LEN=2, FRAME_ID_LEN=2, OFFSET_LEN=4,
  34. WIDTH_LEN=3, HEIGHT_LEN=3, FILE_NAME_LEN=8, BITMAP_OFFSET_LEN=4 };
  35. char sprite_name[NAME_LEN];
  36. char action[ACTION_LEN];
  37. char dir[DIR_LEN];
  38. char frame_id[FRAME_ID_LEN];
  39. char offset_x[OFFSET_LEN];
  40. char offset_y[OFFSET_LEN];
  41. char width[WIDTH_LEN];
  42. char height[HEIGHT_LEN];
  43. char file_name[FILE_NAME_LEN];
  44. char bitmap_offset[BITMAP_OFFSET_LEN];
  45. };
  46. //------- Define struct SpriteFrame --------//
  47. struct SpriteFrame
  48. {
  49. char offset_x, offset_y;
  50. short width, height;
  51. long bitmap_offset;
  52. };
  53. //--------- Define class SpriteFrameRes --------//
  54. class SpriteFrameRes
  55. {
  56. public:
  57. int sprite_frame_count;
  58. char init_flag;
  59. private:
  60. SpriteFrame* sprite_frame_array;
  61. public:
  62. SpriteFrameRes() { init_flag=0; }
  63. void init();
  64. void deinit();
  65. void load_info();
  66. #ifdef DEBUG
  67. SpriteFrame* operator[](int recNo);
  68. #else
  69. SpriteFrame* operator[](int recNo) { return sprite_frame_array+recNo-1; }
  70. #endif
  71. };
  72. extern SpriteFrameRes sprite_frame_res;
  73. //----------------------------------------------//
  74. #endif