Ejemplo n.º 1
0
/**
 * This function checks all contacts.
 *
 * @param	notify			- notification type
 *
 * @return	nothing
 **/
VOID SvcReminderCheckAll(const ENotify notify)
{
    if (gRemindOpts.RemindState != REMIND_OFF)
    {
        HANDLE hContact;
        CEvent evt;
        MTime now;
        WORD a1 = 0;

        now.GetLocalTime();

        //walk through all the contacts stored in the DB
        for (hContact = DB::Contact::FindFirst();
                hContact != NULL;
                hContact = DB::Contact::FindNext(hContact))
        {
            CheckContact(hContact, now, evt, notify != NOTIFY_CLIST, &a1);
        }

        if (notify != NOTIFY_CLIST)
        {
            // play sound for the next anniversary
            NotifyWithSound(evt);

            // popup anniversary list
            if (DB::Setting::GetByte(SET_ANNIVLIST_POPUP, FALSE))
            {
                DlgAnniversaryListShow(0, 0);
            }

            if (evt._wDaysLeft > gRemindOpts.wDaysEarlier && notify == NOTIFY_NOANNIV)
            {
                NotifyWithPopup(NULL, CEvent::NONE, 0, NULL, TranslateT("No anniversaries to remind of"));
            }
        }
        UpdateTimer(FALSE);
    }
}
Ejemplo n.º 2
0
// ************* Buttons *************
// this is the major function that handles the button presses
// such as movements, attack, and mute, this function will
// also check if the game has been won or lost and restart
// the input is an int containing buttons that were pressed
void Buttons(int keyPressed){
  if (gameEnd == WON){ // win
    DisableInterrupts();
    ClearLCDgameStarted();
    // displays win banner
    LCD12864ImageDraw(&display[0],&room[0],&youWin[0],WIN_X,WIN_Y,WIN_WIDTH,WIN_HEIGHT);
    LCD12864PartUpdate(&display[0],WIN_X,WIN_Y,WIN_WIDTH,WIN_HEIGHT);
    SysTick_Wait10ms((GAME_RESTART_DELAY)/10);    // wait 2 seconds to start game over
    Game_Init();
    keyPressed = 0;
    EnableInterrupts();
    Music_Play();
  }
  else if (gameEnd == LOST){  // lose
    DisableInterrupts();
    ClearLCDgameStarted();
    // displays lose banner
    LCD12864ImageDraw(&display[0],&room[0],&gameOver[0],LOSE_X,LOSE_Y,LOSE_WIDTH,LOSE_HEIGHT);
    LCD12864PartUpdate(&display[0],LOSE_X,LOSE_Y,LOSE_WIDTH,LOSE_HEIGHT);
    SysTick_Wait10ms((GAME_RESTART_DELAY)/10);    // wait 2 seconds to start game over
    Game_Init();
    keyPressed = 0;
    EnableInterrupts();
    Music_Play();
  }
  
  // the following handles the inputs from the user
  
  // up button moves link up
  if ((keyPressed&UP) && gameStarted){
    MoveUp();
  }
  // down button moves link down
  if ((keyPressed&DOWN) && gameStarted){
    MoveDown();
  }
  // left button moves link to the left
  if ((keyPressed&LEFT) && gameStarted){
    MoveLeft();
  }
  // right button moves link to the right
  if ((keyPressed&RIGHT) && gameStarted){
    MoveRight();
  }
  // "A" button attacks with sword
  if ((keyPressed&A) && gameStarted){
    PressA();
  }
  // starts the game
  else if((keyPressed&A) && !gameStarted){
    LCD12864ImageDraw(&display[0],&room[0],&room[0],0,0,LCD_WIDTH,LCD_HEIGHT);                          // draw room
    LCD12864ImageDraw(&display[0],&room[0],Link.Graphic,Link.Xpos,Link.Ypos,Link.Width,Link.Height);     // draw link
    LCD12864Refresh(&display[0]);                                                                       // display
    SysTick_Wait10ms(50);  
    LCD12864ImageDraw(&display[0],&room[0],Boss.Graphic,Boss.Xpos,Boss.Ypos,Boss.Width,Boss.Height);    // draw boss
    LCD12864Refresh(&display[0]);
    Change_Song(1);
    LCD12864GameStart();
    Timer1A_Enable();
    gameStarted = 1;
  }
  // "B" button mutes the game music
  if ((keyPressed&B) && gameStarted){
    PressB();
    ClearB();
  }
  // updates the screen when Link moves
  if(keyPressed && gameStarted){
    LCD12864ImageDraw(&display[0],&room[0],Link.Graphic,Link.Xpos,Link.Ypos,Link.Width,Link.Height);
    LCD12864PartUpdate(&display[0],Link.Xpos,Link.Ypos,Link.Width,Link.Height);
    CheckContact();
    SysTick_Wait10ms((LINK_SPEED)/10);  // time to wait until next movement
  }
}