/[projectaxis]/projectaxis/projectAxis/src/map/blotchmaker.h
ViewVC logotype

Diff of /projectaxis/projectAxis/src/map/blotchmaker.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by leiavoia, Fri Jul 25 21:17:49 2003 UTC revision 1.3 by leiavoia, Fri Aug 8 02:07:29 2003 UTC
# Line 3  Line 3 
3  ====================  ====================
4  BlotchMaker.h  BlotchMaker.h
5  ====================  ====================
6  version 2.5.12  version 2.5.15
7  ====================  ====================
8    
9  BlotchMaker works with "Map" classes. While Map builds the map structure for the game,  BlotchMaker works with "Map" classes. While Map builds the map structure for the game,
10  BltochMaker fills it all out with terrain.  BlotchMaker fills it all out with terrain.
11    
12  To use Blotchmaker, first create a map object, then a Blotchmaker object. Use the main  To use Blotchmaker, first create a map object, then a Blotchmaker object. Use the main
13  blotchmaking function. It will automagically interact with the map object and create a terrain on it.  blotchmaking function. It will automagically interact with the map object and create a terrain on it.
# Line 23  functions for more details. Line 23  functions for more details.
23    
24  SETUP SAMPLE:  SETUP SAMPLE:
25  ----------------------  ----------------------
26  // creat a map object  // create a map object
27  class Map the_map(cols_in_map, rows_in_map);  Map the_map(cols_in_map, rows_in_map);
28    
29  // make blotchmaker object  // make blotchmaker object
30  class Blotchmaker blotchmaker(the_map);  Blotchmaker blotchmaker;
31    
32  // make blotches on map  // make blotches on map
33  blotchmaker.StartBlotching();  blotchmaker.StartBlotching();
# Line 40  the_map.PrintToScreen(); Line 40  the_map.PrintToScreen();
40    
41  TO-DO & EXPANSION LIST  TO-DO & EXPANSION LIST
42  ----------------------  ----------------------
43  replace lottery system  remove FULL ad CLEAR modes (?)
44  get rid of redundant IsValid map checking.  get rid of redundant IsValid map checking.
45  SetAxisPalette() needs individual push and pop instead of a lump set of perams.  SetAxisPalette() needs individual push and pop instead of a lump set of perams.
46  option: pathcut bad maps or re-blotch & timeout?  option: pathcut bad maps or re-blotch & timeout?
47  Path cutting for bad maps  Path cutting for bad maps
48  Waypoints for path cutting  Waypoints for path cutting
49  FULL mode infinite loop possible? or just get rid of full mode - check to see if still works even.  FULL mode infinite loop possible? or just get rid of full mode - check to see if still works even.
 Expand slots from 5 to 10 (not so easy)  
