2 * Copyright (C) 2003 Robert Kooima
4 * NEVERBALL is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published
6 * by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
24 /*---------------------------------------------------------------------------*/
28 char init_levels
[MAXSTR
];
29 char init_scores
[MAXSTR
];
30 char user_scores
[MAXSTR
];
39 static int set_state
= 0;
44 static struct set set_v
[MAXSET
];
46 /*---------------------------------------------------------------------------*/
57 if ((fin
= fopen(config_data(SET_FILE
), "r")))
59 while (fscanf(fin
, "%s %s %s %s\n",
60 set_v
[count
].init_levels
,
61 set_v
[count
].init_scores
,
62 set_v
[count
].user_scores
,
63 set_v
[count
].shot
) == 4 &&
64 fgets(set_v
[count
].name
, MAXSTR
, fin
) &&
65 fgets(set_v
[count
].desc
, MAXSTR
, fin
))
67 char *p
= set_v
[count
].name
+ strlen(set_v
[count
].name
) - 1;
68 char *q
= set_v
[count
].desc
+ strlen(set_v
[count
].desc
) - 1;
70 if (*p
== '\n') *p
= 0;
71 if (*q
== '\n') *q
= 0;
84 return (0 <= i
&& i
< count
);
89 level_init(set_v
[i
].init_levels
,
91 set_v
[i
].user_scores
);
104 for (i
= 0; i
< count
; i
++)
105 if (glIsTexture(set_v
[i
].text
))
107 glDeleteTextures(1, &set_v
[i
].text
);
116 /*---------------------------------------------------------------------------*/
118 const char *set_name(int i
)
120 return (0 <= i
&& i
< count
) ? set_v
[i
].name
: "";
123 const char *set_desc(int i
)
125 return (0 <= i
&& i
< count
) ? set_v
[i
].desc
: "";
128 const char *set_shot(int i
)
130 if (0 <= i
&& i
< count
)
131 return set_v
[i
].shot
;
133 return set_v
[0].shot
;
136 /*---------------------------------------------------------------------------*/