levels.h 5.24 KB
Newer Older
1
/***************************************************************************
2
                          levels.h  -  description
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
                             -------------------
    begin                : Thu Sep 6 2001
    copyright            : (C) 2001 by Michael Speck
    email                : kulkanie@gmx.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

18 19 20 21 22
#ifndef __LEVELS_H
#define __LEVELS_H

#include "../client/lbreakout.h"

23 24
#define NEW_SET _("<CREATE SET>")
#define TOURNAMENT _("!FREAKOUT!")
25 26 27

/*
====================================================================
28
Open a levelset file by name.
29 30
====================================================================
*/
31
FILE *levelset_open( const char *fname, char *mode );
32 33
/*
====================================================================
34
Load all levels from file and add them to the list.
35 36
====================================================================
*/
37
int levels_load( const char *fname, List *levels, int *version, int *update );
38 39
/*
====================================================================
40 41
Load all levels from either 
home directory (fname begins with ~) or installation directory.
42 43
====================================================================
*/
44
LevelSet *levelset_load( const char *fname, int addBonusLevels );
45 46
/*
====================================================================
47 48 49
Load all levelSETS listed in 'levelsets' (names) into one big
levelset and shake the levels a bit. Use a fixed seed for this
and reinit random generator with current time when done.
50 51
====================================================================
*/
52
LevelSet *levelset_load_all( List *levelsets, int seed, int addBonusLevels );
53 54
/*
====================================================================
55 56 57
Build a levelset from a level list and delete the list.
The levels are taken from the list so it must not have AUTO_DELETE
enabled!
58 59
====================================================================
*/
60
LevelSet *levelset_build_from_list( List *levels, const char *name, int version, int update );
61 62
/*
====================================================================
63 64
Save levelset to home directory (regardsless of ~ in front of it).
Return Value: True if successful.
65 66
====================================================================
*/
67
int levelset_save( LevelSet *set, char *fname );
68 69
/*
====================================================================
70
Create an all empty levelset.
71 72
====================================================================
*/
73
LevelSet *levelset_create_empty( int count, char *author, char *name );
74 75
/*
====================================================================
76 77
Delete levels and set pointer NULL. Second version is for use with
lists.
78 79
====================================================================
*/
80 81
void levelset_delete( LevelSet **set );
void levelset_list_delete( void *ptr );
82 83
/*
====================================================================
84 85
Get first/next level from a set starting at the first level. If 
no more levels remain, NULL is returned.
86 87
====================================================================
*/
88 89
Level* levelset_get_first( LevelSet *set );
Level* levelset_get_next( LevelSet *set );
90 91
/*
====================================================================
92
Return list id of this level or -1 if not within this set.
93 94
====================================================================
*/
95
int levelset_get_id( LevelSet *set, Level *level );
96 97
/*
====================================================================
98
Load level from current file position.
99 100
====================================================================
*/
101
Level* level_load( FILE *file );
102 103
/*
====================================================================
104
Create an empty level
105 106
====================================================================
*/
107
Level* level_create_empty( char *author, char *name );
108 109
/*
====================================================================
110
Delete level pointer.
111 112
====================================================================
*/
113
void level_delete( void *level_ptr );
114 115 116

/*
====================================================================
117 118 119 120 121 122 123 124
Get version and current update of levelset: x.x
Will reset the file pointer to beginning.
====================================================================
*/
void levelset_get_version( FILE *file, int *version, int *update );
/*
====================================================================
Get the name of the author of the first level.
125 126
====================================================================
*/
127
void levelset_get_first_author( FILE *file, char *author );
128 129

#endif