50  Revamp brush selection to include thickness/size perams  Revamp brush selection to include thickness/size perams
51  Remove templates package and just make them direct class members.  Remove templates package and just make them direct class members.
52  Code cleanup: Rename "blotch_type" to "slot". this is confusing.  Code cleanup: Rename "blotch_type" to "slot". this is confusing.
53  Bounds checking and errors  Bounds checking and errors
54  get rid of extra variables like num_blotch_types. set to hard code now that design is done or switch to #defines.  
55    
56    
57    
58    
59  CHANGELOG:  CHANGELOG:
60  ----------------------  ----------------------
61  2.5.12 - July 20, 2003  2.5.15  - August 2, 2003
62            - replaced the entire lottery system! (actually there were only 3 or 4 places that needed it.)
63            - added many interface fuctions, mostly Get()s
64            - re-implemented some numbers as static constants. haven't removed the old class member numbers yet though
65    2.5.14  - August 2, 2003
66            - fixed constructor map_cols/map_rows settings. now set in StartBlotching() to avoid conflicts if the map changes.
67            - re-fixed ConvertToGoalMarkers bug
68    2.5.13  - July 28, 2003
69            - "unfixed" the ConvertToGoalMarkers bug. was causing weirdness when creating/destroying blotchmaker objects.
70                    we need to implement an entirely new lotto system.
71                    DO NOT RE-BLOTCH WITH BLOTCHMAKER IN IT'S CURRENT STATE
72            - changed all code relating to Map class' change in obstacle type interface functions.
73    2.5.12  - July 20, 2003
74          - BM now inherits from PointerHub so it no longer needs SetMapPointer.          - BM now inherits from PointerHub so it no longer needs SetMapPointer.
75          - "map" has been change to "themap" in code as a result to avoid STL conflicts          - "map" has been changed to "themap" in code as a result to avoid STL conflicts
76  2.5.11 - July 18, 2003  2.5.11  - July 18, 2003
77          - identified ConvertToGoalMarkers() bug. It works fine on the first pass, but if blotchmaker is re-used,          - identified ConvertToGoalMarkers() bug. It works fine on the first pass, but if blotchmaker is re-used,
78                  it tries to re-convert the already converted numbers. Put a once-through guard on it, but the lottery                  it tries to re-convert the already converted numbers. Put a once-through guard on it, but the lottery
79                  system really needs to be entirely replaced                  system really needs to be entirely replaced
# Line 143  enum brush {RE=0, SC, MC, LC, SS, MS, LS Line 154  enum brush {RE=0, SC, MC, LC, SS, MS, LS
154  // aka a "slot"  // aka a "slot"
155  struct blotch_type_perams {  struct blotch_type_perams {
156          short int tiles_per_blotch; // zero for AUTO          short int tiles_per_blotch; // zero for AUTO
157          float mode_chances[4]; // Mode Persuasion (in parts): Full, Chaotic, X_OR, Clear          int mode_chances[4]; // Mode Persuasion (in parts): Full, Chaotic, X_OR, Clear
158          float turn_chances[4]; // Turn Persuasion (in parts): Forward, Left, Right, Back          int turn_chances[4]; // Turn Persuasion (in parts): Forward, Left, Right, Back
159          short int blank_shot_chance; // Blank Shot (percentage chance of shooting a blank per tile)          short int blank_shot_chance; // Blank Shot (percentage chance of shooting a blank per tile)
160          short int edge_det; // percent chance of edges of path to "shoot a blank"          short int edge_det; // percent chance of edges of path to "shoot a blank"
161          short int edge_grav; // value of the edge attraction. usually 1-5. zero for none;          short int edge_grav; // value of the edge attraction. usually 1-5. zero for none;
162          short int blotch_type; // just to call it something later when placing tiles, determining which kind of obstacle to place          obstacle blotch_type; // just to call it something later when placing tiles, determining which kind of obstacle to place
163          enum brush brush; // brush type for tile placement          enum brush brush; // brush type for tile placement
164          short int step;  // number of steps in between tile placements          short int step;  // number of steps in between tile placements
165          };          };
# Line 157  struct blotch_type_perams { Line 168  struct blotch_type_perams {
168  // aka "slot holder" + blotching global vars  // aka "slot holder" + blotching global vars
169  struct map_user_vars_package {  struct map_user_vars_package {
170          int max_blotches; // max number of blotches per blotch_type          int max_blotches; // max number of blotches per blotch_type
171          float type_chances[5]; // blotch type (aka "slot") chances          int type_chances[5]; // blotch type (aka "slot") chances
172          // one set of vars for each mode          // one set of vars for each mode
173          struct blotch_type_perams type[5]; // NOTE: you only get 5 slots to work with! Maybe more in future          struct blotch_type_perams type[5]; // NOTE: you only get 5 slots to work with! Maybe more in future
174          };          };
# Line 176  public: Line 187  public:
187                  bool StartBlotching();                  bool StartBlotching();
188    
189                  // sets the initializer obstacle blotchmaker will reset the map to when doing a new map.                  // sets the initializer obstacle blotchmaker will reset the map to when doing a new map.
190                  void SetMapInit(short int x);                  void SetMapInit(obstacle x);
191    
192                  // Template vars functions - use these from the UI or internally, i don't care.                  // Template vars functions - use these from the UI or internally, i don't care.
193                  //      defaults are set if you set nothing yourself                  //      defaults are set if you set nothing yourself
# Line 200  public: Line 211  public:
211                  // Number of map tiles to skip in between tiles placed by a blotch.                  // Number of map tiles to skip in between tiles placed by a blotch.
212                  void SetStep(short int type, short int x);                  void SetStep(short int type, short int x);
213                  // The kind of obstacle to place while blotching for this blotch_type slot. See the obstacle enum of the Map class for additional info.                  // The kind of obstacle to place while blotching for this blotch_type slot. See the obstacle enum of the Map class for additional info.
214                  void SetBlotchType(short int type, short int x);                  void SetBlotchType(short int type, obstacle x);
215                  // The max number of blotches for the entire blotching process                  // The max number of blotches for the entire blotching process
216                  void SetMaxBlotches(short int x);                  void SetMaxBlotches(short int x);
217                  // The chance to select a variables slot (this function has additional perams for future expansion.                  // The chance to select a variables-slot (this function has additional perams for future expansion.
218                  //      Pads with zeros for nonexistant slots. currently, only perams 0-4 are needed as there are only 5 available slots to work with internally)                  //      Pads with zeros for nonexistant slots. currently, only perams 0-4 are needed as there are only 5 available slots to work with internally)
219                  void SetTypeChances(short int a, short int b=0, short int c=0, short int d=0, short int e=0, short int f=0, short int g=0, short int h=0, short int i=0, short int j=0);                  void SetTypeChances(short int a, short int b=0, short int c=0, short int d=0, short int e=0, short int f=0, short int g=0, short int h=0, short int i=0, short int j=0);
220    
221    
222                    // NEW FUNCTION 8.2.2003:
223    
224                    /** sets the lottery balls associated with the slot's chance to get picked for a blotch run */
225                    void SetSlotChance(int slot, int val);
226                    /** sets the lottery balls associated with a slots turning chances. "turn" -> 0=forward, 1=left, 2=right, 3=backward*/
227                    void SetTurnChance(int slot, int turn, int val);
228                    /** sets the lottery balls associated with a slots blotch placement mode chances. 0=full, 1=chaotic, 2=x_or, 3=clear*/
229                    void SetModeChance(int slot, int mode, int val);
230                    /** Returns the number of tiles to be placed per blotch for a given slot*/
231                    int GetTilesPerBlotch(int slot);
232                    /** Returns the default map obstacle initializer*/
233                    obstacle GetMapInit();
234                    /** Returns the chance in lottery balls for a given slot to be picked*/
235                    int GetSlotChance(int slot);
236                    /** Returns the chance in lottery balls for a given turn of a given slot to be picked*/
237                    int GetTurnChance(int slot, int turn);
238                    /** Returns the chance in lottery balls for a given tile placement mode of a given slot to be picked*/
239                    int GetModeChance(int slot, int mode);
240                    /** Returns the chance as a percentage for a given slot to shoot a blank when applying a brush*/
241                    int GetBlankShotChance(int slot);
242                    /** Returns the strength of the edge gravity for this slot*/
243                    int GetEdgeGrav(int slot);
244                    /** Returns the percentage of a brush that will be deteriorated (by chance) when applying a brush for this slot*/
245                    int GetEdgeDet(int slot);
246                    /** Returns the brush type for this slot*/
247                    brush GetBrush(int slot);
248                    /** Returns the obstacle type for this slot*/
249                    obstacle GetObstType(int slot);
250                    /** Returns the step between brush placements for this slot*/
251                    int GetStep(int slot);
252                    /** Returns the maximum number of blotches for the entire blotching process*/
253                    int GetMaxBlotches();
254    
255    
256    
257    
258          // OTHER FUNCTIONS          // OTHER FUNCTIONS
259                  // set the square size of home bases in tiles                  // set the square size of home bases in tiles
260                  void SetHBSize(short int x);                  void SetHBSize(short int x);
# Line 215  public: Line 263  public:
263                  // loads the axis colors to place on the map - ints corespond to the equivelent obstacle enum numbers. (0 = BLOCK)                  // loads the axis colors to place on the map - ints corespond to the equivelent obstacle enum numbers. (0 = BLOCK)
264                  //      you cannot load colors seperately yet. you must do it all in one big lump.                  //      you cannot load colors seperately yet. you must do it all in one big lump.
265                  //      this also determines how many players are on the map.                  //      this also determines how many players are on the map.
266                  void SetAxisPalette(short int=0, short int=0, short int=0, short int=0, short int=0, short int=0, short int=0, short int=0);                  void SetAxisPalette(obstacle a = OBST_BLUE , obstacle b = OBST_GREEN, obstacle c = OBST_EMPTY, obstacle d = OBST_EMPTY);
267          // *STRUCTORS          // *STRUCTORS
268                  Blotchmaker(/*Map &incoming_map*/);                  Blotchmaker(/*Map &incoming_map*/);
269                  ~Blotchmaker() {/*do nothing*/}                  ~Blotchmaker() {/*do nothing*/}
270    
271  private:  private:
272          // variables          // variables
273          Map *map; // a pointer to the map we are working on          //Map *map; // a pointer to the map we are working on
274          short int map_cols;          short int map_cols;
275          short int map_rows;          short int map_rows;
276          struct pos prev_tile;          struct pos prev_tile;
# Line 243  private: Line 291  private:
291          short int hbplacement; // placement type of home bases, corners=0, sides, [random]          short int hbplacement; // placement type of home bases, corners=0, sides, [random]
292          obstacle hbtypes[8]; // a list of hb types to put on the map.          obstacle hbtypes[8]; // a list of hb types to put on the map.
293          pos hb_locs[4]; // x,y locations of home bases          pos hb_locs[4]; // x,y locations of home bases
294          short int num_players; //based on the number of home bases loaded          int num_players; //based on the number of home bases loaded
295    
296          obstacle map_init; // default initializer.          obstacle map_init; // default initializer.
297    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26