gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > noobs textBase drinking game

#166301 - cptblackbeard - Wed Feb 04, 2009 12:48 pm

her you go guys an good old drinking game from the netherlands (i think) on DS
i know its full of grammer and spell errors (i'm from belgium)so i got a good exuus :p
so you are all encourached to change stuff in the code.

i know its not mutch but hey gotta start somewhere right :)

enjoy.
Code:

#include <nds.h>
#include <stdio.h>
#include <stdlib.h>

void text()
{
   while (1)
   {
       swiWaitForVBlank(); time at hand
      scanKeys();
      int held = keysDown();
      if (held & KEY_TOUCH) break; // exit the loop if the touch-pad was hit
   }
}
void intro()
{
   printf("\n\n\n\n\n\n\n\n\n\n   touch screen to continue \n");
   text();
   consoleClear();
   text();
   printf("\n\n\n a long long time ago.  \n there whas a king who \n");
   printf(" had a serious alcohol problem.");
   text();
   printf("\n\n but was loved \n by all man and chicks.");
   text();
   printf("\n\n for he was the greatest\n party-animal of all animals. ");
   text();
   consoleClear();
   text();
   printf("\n\n\n the king had many offspring ");
   printf("\n for whom he did not care.");
   text();
   printf("\n\n quotte : ");
   printf("\n\n for i'm king and player \n and i shall not be enslaved \n by woman and child.");
   text();
   printf("\n\n as often happens when having a\n laugh. time flew by  ");
   text();
   printf("\n\n\n              .");text();printf(".");text();printf(".");
   text();
   printf("\n\n\n and our beloved king grew old");
   text();
   consoleClear();
   text();
   printf("\n\n\n forced by tradition. \n the old king had to choose\n a successor.");
   text();
   printf("\n\n refusing to give his legacy\n to his offspring.");
   printf("\n the wise and a bit drunk king\n wrote down a game");
   printf("\n\n\n              .");text();printf(".");text();printf(".");
   text();
   consoleClear();
   text();
   printf("\n\n for they who can clear my game.");
   text();
   printf("\n\n         WITHOUT PUKING");
   text();
   printf("\n\n\n them i will grand my legacy\n as the greatest drinkers EVER");
   printf("\n\n\n              .");text();printf(".");text();printf(".");
   text();
   consoleClear();
   text();
   printf("\n\n\n welcome to ");
   text();
   printf("\n\n\n\n\n\n\n\n\n           THE KINGS");
   
}
void theRules()
{
   text();
   consoleClear();
   printf("\n          THE RULES");
   printf("\n--------------------------------");
   printf("\n--------------------------------");
   printf("\n\n needed : ");
   printf("\n\n one filled shot glass");
   printf("\n in the middle of the table.");
   printf("\n and loads of beer.");
   printf("\n\n\n the word drink means :");
   printf("\n\n two fingers of beer.");
   printf("\n for the though guys :");
   printf("\n half a pint or advundem.");
   text();
   consoleClear();
   printf("\n          THE RULES");
   printf("\n--------------------------------");
   printf("\n--------------------------------");
   printf("\n after every turn pass the DS ");
   printf("\n to the right .");
   printf("\n the player can choose to read");
   printf("\n the lines himself before ");
   printf("\n reading them out loud.");
   printf("\n\n\n  ENJOY.");
   text();
   consoleClear();
   printf("\n          GAME STARTS ");
   printf("\n________________________________");
   printf("\n\n\n      in 3");text();printf("\n\n         2");text();printf("\n\n         1");text();
   consoleClear();   


}
void theKing()
{
   printf("\n--------------------------------");
   printf("\n          THE KING");
   printf("\n--------------------------------");
   printf("\n make up a rule. it will count\n for the whole game ");
   printf("\n\n exeptions : ");
   printf("\n\n no rules like i don't have to \n drink. or rules that are to\n difficult or cruel.");
   printf(" \n\n examples :\n\n no more swearing or you have to drink. \n when plaque comes into play\n touch the floor last one has to drink.");
   printf("\n\n !! try to keep it fun and be\n    original !!");
}
void thePlague()
{   
   printf("\n-------------------------------");
   printf("\n           THE PLAGUE");
   printf("\n--------------------------------");
   printf("\n\n the person on the right has to\n drink");
}

