extern int mainmenu;
extern int oldmainmenu;
extern bool visibleloading;
-extern int loadscreencolor;
extern float flashamount,flashr,flashg,flashb;
extern int flashdelay;
extern int whichjointstartarray[26];
}
-Game::TextureList Game::textures;
-
void Game::Dispose()
{
- int i,j;
-
LOGFUNC;
if(endgame==2){
Account::saveFile(":Data:Users", accountactive);
- TexIter it = textures.begin();
- for (; it != textures.end(); ++it)
- {
- if (glIsTexture(it->second))
- glDeleteTextures(1, &it->second);
- }
- textures.clear();
+ //textures.clear();
LOG("Shutting down sound system...");
// later in the shutdown process. --ryan.
#if !PLATFORM_LINUX
- for (i=0; i < sounds_count; ++i)
+ for (int i=0; i < sounds_count; ++i)
{
OPENAL_Sample_Free(samp[i]);
}
}
-void Game::LoadTexture(const char *fileName, GLuint *textureid,int mipmap, bool hasalpha)
+void Game::LoadTexture(const char *fileName, GLuint *textureid,int mipmap, bool hasalpha){
+ textures.push_back(TextureInfo(fileName,textureid,mipmap,hasalpha));
+ textures.back().load();
+}
+
+void Game::LoadTextureSave(const char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize){
+ textures.push_back(TextureInfo(fileName,textureid,mipmap,array,skinsize));
+ textures.back().load();
+}
+
+void Game::LoadTextureData(const char *fileName, GLuint *textureid,int mipmap, bool hasalpha)
{
GLuint type;
}
}
-void Game::LoadTextureSave(const char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize)
+void Game::LoadTextureSaveData(const char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize, bool reload)
{
GLuint type;
int i;
if(!mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
int tempnum=0;
- for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
- if((i+1)%4||type==GL_RGB){
- array[tempnum]=texture.data[i];
- tempnum++;
- }
- }
+ if(!reload)
+ for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++)
+ if((i+1)%4||type==GL_RGB){
+ array[tempnum]=texture.data[i];
+ tempnum++;
+ }
*skinsize=texture.sizeX;
}
}
-bool Game::AddClothes(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
+bool Game::AddClothes(const char *fileName, GLubyte *array)
{
int i;
int bytesPerPixel;
void Game::LoadingScreen()
{
- static float loadprogress,minprogress,maxprogress;
+ static float loadprogress;
static AbsoluteTime time = {0,0};
static AbsoluteTime frametime = {0,0};
AbsoluteTime currTime = UpTime ();
if(multiplier>.05){
frametime = currTime; // reset for next time interval
- float size=1;
glLoadIdentity();
//Clear to black
glClearColor(0,0,0,1);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_BLEND);
glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
- //glColor4f(1,1,1,1);
- /*if(loadscreencolor==0)glColor4f(1,1,1,1);
- if(loadscreencolor==1)glColor4f(1,0,0,1);
- if(loadscreencolor==2)glColor4f(0,1,0,1);
- if(loadscreencolor==3)glColor4f(0,0,1,1);
- if(loadscreencolor==4)glColor4f(1,1,0,1);
- if(loadscreencolor==5)glColor4f(1,0,1,1);
- */
glPushMatrix();
//glScalef(.25,.25,.25);
glBegin(GL_QUADS);
glEnable(GL_BLEND);
//glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
glColor4f(loadprogress/100,loadprogress/100,loadprogress/100,1);
- /*if(loadscreencolor==0)glColor4f(1,1,1,1);
- if(loadscreencolor==1)glColor4f(1,0,0,1);
- if(loadscreencolor==2)glColor4f(0,1,0,1);
- if(loadscreencolor==3)glColor4f(0,0,1,1);
- if(loadscreencolor==4)glColor4f(1,1,0,1);
- if(loadscreencolor==5)glColor4f(1,0,1,1);
- */
glPushMatrix();
//glScalef(.25,.25,.25);
glBegin(GL_QUADS);
glDepthMask(1);
//Text
- /*
- glEnable(GL_TEXTURE_2D);
- static char string[256]="";
- sprintf (string, "LOADING... %d%",(int)loadprogress);
- glColor4f(1,1,1,.2);
- text.glPrint(280-280*loadprogress/100/2/4,125-125*loadprogress/100/2/4,string,1,1+loadprogress/100,640,480);
- glColor4f(1.2-loadprogress/100,1.2-loadprogress/100,1.2-loadprogress/100,1);
- text.glPrint(280,125,string,1,1,640,480);
- */
if(flashamount>0){
if(flashamount>1)flashamount=1;
}
swap_gl_buffers();
- loadscreencolor=0;
}
}
void Game::FadeLoadingScreen(float howmuch)
{
- static float loadprogress,minprogress,maxprogress;
+ static float loadprogress;
- float size=1;
glLoadIdentity();
//Clear to black
glClearColor(0,0,0,1);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_BLEND);
glColor4f(loadprogress/100,0,0,1);
- /*if(loadscreencolor==0)glColor4f(1,1,1,1);
- if(loadscreencolor==1)glColor4f(1,0,0,1);
- if(loadscreencolor==2)glColor4f(0,1,0,1);
- if(loadscreencolor==3)glColor4f(0,0,1,1);
- if(loadscreencolor==4)glColor4f(1,1,0,1);
- if(loadscreencolor==5)glColor4f(1,0,1,1);
- */
glPushMatrix();
//glScalef(.25,.25,.25);
glBegin(GL_QUADS);
glDisable(GL_BLEND);
glDepthMask(1);
//Text
- /*
- glEnable(GL_TEXTURE_2D);
- static char string[256]="";
- sprintf (string, "LOADING... %d%",(int)loadprogress);
- glColor4f(1,1,1,.2);
- text.glPrint(280-280*loadprogress/100/2/4,125-125*loadprogress/100/2/4,string,1,1+loadprogress/100,640,480);
- glColor4f(1.2-loadprogress/100,1.2-loadprogress/100,1.2-loadprogress/100,1);
- text.glPrint(280,125,string,1,1,640,480);
- */
swap_gl_buffers();
- loadscreencolor=0;
}
autocam=0;
- int i,j;
-
numchallengelevels=14;
accountactive=Account::loadFile(":Data:Users");
loadAllSounds();
if(musictoggle)
- emit_stream_np(stream_music3);
+ emit_stream_np(stream_menutheme);
LoadTexture(":Data:Textures:Cursor.png",&cursortexture,0,1);
LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0);
LoadTexture(":Data:Textures:Options.png",&Mainmenuitems[2],0,0);
LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0);
- LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
LoadTexture(":Data:Textures:Eyelid.png",&Mainmenuitems[4],0,1);
//LoadTexture(":Data:Textures:Eye.jpg",&Mainmenuitems[5],0,1);
+ //~ LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0); // LoadCampaign will take care of that
texdetail=temptexdetail;
- loaddistrib=0;
- anim=0;
-
FadeLoadingScreen(95);
}
+void Game::LoadScreenTexture() {
+ glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
+
+ if(!screentexture)
+ glGenTextures( 1, &screentexture );
+ glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
+
+
+ glEnable(GL_TEXTURE_2D);
+ glBindTexture( GL_TEXTURE_2D, screentexture);
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
+
+ glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
+}
+
void Game::LoadStuff()
{
static float temptexdetail;
static float viewdistdetail;
- static int i,j,texsize;
+ static int i,j;
float megascale =1;
LOGFUNC;
LOG("Loading weapon data...");
- LoadTexture(":Data:Textures:knife.png",&weapons.knifetextureptr,0,1);
- LoadTexture(":Data:Textures:bloodknife.png",&weapons.bloodknifetextureptr,0,1);
- LoadTexture(":Data:Textures:lightbloodknife.png",&weapons.lightbloodknifetextureptr,0,1);
- LoadTexture(":Data:Textures:sword.jpg",&weapons.swordtextureptr,1,0);
- LoadTexture(":Data:Textures:Swordblood.jpg",&weapons.bloodswordtextureptr,1,0);
- LoadTexture(":Data:Textures:Swordbloodlight.jpg",&weapons.lightbloodswordtextureptr,1,0);
- LoadTexture(":Data:Textures:Staff.jpg",&weapons.stafftextureptr,1,0);
-
- weapons.throwingknifemodel.load((char *)":Data:Models:throwingknife.solid",1);
- weapons.throwingknifemodel.Scale(.001,.001,.001);
- //weapons.throwingknifemodel.Rotate(0,0,-90);
- weapons.throwingknifemodel.Rotate(90,0,0);
- weapons.throwingknifemodel.Rotate(0,90,0);
- weapons.throwingknifemodel.flat=0;
- weapons.throwingknifemodel.CalculateNormals(1);
- //weapons.throwingknifemodel.ScaleNormals(-1,-1,-1);
-
- weapons.swordmodel.load((char *)":Data:Models:sword.solid",1);
- weapons.swordmodel.Scale(.001,.001,.001);
- //weapons.swordmodel.Rotate(0,0,-90);
- weapons.swordmodel.Rotate(90,0,0);
- weapons.swordmodel.Rotate(0,90,0);
- weapons.swordmodel.Rotate(0,0,90);
- weapons.swordmodel.flat=1;
- weapons.swordmodel.CalculateNormals(1);
- //weapons.swordmodel.ScaleNormals(-1,-1,-1);
-
- weapons.staffmodel.load((char *)":Data:Models:staff.solid",1);
- weapons.staffmodel.Scale(.005,.005,.005);
- //weapons.staffmodel.Rotate(0,0,-90);
- weapons.staffmodel.Rotate(90,0,0);
- weapons.staffmodel.Rotate(0,90,0);
- weapons.staffmodel.Rotate(0,0,90);
- weapons.staffmodel.flat=1;
- weapons.staffmodel.CalculateNormals(1);
- //weapons.staffmodel.ScaleNormals(-1,-1,-1);
+ LoadTexture(":Data:Textures:knife.png",&Weapon::knifetextureptr,0,1);
+ LoadTexture(":Data:Textures:bloodknife.png",&Weapon::bloodknifetextureptr,0,1);
+ LoadTexture(":Data:Textures:lightbloodknife.png",&Weapon::lightbloodknifetextureptr,0,1);
+ LoadTexture(":Data:Textures:sword.jpg",&Weapon::swordtextureptr,1,0);
+ LoadTexture(":Data:Textures:Swordblood.jpg",&Weapon::bloodswordtextureptr,1,0);
+ LoadTexture(":Data:Textures:Swordbloodlight.jpg",&Weapon::lightbloodswordtextureptr,1,0);
+ LoadTexture(":Data:Textures:Staff.jpg",&Weapon::stafftextureptr,1,0);
+
+ Weapon::throwingknifemodel.load((char *)":Data:Models:throwingknife.solid",1);
+ Weapon::throwingknifemodel.Scale(.001,.001,.001);
+ //Weapon::throwingknifemodel.Rotate(0,0,-90);
+ Weapon::throwingknifemodel.Rotate(90,0,0);
+ Weapon::throwingknifemodel.Rotate(0,90,0);
+ Weapon::throwingknifemodel.flat=0;
+ Weapon::throwingknifemodel.CalculateNormals(1);
+ //Weapon::throwingknifemodel.ScaleNormals(-1,-1,-1);
+
+ Weapon::swordmodel.load((char *)":Data:Models:sword.solid",1);
+ Weapon::swordmodel.Scale(.001,.001,.001);
+ //Weapon::swordmodel.Rotate(0,0,-90);
+ Weapon::swordmodel.Rotate(90,0,0);
+ Weapon::swordmodel.Rotate(0,90,0);
+ Weapon::swordmodel.Rotate(0,0,90);
+ Weapon::swordmodel.flat=1;
+ Weapon::swordmodel.CalculateNormals(1);
+ //Weapon::swordmodel.ScaleNormals(-1,-1,-1);
+
+ Weapon::staffmodel.load((char *)":Data:Models:staff.solid",1);
+ Weapon::staffmodel.Scale(.005,.005,.005);
+ //Weapon::staffmodel.Rotate(0,0,-90);
+ Weapon::staffmodel.Rotate(90,0,0);
+ Weapon::staffmodel.Rotate(0,90,0);
+ Weapon::staffmodel.Rotate(0,0,90);
+ Weapon::staffmodel.flat=1;
+ Weapon::staffmodel.CalculateNormals(1);
+ //Weapon::staffmodel.ScaleNormals(-1,-1,-1);
//temptexdetail=texdetail;
//if(texdetail>4)texdetail=4;
}
}
- loadscreencolor=4;
LoadingScreen();
for(i=0;i<player[0].skeleton.num_joints;i++){
}
}
- loadscreencolor=4;
LoadingScreen();
for(i=0;i<player[0].skeleton.num_joints;i++){
animation[swordsneakattackanim].position[i][j]+=moveamount;
}
}
- loadscreencolor=4;
LoadingScreen();
for(j=0;j<animation[swordsneakattackanim].numframes;j++){
animation[swordsneakattackanim].weapontarget[j]+=moveamount;
}
- loadscreencolor=4;
LoadingScreen();
for(i=0;i<player[0].skeleton.num_joints;i++){
animation[swordsneakattackedanim].position[i][j]+=moveamount;
}
}
- /*
- for(i=0;i<player[0].skeleton.num_joints;i++){
- for(j=0;j<animation[sleepanim].numframes;j++){
- animation[sleepanim].position[i][j]=DoRotation(animation[sleepanim].position[i][j],0,180,0);
- }
- }
- */
- loadscreencolor=4;
+
LoadingScreen();
temptexdetail=texdetail;
texdetail=1;
texdetail=temptexdetail;
- loadscreencolor=4;
LoadingScreen();
//if(ismotionblur){
if(!screentexture){
- glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
-
- glGenTextures( 1, &screentexture );
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
-
-
- glEnable(GL_TEXTURE_2D);
- glBindTexture( GL_TEXTURE_2D, screentexture);
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
-
- glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
+ LoadScreenTexture();
}
if(targetlevel!=7){