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 21 // Filename : OROCK.H 22 // Description : header file of Rock and RockArray 23 // Owner : Gilbert 24 25 #ifndef __OROCK_H 26 #define __OROCK_H 27 28 #include <ODYNARRB.h> 29 30 // --------- define class Rock -----------// 31 32 #pragma pack(1) 33 class Rock 34 { 35 public: 36 short rock_recno; 37 char cur_frame; 38 char delay_remain; 39 short loc_x; 40 short loc_y; 41 42 private: 43 unsigned seed; 44 45 public: 46 Rock(short rockRecno, short xLoc, short yLoc); 47 void init(short rockRecno, short xLoc, short yLoc); // cur_frame init to 1, and initDelay is random 48 void process(); 49 void draw(); 50 void draw_block(short xLoc, short yLoc); 51 52 private: 53 unsigned random(unsigned); 54 }; 55 #pragma pack() 56 57 58 59 // --------- define class RockArray -----------// 60 61 class RockArray : public DynArrayB 62 { 63 public: 64 RockArray(int initArraySize = DEF_DYNARRAY_BLOCK_SIZE); 65 void init(); 66 void deinit(); 67 68 void process(); add(Rock * r)69 int add(Rock *r) { linkin(r); return recno();} del(int i)70 void del(int i) { linkout(i); } 71 Rock* operator[](int n) { return (Rock *)get(n); } 72 }; 73 74 extern RockArray rock_array; 75 extern RockArray dirt_array; 76 77 #endif 78