return NULL;
}
}
- printf("Unexpected error : User %s not found\n", a->getName());
+ printf("Unexpected error : User %s not found\n", a->getName().c_str());
return accounts.front();
}
tfile = fopen(filename.c_str(), "wb" );
if (tfile) {
- printf("writing %d accounts :\n", getNbAccounts());
fpackf(tfile, "Bi", getNbAccounts());
fpackf(tfile, "Bi", indice(accountactive));
for (int i = 0; i < getNbAccounts(); i++) {
Account* a = Account::get(i);
- printf("writing account %d/%d (%s)\n", i + 1, getNbAccounts(), a->getName());
+ printf("writing account %d/%d (%s)\n", i + 1, getNbAccounts(), a->getName().c_str());
fpackf(tfile, "Bi", a->difficulty);
fpackf(tfile, "Bi", a->progress);
fpackf(tfile, "Bi", a->campaignProgress.size());
void setDifficulty(int i) {
difficulty = i;
};
- const char* getName() {
- return name.c_str();
+ const std::string& getName() {
+ return name;
};
float getCampaignScore() {
return campaignProgress[currentCampaign].score;
#include "Animation.h"
struct animation_data_elt {
- const char *filename;
+ const std::string& filename;
int height;
int attack;
};
-void LoadSave(const char *fileName, GLuint *textureid, bool mipmap, GLubyte *array, int *skinsize)
+void LoadSave(const std::string& fileName, GLuint *textureid, bool mipmap, GLubyte *array, int *skinsize)
{
LOGFUNC;
Weapon::lightbloodswordtextureptr.load("Textures/SwordBloodLight.jpg", 1);
Weapon::stafftextureptr.load("Textures/Staff.jpg", 1);
- Weapon::throwingknifemodel.load((char *)"Models/ThrowingKnife.solid", 1);
+ Weapon::throwingknifemodel.load("Models/ThrowingKnife.solid", 1);
Weapon::throwingknifemodel.Scale(.001, .001, .001);
Weapon::throwingknifemodel.Rotate(90, 0, 0);
Weapon::throwingknifemodel.Rotate(0, 90, 0);
Weapon::throwingknifemodel.flat = 0;
Weapon::throwingknifemodel.CalculateNormals(1);
- Weapon::swordmodel.load((char *)"Models/Sword.solid", 1);
+ Weapon::swordmodel.load("Models/Sword.solid", 1);
Weapon::swordmodel.Scale(.001, .001, .001);
Weapon::swordmodel.Rotate(90, 0, 0);
Weapon::swordmodel.Rotate(0, 90, 0);
Weapon::swordmodel.flat = 1;
Weapon::swordmodel.CalculateNormals(1);
- Weapon::staffmodel.load((char *)"Models/Staff.solid", 1);
+ Weapon::staffmodel.load("Models/Staff.solid", 1);
Weapon::staffmodel.Scale(.005, .005, .005);
Weapon::staffmodel.Rotate(90, 0, 0);
Weapon::staffmodel.Rotate(0, 90, 0);
viewer.x = terrain.size / 2 * terrain.scale;
viewer.z = terrain.size / 2 * terrain.scale;
- hawk.load((char *)"Models/Hawk.solid", 1);
+ hawk.load("Models/Hawk.solid", 1);
hawk.Scale(.03, .03, .03);
hawk.Rotate(90, 1, 1);
hawk.CalculateNormals(0);
hawkcoords.z = terrain.size / 2 * terrain.scale - 5 - 7;
hawkcoords.y = terrain.getHeight(hawkcoords.x, hawkcoords.z) + 25;
- eye.load((char *)"Models/Eye.solid", 1);
+ eye.load("Models/Eye.solid", 1);
eye.Scale(.03, .03, .03);
eye.CalculateNormals(0);
- cornea.load((char *)"Models/Cornea.solid", 1);
+ cornea.load("Models/Cornea.solid", 1);
cornea.Scale(.03, .03, .03);
cornea.CalculateNormals(0);
- iris.load((char *)"Models/Iris.solid", 1);
+ iris.load("Models/Iris.solid", 1);
iris.Scale(.03, .03, .03);
iris.CalculateNormals(0);
hostiletime = 0;
won = 0;
- animation[bounceidleanim].Load((char *)"Idle", middleheight, neutral);
+ animation[bounceidleanim].Load("Idle", middleheight, neutral);
Dialog::dialogs.clear();
Person::players[i]->proportionlegs.z = 0;
}
- Person::players[i]->tempanimation.Load((char *)"Tempanim", 0, 0);
+ Person::players[i]->tempanimation.Load("Tempanim", 0, 0);
if (i == 0) {
Person::players[i]->headmorphness = 0;
Person::players.back()->proportionlegs.z = 0;
}
- Person::players.back()->tempanimation.Load((char *)"Tempanim", 0, 0);
+ Person::players.back()->tempanimation.Load("Tempanim", 0, 0);
Person::players.back()->damagetolerance = 200;
void updateStereoConfigMenu()
{
char sbuf[256];
- sprintf(sbuf, "Stereo mode: %s", StereoModeName(newstereomode));
+ sprintf(sbuf, "Stereo mode: %s", StereoModeName(newstereomode).c_str());
Menu::setText(0, sbuf);
sprintf(sbuf, "Stereo separation: %.3f", stereoseparation);
Menu::setText(1, sbuf);
if (selected == 0) {
newstereomode = (StereoMode)(newstereomode + 1);
while (!CanInitStereo(newstereomode)) {
- printf("Failed to initialize mode %s (%i)\n", StereoModeName(newstereomode), newstereomode);
+ printf("Failed to initialize mode %s (%i)\n", StereoModeName(newstereomode).c_str(), newstereomode);
newstereomode = (StereoMode)(newstereomode + 1);
if (newstereomode >= stereoCount)
newstereomode = stereoNone;
}
}
-bool Model::loadnotex(const char *filename )
+bool Model::loadnotex(const std::string& filename )
{
FILE *tfile;
long i;
}
-bool Model::load(const char *filename, bool texture )
+bool Model::load(const std::string& filename, bool texture )
{
FILE *tfile;
long i;
return true;
}
-bool Model::loaddecal(const char *filename, bool texture )
+bool Model::loaddecal(const std::string& filename, bool texture )
{
FILE *tfile;
long i, j;
return true;
}
-bool Model::loadraw(char *filename )
+bool Model::loadraw(const std::string& filename)
{
FILE *tfile;
long i;
void UpdateVertexArray();
void UpdateVertexArrayNoTex();
void UpdateVertexArrayNoTexNoNorm();
- bool loadnotex(const char *filename);
- bool loadraw(char *filename);
- bool load(const char *filename, bool texture);
- bool loaddecal(const char *filename, bool texture);
+ bool loadnotex(const std::string& filename);
+ bool loadraw(const std::string& filename);
+ bool load(const std::string& filename, bool texture);
+ bool loaddecal(const std::string& filename, bool texture);
void Scale(float xscale, float yscale, float zscale);
void FlipTexCoords();
void UniformTexCoords();
rotx[numobjects] = 0;
roty[numobjects] = 0;
- if (atype == boxtype) model[numobjects].loaddecal((char *)"Models/Box.solid", 0);
- if (atype == cooltype) model[numobjects].loaddecal((char *)"Models/Cool.solid", 0);
- if (atype == walltype) model[numobjects].loaddecal((char *)"Models/Wall.solid", 0);
- if (atype == tunneltype) model[numobjects].loaddecal((char *)"Models/Tunnel.solid", 0);
- if (atype == chimneytype) model[numobjects].loaddecal((char *)"Models/Chimney.solid", 0);
- if (atype == spiketype) model[numobjects].load((char *)"Models/Spike.solid", 0);
- if (atype == weirdtype) model[numobjects].loaddecal((char *)"Models/Weird.solid", 0);
- if (atype == rocktype) model[numobjects].loaddecal((char *)"Models/Rock.solid", 0);
- if (atype == treetrunktype) model[numobjects].load((char *)"Models/TreeTrunk.solid", 0);
- if (atype == treeleavestype) model[numobjects].load((char *)"Models/Leaves.solid", 0);
- if (atype == bushtype) model[numobjects].load((char *)"Models/Bush.solid", 0);
+ if (atype == boxtype) model[numobjects].loaddecal("Models/Box.solid", 0);
+ if (atype == cooltype) model[numobjects].loaddecal("Models/Cool.solid", 0);
+ if (atype == walltype) model[numobjects].loaddecal("Models/Wall.solid", 0);
+ if (atype == tunneltype) model[numobjects].loaddecal("Models/Tunnel.solid", 0);
+ if (atype == chimneytype) model[numobjects].loaddecal("Models/Chimney.solid", 0);
+ if (atype == spiketype) model[numobjects].load("Models/Spike.solid", 0);
+ if (atype == weirdtype) model[numobjects].loaddecal("Models/Weird.solid", 0);
+ if (atype == rocktype) model[numobjects].loaddecal("Models/Rock.solid", 0);
+ if (atype == treetrunktype) model[numobjects].load("Models/TreeTrunk.solid", 0);
+ if (atype == treeleavestype) model[numobjects].load("Models/Leaves.solid", 0);
+ if (atype == bushtype) model[numobjects].load("Models/Bush.solid", 0);
if (atype == boxtype) friction[numobjects] = 1.5;
if (atype == cooltype) friction[numobjects] = 1.5;
if (atype == treeleavestype) friction[numobjects] = 0;
if (atype == platformtype) {
- model[numobjects].loaddecal((char *)"Models/Platform.solid", 0);
+ model[numobjects].loaddecal("Models/Platform.solid", 0);
model[numobjects].Rotate(90, 0, 0);
}
rotx[numobjects] = 0;
roty[numobjects] = 0;
- if (atype == boxtype) model[numobjects].loaddecal((char *)"Models/Box.solid", 0);
- if (atype == cooltype) model[numobjects].loaddecal((char *)"Models/Cool.solid", 0);
- if (atype == walltype) model[numobjects].loaddecal((char *)"Models/Wall.solid", 0);
- if (atype == tunneltype) model[numobjects].loaddecal((char *)"Models/Tunnel.solid", 0);
- if (atype == chimneytype) model[numobjects].loaddecal((char *)"Models/Chimney.solid", 0);
- if (atype == spiketype) model[numobjects].load((char *)"Models/Spike.solid", 0);
- if (atype == weirdtype) model[numobjects].loaddecal((char *)"Models/Weird.solid", 0);
- if (atype == rocktype) model[numobjects].loaddecal((char *)"Models/Rock.solid", 0);
- if (atype == treetrunktype) model[numobjects].load((char *)"Models/TreeTrunk.solid", 0);
- if (atype == treeleavestype) model[numobjects].load((char *)"Models/Leaves.solid", 0);
- if (atype == bushtype) model[numobjects].load((char *)"Models/Bush.solid", 0);
+ if (atype == boxtype) model[numobjects].loaddecal("Models/Box.solid", 0);
+ if (atype == cooltype) model[numobjects].loaddecal("Models/Cool.solid", 0);
+ if (atype == walltype) model[numobjects].loaddecal("Models/Wall.solid", 0);
+ if (atype == tunneltype) model[numobjects].loaddecal("Models/Tunnel.solid", 0);
+ if (atype == chimneytype) model[numobjects].loaddecal("Models/Chimney.solid", 0);
+ if (atype == spiketype) model[numobjects].load("Models/Spike.solid", 0);
+ if (atype == weirdtype) model[numobjects].loaddecal("Models/Weird.solid", 0);
+ if (atype == rocktype) model[numobjects].loaddecal("Models/Rock.solid", 0);
+ if (atype == treetrunktype) model[numobjects].load("Models/TreeTrunk.solid", 0);
+ if (atype == treeleavestype) model[numobjects].load("Models/Leaves.solid", 0);
+ if (atype == bushtype) model[numobjects].load("Models/Bush.solid", 0);
if (atype == boxtype) friction[numobjects] = 1.5;
if (atype == cooltype) friction[numobjects] = 1.5;
friction[numobjects] = .5;
if (atype == platformtype) {
- model[numobjects].loaddecal((char *)"Models/Platform.solid", 0);
+ model[numobjects].loaddecal("Models/Platform.solid", 0);
model[numobjects].Rotate(90, 0, 0);
}
bool Person::addClothes(const int& clothesId)
{
LOGFUNC;
- const char* fileName = clothes[clothesId];
+ const std::string fileName = clothes[clothesId];
GLubyte* array = &skeleton.skinText[0];
* load skeleton
* takes filenames for three skeleton files and various models
*/
-void Skeleton::Load(const char *filename, const char *lowfilename, const char *clothesfilename,
- const char *modelfilename, const char *model2filename,
- const char *model3filename, const char *model4filename,
- const char *model5filename, const char *model6filename,
- const char *model7filename, const char *modellowfilename,
- const char *modelclothesfilename, bool clothes)
+void Skeleton::Load(const std::string& filename, const std::string& lowfilename, const std::string& clothesfilename,
+ const std::string& modelfilename, const std::string& model2filename,
+ const std::string& model3filename, const std::string& model4filename,
+ const std::string& model5filename, const std::string& model6filename,
+ const std::string& model7filename, const std::string& modellowfilename,
+ const std::string& modelclothesfilename, bool clothes)
{
GLfloat M[16];
int parentID;
void FindRotationJoint(int which);
void FindRotationJointSameTwist(int which);
void FindRotationMuscle(int which, int animation);
- void Load(const char *fileName, const char *lowfileName, const char *clothesfileName, const char *modelfileName, const char *model2fileName, const char *model3fileName, const char *model4fileName, const char *model5fileNamee, const char *model6fileName, const char *model7fileName, const char *modellowfileName, const char *modelclothesfileName, bool aclothes);
+ void Load(const std::string& fileName, const std::string& lowfileName, const std::string& clothesfileName, const std::string& modelfileName, const std::string& model2fileName, const std::string& model3fileName, const std::string& model4fileName, const std::string& model5fileNamee, const std::string& model6fileName, const std::string& model7fileName, const std::string& modellowfileName, const std::string& modelclothesfileName, bool aclothes);
/*
// unused
extern float skyboxg;
extern float skyboxb;
-void SkyBox::load (const char *ffront, const char *fleft, const char *fback,
- const char *fright, const char *fup, const char *fdown)
+void SkyBox::load (const std::string& ffront, const std::string& fleft, const std::string& fback,
+ const std::string& fright, const std::string& fup, const std::string& fdown)
{
front.load(ffront, true);
left.load(fleft, true);
public:
Texture front, left, back, right, up, down;
- void load(const char *ffront, const char *fleft, const char *fback,
- const char *fright, const char *fup, const char *fdown);
+ void load(const std::string& ffront, const std::string& fleft, const std::string& fback,
+ const std::string& fright, const std::string& fup, const std::string& fdown);
void draw();
SkyBox() {}
}
-const char* StereoModeName(StereoMode mode)
+const std::string StereoModeName(StereoMode mode)
{
switch (mode) {
case stereoNone:
bool CanInitStereo(StereoMode mode);
void InitStereo(StereoMode mode);
-const char* StereoModeName(StereoMode mode);
+const std::string StereoModeName(StereoMode mode);
#endif
}
-bool Terrain::load(const char *fileName)
+bool Terrain::load(const std::string& fileName)
{
static long i, j;
static long x, y;
void UpdateTransparency(int whichx, int whichy);
void UpdateTransparencyother(int whichx, int whichy);
void UpdateTransparencyotherother(int whichx, int whichy);
- bool load(const char *fileName);
+ bool load(const std::string& fileName);
void CalculateNormals();
void drawdecals();
void draw(int layer);
#include "Text.h"
#include "Game.h"
-void Text::LoadFontTexture(const char *fileName)
+void Text::LoadFontTexture(const std::string& fileName)
{
LOGFUNC;
Texture FontTexture;
GLuint base;
- void LoadFontTexture(const char *fileName);
+ void LoadFontTexture(const std::string& fileName);
void BuildFont();
void glPrint(float x, float y, const char *string, int set, float size, float width, float height);
void glPrintOutline(float x, float y, const char *string, int set, float size, float width, float height);