void setFontFace(const char *ttf);
void setFontSize(unsigned int size);
+ void setFontColor(unsigned char r,unsigned char g,unsigned char b, unsigned char a);
-
/*
* Draw a centered string.
*/
void dialogBox(const char *name,const char *opt,bool passive,const char *text,...);
void merchantBox(const char *name,Trade trade,const char *opt,bool passive,const char *text,...);
void merchantBox();
+ void closeBox();
void waitForDialog(void);
-
+ void drawPage( std::string path );
/*
* Draws a larger string in the center of the screen. Drawing is done inside this function.
*/
//currentWorld->mob.back()->followee = player;
gameRunning = true;
- while(gameRunning){
-
- while ( gameRunning )
-- mainLoop();
- }
++
++ while(gameRunning)mainLoop();
/**************************
**** CLOSE PROGRAM ****
prevPrevTime = currentTime;
}
-
- currentWorld->update(player,deltaTime);
+ /*
+ * Update player and entity coordinates.
+ */
+
+ /*pool.Enqueue([](){
+ currentWorld->update(player,deltaTime);
+ });*/
+ currentWorld->update( player, deltaTime );
/*
* Update debug variables if necessary
for(int r = 0; r < (rand()%30)+15;r++)
currentWorld->addParticle(rand()%HLINE*3 + n->loc.x - .05f,n->loc.y + n->height*.5, HLINE,HLINE, -(rand()%10)*.01,((rand()%10)*.01-.05), {(rand()%75)+10/100.0f,0,0}, 10000);
}
- }*/
-
+ }
-
/*
* Don't bother handling the NPC if another has already been handled.
*/
int dialogPassiveTime = 0;
Trade merchTrade;
+ int fontTransInv = 255;
-
/*
* Dialog stuff that needs to be 'public'.
*/
* Loop on each character:
*/
- do {
+ do{
if(i && ((i / 110.0) == (i / 110))){
- yo-=fontSize*1.05;
- xo=x;
+ o.y -= fontSize * 1.05f;
+ o.x = x;
if(s[i] == ' ')
i++;
}
unsigned int i = 0;
float width = 0;
- do{
- if(s[i]=='\n'){ // Handle newlines
+ do {
+ switch ( s[i] ) {
+ case '\n':
// TODO
- }else if(s[i]==' '){ // Handle spaces
- width+=fontSize/2;
- }else if(s[i]=='\b'){ // Handle backspaces?
- // Why?
- // Cuz
- }else{
- width+=ftexwh[i].x+fontSize*.1;
+ break;
+ case '\b':
+ break;
+ case ' ':
+ width += fontSize / 2;
+ break;
+ default:
+ width += ftexwh[i].x + fontSize * 0.1f;
+ break;
}
- }while(s[++i]);
-
+ } while(s[++i]);
-
putString(floor(x-width/2),y,s);
return width;
}
fclose(bmp);
}
+ void closeBox(){
+ dialogBoxExists = false;
+ dialogMerchant = false;
+ }
+
void dialogAdvance(void){
unsigned char i;
+
+ if ( pageTex ) {
+ glDeleteTextures( 1, &pageTex );
+ pageTex = 0;
+ return;
+ }
+
if(!typeOutDone){
typeOutDone = true;
return;
Mix_FreeMusic(bgmObj);
delete bgTex;
-
- delete[] toLeft;
- delete[] toRight;
--
deleteEntities();
}
if ( e->loc.y < worldData[i].groundHeight ) {
- e->loc.y= worldData[i].groundHeight - .001 * deltaTime;
- e->ground=true;
- e->vel.y=0;
- if ( worldData[i].groundHeight - e->loc.y > 30 ) {
- int dir = e->vel.x > 0 ? -1 : 1;
- e->loc.x += HLINE * 8 * dir;
- e->loc.y = worldData[i + 8 * dir].groundHeight;
- } else {
- e->loc.y = worldData[i].groundHeight - .001 * deltaTime;
- e->ground = true;
- e->vel.y = 0;
- }
++ if ( worldData[i].groundHeight - e->loc.y > 30 ) {
++ int dir = e->vel.x > 0 ? -1 : 1;
++ e->loc.x += HLINE * 8 * dir;
++ e->loc.y = worldData[i + 8 * dir].groundHeight;
++ } else {
++ e->loc.y = worldData[i].groundHeight - .001 * deltaTime;
++ e->ground = true;
++ e->vel.y = 0;
++ }
/*
* Handle gravity if the entity is above the line.
*/
- } else {
-
+ }else{
-
if(e->type == STRUCTURET && e->loc.y > 2000){
e->loc.y = worldData[i].groundHeight;
e->vel.y = 0;
}
}
- char *World::setToLeft(const char *file){
- if(toLeft)
- delete[] toLeft;
- if(!file)
- return (toLeft = NULL);
-
- strcpy((toLeft = new char[strlen(file) + 1]),file);
- return toLeft;
+ std::string World::
+ setToLeft( std::string file )
+ {
+ return (toLeft = file);
}
- char *World::setToRight(const char *file){
- if(toRight)
- delete[] toRight;
- if(!file)
- return (toRight = NULL);
-
- strcpy((toRight = new char[strlen(file) + 1]),file);
- return toRight;
+
+ std::string World::
+ setToRight( std::string file )
+ {
+ return (toRight = file);
}
+//what is this clyne why are they differnet
World *World::
goWorldLeft( Player *p )
{
data.append(std::to_string((int)m->alive) + "\n");
}
- std::cout << "Ending file" << std::endl;
data.append("dOnE\0");
+ std::cout << "Writing to the file" << std::endl;
out.write(data.c_str(),data.size());
- std::cout << "Closing file" << std::endl;
out.close();
+ std::cout << "Done saving" << std::endl;
}
void World::load(void){