forked from DusteDdk/Wizznic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.h
81 lines (67 loc) · 2.84 KB
/
stats.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef STATS_H_INCLUDED
#define STATS_H_INCLUDED
/************************************************************************
* This file is part of Wizznic. *
* Copyright 2009-2011 Jimmy Christensen <[email protected]> *
* Wizznic 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 3 of the License, or *
* (at your option) any later version. *
* *
* Wizznic is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with Foobar. If not, see <http://www.gnu.org/licenses/>. *
************************************************************************/
#include "list.h"
#include "text.h"
#include <SDL/SDL.h>
//Highscore entries (also used for in-game stats)
struct hsEntry_s
{
//Player Name, only used in pack-wide higshcore
char name[12];
//packWide: level user entered highscore
int levelNum;
int score;
//PrPack: total playtime before score achieved (fails also counted)
//PrLevel:time used to solve level
int time;
//PrPack:Lives Spent
//PrLevel:Number of moves.
int moves;
//PrLevel: Combos
int combos;
};
typedef struct hsEntry_s hsEntry_t;
//Stats for the package
struct stats_s
{
char* hsFn; //Stats file to read from
int progress; //Progress in this pack
listItem* levelStats; //list of hsEntries, one for each level, with "best" stats
listItem* packHsTable; //pack-wide highscores
hsEntry_t* cl; //ptr to current levelStats
};
typedef struct stats_s stats_t;
struct statsFileHeader_s {
int hsFileVersion; //Version of file
int progress; //Highest level player has yet achieved
int numLevelEntries;//Number of level-best hsEntries to read
int numHsEntries; //Number of packWide hsEntries to read
};
typedef struct statsFileHeader_s statsFileHeader_t;
void statsSetLevel(int l); //Simply set the cl ptr.
stats_t* stats(); //Return ptr to stats_t
void statsInit(); //Sets some ptrs 0, that's all.
void statsLoad(); //Tries to load stats from score/fn.bin
void statsSubmitBest();
void statsDrawHs( SDL_Surface* screen );
int statsIsHighScore();
void statsSaveHighScore();
void statsSave();
void statsUpload(int level, int time, int moves, int combos, int score, const char* action, int ignoreIfOnline, int* retVal);
#endif // STATS_H_INCLUDED