extern WEATHER weather;
extern bool fadeEnable;
+extern bool fadeWhite;
+extern bool fadeFast;
extern unsigned int fadeIntensity;
/*******************************************************************************
*/
if(fadeIntensity){
- glColor4ub(0,0,0,fadeIntensity);
+ if(fadeWhite)
+ glColor4ub(255,255,255,fadeIntensity);
+ else
+ glColor4ub(0,0,0,fadeIntensity);
glRectf(offset.x-SCREEN_WIDTH /2,
offset.y-SCREEN_HEIGHT/2,
offset.x+SCREEN_WIDTH /2,
* Transition to and from black if necessary.
*/
if(fadeEnable){
- if(fadeIntensity < 160)fadeIntensity+=10;
- else if(fadeIntensity < 255)fadeIntensity+=5;
+ if(fadeIntensity < 150)fadeIntensity+=fadeFast?30:10;
+ else if(fadeIntensity < 255)fadeIntensity+=fadeFast?15:5;
}else{
- if(fadeIntensity > 150)fadeIntensity-=5;
- else if(fadeIntensity > 0) fadeIntensity-=10;
+ if(fadeIntensity > 150)fadeIntensity-=fadeFast?15:5;
+ else if(fadeIntensity > 0) fadeIntensity-=fadeFast?30:10;
}
/*
*/
bool fadeEnable = false;
+bool fadeWhite = false;
+bool fadeFast = false;
unsigned int fadeIntensity = 0;
bool inBattle = false;
mainLoop();
}while(ui::dialogBoxExists);
}
+ void waitForCover(void){
+ do{
+ mainLoop();
+ }while(fadeIntensity != 255);
+ }
void importantText(const char *text,...){
va_list textArgs;
Mix_PlayChannel(1,dialogClick,0);
}
- }else if(!dialogImportant){
+ }else if(!dialogImportant && !fadeIntensity){
vec2 hub = {
(SCREEN_WIDTH/2+offset.x)-fontSize*10,
}
}
}
+ void dialogAdvance(void){
+ unsigned char i;
+ if(!typeOutDone){
+ typeOutDone = true;
+ return;
+ }
+
+ for(i=0;i<dialogOptCount;i++){
+ if(mouse.x > dialogOptLoc[i][0] &&
+ mouse.x < dialogOptLoc[i][2] &&
+ mouse.y > dialogOptLoc[i][1] &&
+ mouse.y < dialogOptLoc[i][1] + 16 ){ // fontSize
+ dialogOptChosen = i + 1;
+ goto DONE;
+ }
+ }
+DONE:
+ if(dialogImportant){
+ dialogImportant = false;
+ setFontSize(16);
+ toggleBlack();
+ }
+ dialogBoxExists = false;
+ }
void handleEvents(void){
static bool left=true,right=false;
static vec2 premouse={0,0};
static int heyOhLetsGo = 0;
- unsigned char i;
World *tmp;
SDL_Event e;
break;
case SDL_MOUSEBUTTONDOWN:
if((e.button.button&SDL_BUTTON_RIGHT)&&dialogBoxExists){
-
- if(!typeOutDone){
- typeOutDone = true;
- break;
- }
-
- for(i=0;i<dialogOptCount;i++){
- if(mouse.x > dialogOptLoc[i][0] &&
- mouse.x < dialogOptLoc[i][2] &&
- mouse.y > dialogOptLoc[i][1] &&
- mouse.y < dialogOptLoc[i][1] + 16 ){ // fontSize
- dialogOptChosen = i + 1;
- goto DONE;
- }
- }
-DONE:
- if(dialogImportant){
- dialogImportant = false;
- setFontSize(16);
- toggleBlack();
- }
- dialogBoxExists = false;
+ dialogAdvance();
}
break;
/*
case SDL_KEYDOWN:
if(SDL_KEY == SDLK_ESCAPE){
gameRunning = false;
+ return;
+ }else if(SDL_KEY == SDLK_SPACE){
+ if(dialogBoxExists)
+ dialogAdvance();
+ else if(player->ground){
+ player->vel.y=.4;
+ player->loc.y+=HLINE*2;
+ player->ground=false;
+ }
break;
}else if(!dialogBoxExists){//&&!fadeEnable){
switch(SDL_KEY){
- case SDLK_ESCAPE:
- gameRunning=false;
- break;
case SDLK_a:
player->vel.x=-.15;
player->left = true;
currentWorld=((Arena *)currentWorld)->exitArena(player);
else currentWorld=currentWorld->goInsideStructure(player);
break;
- case SDLK_SPACE:
- if(player->ground){
- player->vel.y=.4;
- player->loc.y+=HLINE*2;
- player->ground=false;
- }
- break;
case SDLK_i:
tmp=currentWorld;
currentWorld=currentWorld->goWorldBack(player); // Go back a layer if possible
void toggleBlack(void){
fadeEnable ^= true;
+ fadeWhite = false;
+ fadeFast = false;
+ }
+ void toggleBlackFast(void){
+ fadeEnable ^= true;
+ fadeWhite = false;
+ fadeFast = true;
+ }
+ void toggleWhite(void){
+ fadeEnable ^= true;
+ fadeWhite = true;
+ fadeFast = false;
}
}