1 /** 2 ** sfxinf.h - Sound Effect information from 'shape_info.txt'. 3 ** 4 ** Written: 06/01/2008 - Marzo 5 **/ 6 7 #ifndef INCL_SFXINF_H 8 #define INCL_SFXINF_H 1 9 10 /* 11 Copyright (C) 2008 The Exult Team 12 13 This program is free software; you can redistribute it and/or 14 modify it under the terms of the GNU General Public License 15 as published by the Free Software Foundation; either version 2 16 of the License, or (at your option) any later version. 17 18 This program is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License for more details. 22 23 You should have received a copy of the GNU General Public License 24 along with this program; if not, write to the Free Software 25 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 26 */ 27 28 #include "baseinf.h" 29 #include "exult_constants.h" 30 31 #include <iosfwd> 32 33 class Shape_info; 34 35 /* 36 * Information about shape sound effects. 37 */ 38 class SFX_info : public Base_info { 39 int sfxnum; 40 bool random; // sfx in range are to be randomly chosen. 41 int range; // # of sequential sfx to be used. 42 int chance; // % chance of playing the SFX. 43 int extra; // For grandfather clock. 44 45 public: 46 friend class Shape_info; 47 // Read in from file. 48 bool read(std::istream &in, int version, Exult_Game game); 49 // Write out. 50 void write(std::ostream &out, int shapenum, Exult_Game game); get_sfx()51 int get_sfx() const { 52 return sfxnum; 53 } set_sfx(int f)54 void set_sfx(int f) { 55 if (sfxnum != f) { 56 set_modified(true); 57 sfxnum = f; 58 } 59 } play_sequentially()60 bool play_sequentially() const { 61 return !random; 62 } play_randomly()63 bool play_randomly() const { 64 return random; 65 } set_play_randomly(bool f)66 void set_play_randomly(bool f) { 67 if (random != f) { 68 set_modified(true); 69 random = f; 70 } 71 } get_chance()72 int get_chance() const { 73 return chance; 74 } set_chance(int f)75 void set_chance(int f) { 76 if (chance != f) { 77 set_modified(true); 78 chance = f; 79 } 80 } play_horly_ticks()81 bool play_horly_ticks() const { 82 return extra > -1; 83 } get_extra_sfx()84 int get_extra_sfx() const { 85 return extra; 86 } set_extra_sfx(int f)87 void set_extra_sfx(int f) { 88 if (extra != f) { 89 set_modified(true); 90 extra = f; 91 } 92 } get_sfx_range()93 int get_sfx_range() const { 94 return range; 95 } set_sfx_range(int f)96 void set_sfx_range(int f) { 97 if (range != f) { 98 set_modified(true); 99 range = f; 100 } 101 } 102 bool time_to_play() const; 103 int get_next_sfx(int &last) const; get_info_flag()104 static int get_info_flag() { 105 return 0x20; 106 } 107 enum { is_binary = 0, entry_size = 0 }; 108 }; 109 110 #endif 111