void Account::setCurrentCampaign(string name) {
currentCampaign = name;
- if(campaignProgress.find(name)==campaignProgress.end()) {
- campaignProgress[name].highscore = 0;
- campaignProgress[name].fasttime = 0;
- campaignProgress[name].score = 0;
- campaignProgress[name].time = 0;
- }
}
Account* Account::add(string name) {
fpackf(tfile, "Bi", a->progress);
fpackf(tfile, "Bi", a->campaignProgress.size());
- map<string,campaign_progress_t>::const_iterator it;
+ map<string,CampaignProgress>::const_iterator it;
for( it=a->campaignProgress.begin(); it!= a->campaignProgress.end(); ++it) {
fpackf(tfile, "Bi", it->first.size());
for(j=0;j<it->first.size();j++)
#include <map>
#include <fstream>
-typedef struct {
+struct CampaignProgress {
float highscore;
float fasttime;
float score;
float time;
std::vector<int> choices;
-} campaign_progress_t;
+ CampaignProgress() {
+ highscore = 0;
+ fasttime = 0;
+ score = 0;
+ time = 0;
+ }
+};
class Account {
public:
std::string name;
std::string currentCampaign;
- std::map<std::string,campaign_progress_t> campaignProgress;
+ std::map<std::string,CampaignProgress> campaignProgress;
//statics
static std::vector<Account*> accounts;
//keeps track of which textures are loaded
//TODO: delete them properly
-struct TextureInfo{
+struct TextureInfo {
bool isLoaded;
bool isSkin;
const char* fileName;
GLubyte* array;
int* skinsize;
- void load(){
+ void load() {
if(isSkin)
Game::LoadTextureSaveData(fileName,ptextureid,mipmap,array,skinsize,isLoaded);
else
for(i=0;i<nummenuitems;i++) {
if((mousecoordh/screenwidth*640)>startx[i]&&(mousecoordh/screenwidth*640)<endx[i]&&480-(mousecoordv/screenheight*480)>starty[i]&&480-(mousecoordv/screenheight*480)<endy[i]) {
- if(mainmenu!=5) selected=i;
+ if((mainmenu!=5) && (mainmenu!=1) && (mainmenu!=2)) selected=i; // username in menu 5 and game title in menu 1&2 can't be selected
else if( (i>0) && (i!=NB_CAMPAIGN_MENU_ITEM) ) selected=i;
}
}
- for(i=0;i<nummenuitems;i++){
+ for(i=0;i<nummenuitems;i++) {
if(selected==i) {
selectedlong[i]+=multiplier*5;
if(selectedlong[i]>1) selectedlong[i]=1;
}
-void Game::LoadScreenTexture(){
+void Game::LoadScreenTexture() {
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
if(!screentexture)
exit(1);
//reload opengl state
initGL();
- for(std::vector<TextureInfo>::iterator it=Game::textures.begin(); it!=Game::textures.end(); it++){
+ for(std::vector<TextureInfo>::iterator it=Game::textures.begin(); it!=Game::textures.end(); it++) {
it->load();
}
pgame->text.BuildFont();
}
Uint32 sdlflags = SDL_OPENGL;
- //TODO: commented out temporarily
- //if (!cmdline("windowed"))
- //sdlflags |= SDL_FULLSCREEN;
+
+ if (!cmdline("windowed"))
+ sdlflags |= SDL_FULLSCREEN;
SDL_WM_SetCaption("Lugaru", "Lugaru");