replaced glib function calls to g_string_*()
[rocksndiamonds.git] / src / game_bd / bd_caveset.h
1 /*
2  * Copyright (c) 2007, 2008, 2009, Czirkos Zoltan <cirix@fw.hu>
3  *
4  * Permission to use, copy, modify, and distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #ifndef BD_CAVESET_H
18 #define BD_CAVESET_H
19
20 #include <glib.h>
21
22 #include "main_bd.h"
23
24
25 typedef struct _gd_caveset_data
26 {
27   GdString name;                /* Name of caveset */
28   GdString description;         /* Some words about the caveset */
29   GdString author;              /* Author */
30   GdString difficulty;          /* difficulty of the caveset, for info purposes */
31   GdString www;                 /* link to author's webpage */
32   GdString date;                /* date of creation */
33
34   char *story;                  /* story for the caves */
35   char *remark;                 /* notes about the game */
36     
37   char *title_screen;           /* base64-encoded title screen image */
38   char *title_screen_scroll;    /* scrolling background for title screen image */
39
40   GdString charset;             /* these are not used by gdash */
41   GdString fontset;
42
43   /* these are only for a game. */
44   int initial_lives;            /* initial lives at game start */
45   int maximum_lives;            /* maximum lives */
46   int bonus_life_score;         /* bonus life / number of points */
47
48   /* and this one the highscores */
49   GdHighScore highscore[GD_HIGHSCORE_NUM];
50 } GdCavesetData;
51
52 extern const GdStructDescriptor gd_caveset_properties[];
53
54 extern GdCavesetData *gd_caveset_data;
55 extern GList *gd_caveset;
56 extern boolean gd_caveset_edited;
57 extern int gd_caveset_last_selected;
58 extern int gd_caveset_last_selected_level;
59
60 extern char *gd_caveset_extensions[];
61
62 /* #included cavesets; configdir passed to look for .hsc file */
63 boolean gd_caveset_load_from_internal(int caveset, const char *configdir);
64 const gchar **gd_caveset_get_internal_game_names(void);
65
66 /* caveset load from file */
67 boolean gd_caveset_load_from_file(char *filename);
68 /* caveset save to bdcff file */
69 boolean gd_caveset_save(const char *filename);
70
71 /* misc caveset functions */
72 int gd_caveset_count(void);
73 void gd_caveset_clear(void);
74 GdCave *gd_return_nth_cave(const int cave);
75
76 GdCave *gd_get_original_cave_from_caveset(const int cave);
77 GdCave *gd_get_prepared_cave_from_caveset(const int cave, const int level);
78 GdCave *gd_get_prepared_cave(const GdCave *cave, const int level);
79
80 /* highscore in config directory */
81 void gd_save_highscore(const char* directory);
82 boolean gd_load_highscore(const char *directory);
83
84 GdCavesetData *gd_caveset_data_new(void);
85 void gd_caveset_data_free(GdCavesetData *data);
86
87 /* check replays and optionally remove */
88 int gd_cave_check_replays(GdCave *cave, boolean report, boolean remove, boolean repair);
89
90 boolean gd_caveset_has_replays(void);
91
92 #endif  // BD_CAVESET_H