void thePope()
{
   printf("\n--------------------------------");
   printf("\n          THE POPE");
   printf("\n--------------------------------");
   printf("\n declare a subject the player on the right has to say something\n related to that subject.");
   printf("\n continue until someone can't\n think of anything\n he or she must drink.");
   printf("\n\n example :");
   printf("\n\n satan,lucifer,hell,Dant?...eum ");
}
void theMonk()
{
   printf("\n--------------------------------");
   printf("\n          THE MONK");
   printf("\n--------------------------------");
   printf("\n each in turn has to ryme\n on the previous word.");
   printf("\n if you can't, !!drink two!!");
}
void theMaiden()
{
   printf("\n--------------------------------");
   printf("\n          THE MAIDEN");
   printf("\n--------------------------------");
   printf("\n from now on you are the maiden.");
   printf("\n if the maiden asks a question");
   printf("\n and someone answers he or she\n has to drink");
   printf("\n if a new maiden comes into play\n he or she is the new maiden");
   printf("\n\n exeption : \n\n you can answer with a question");
}
void theBartender()
{
   printf("\n--------------------------------");
   printf("\n        THE BARTENDER");
   printf("\n--------------------------------");
   printf("\n from now on you are the\n bartender.");
   printf("\n if the bartender presses his\n thumb on the table evryone\n follows.");
   printf(" last one drinks.");
   printf("\n if a new bartender comes into\n play he or she is the\n new bartender.");
}
void theVillageIdiot()
{
   printf("\n--------------------------------");
   printf("\n        THE VILLAGE IDIOT");
   printf("\n--------------------------------");
   printf("\n at the count of three. ");
   printf("\n all point to someone of your\n choice.");
   printf("\n the one with most counts must\n drink.");
}
void theInquisitioner()
{
   printf("\n--------------------------------");
   printf("\n       THE INQUISITIONER");
   printf("\n--------------------------------");
   printf("\n\n\n\n eum... STAND UP");
   printf("\n last one drinks. ");
   printf("\n\n if its the first time you\n play kings.");
   printf("drink two\n\n (so you will never forget)");
}
void theKnight()
{
   printf("\n--------------------------------");
   printf("\n          THE KNIGHT");
   printf("\n--------------------------------");
   printf("\n\n\n this one is for your self,\n\n enjoy!");
}

void theWitch()
{
   printf("\n--------------------------------");
   printf("\n          THE WITCH");
   printf("\n--------------------------------");
   printf("\n choose another player and\n play ");
   printf("rock,paper,scissors lozer  drinks");
}
void theGame()
{
   text();
   consoleClear();
   int iRand;   int endGameCount; int i;
   int a; int b; int c; int d; int e; int f; int g; int h; int j; int k;
   
   for (i=0; endGameCount < 4 ;i++)
   {
      iRand = rand() % 10 + 1;
      if((a > 5)||(b > 4)||(c > 4)||(d > 4)||(e > 4)||(f > 4)|(g > 4)||(h > 4)||(j > 4)||(k > 4))
      {
         iRand = rand() % 10 + 1;
      }
      switch (iRand)
      {
         case 1:
            {
               theKing();
               endGameCount+=1;
               text();
               a += 1;
            }break;
         case 2:
         {
            thePlague();
            text();
            k += 1;
         }break;
         case 3:
         {
            thePope();
            text();
            b += 1;
         }break;
         case 4:
         {
            theMonk();
            text();
            c += 1;
         }break;
         case 5:
         {
            theMaiden();
            text();
            d += 1;
         }break;
         case 6:
         {
            theBartender();
            text();
            e += 1;
         }break;
         case 7:
         {
            theVillageIdiot();
            text();
            f += 1;
         }break;
         case 8:
         {
            theInquisitioner();
            text();
            g += 1;
         }break;
         case 9:
         {
            theKnight();
            text();
            h += 1;
         }break;
         case 10:
         {
            theWitch();
            text();
            j += 1;
         }break;

      }//end switch
      consoleClear();
      printf("\n          NEXT PLAYER ");
      printf("\n________________________________");
      printf("\n\n\n      in 3");text();printf("\n\n         2");text();printf("\n\n         1");text();
      consoleClear();   
   }//end for
   text();
   consoleClear();
   printf("\n\n you are the lucky one");
   printf("\n\n\n\n\n\n\n     !!! DRINK THE SHOT !!! ");
   printf("\n\n\n\n\n\n\n\n            THE END ");
   printf("\n\n\n\n\n created by cpt Blackbeard");



}
int main(void)

   consoleDemoInit();
   scanKeys();
   intro();
   theRules();
   theGame();

}