Example #1
0
void DebugMenu()
{
    char GetMyChar();

    do {
        printf("\n\t----- Module DEBUGGER for %s -----\n\n", kGameName);

        printf("\n\n\tb)\t(B)ack = Return to previous activity.\n");
        printf("\n\nSelect an option: ");

        switch(GetMyChar())
        {
        case 'Q':
        case 'q':
            ExitStageRight();
        case 'H':
        case 'h':
            HelpMenus();
            break;
        case 'B':
        case 'b':
            return;
        default:
            BadMenuChoice();
            HitAnyKeyToContinue();
            break;
        }
    } while(TRUE);

}
Example #2
0
void GameSpecificMenu (){
	char c;
	BOOLEAN cont = TRUE;
	while(cont) {
		printf("\n\nCurrent %dx%d board:  \n", width, length);
		PrintPosition(gInitialPosition, "Gamesman", 0);
		printf("\tGame Options:\n\n"
		       "\tc)\t(C)hange the board size (nxn), currently: %dx%d\n"
		       //"\ti)\tSet the (I)nitial position\n"
		       "\tr)\t(R)eset to default settings\n"
		       "\tb)\t(B)ack to the main menu\n"
		       "\nSelect an option:  ", width, length);
		c = GetMyChar();
		switch(c) {
		case 'c': case 'C':
			ChangeBoardSize();
			break;
		case 'i': case 'I':
			GetInitialPosition();
			break;
		case 'r': case 'R':
			Reset();
			SetupGame();
			break;
		case 'b': case 'B':
			cont = FALSE;
			break;
		default:
			printf("Invalid option!\n");
		}
	}
	//InitializeHelpStrings();
}
Example #3
0
void modifyBoardSize() {
    char command = 'Z';
    do {
        printf("\n\t----- Editing board -----\n\n");
        printf("\tr)\tChange (R)ows (currently %d)\n", boardrows);
        printf("\tc)\tChange (C)olumns (currently %d)\n\n", boardcols);
        printf("\tb)\tGo (B)ack to previous screen\n\n");
        printf("Please select an option: ");

        command = toupper(GetMyChar());

        switch (command) {

        case 'R':
            getIntVal(&boardrows);
            command = 'Z';
            break;

        case 'C':
            getIntVal(&boardcols);
            command = 'Z';
            break;

        case 'B':
            return;

        default:
            printf("\nI don't understand %c - please choose another option.\n", command);
            command = 'Z';

        }

    } while (1);

}
Example #4
0
// SUNIL: NOT WRITING
void GameSpecificMenu()
{
	char option;
	int newrows;
	do
	{
		printf("Currently you have %d rows. Rows can range between %d and %d\n", rows, MIN_ROWS, MAX_ROWS);
		printf("Would you like to change it [y/n]? ");
		option = GetMyChar();
		option = toupper(option);
		if(option == 'Y')
		{
			do
			{
				printf("Enter new number of rows [%d-%d] : ", MIN_ROWS, MAX_ROWS);
				newrows = GetMyInt();
			} while(newrows > MAX_ROWS || newrows < MIN_ROWS);
			rows = newrows;
		}
		else if(option != 'N')
		{
			printf("Invalid option. Please try again.\n");
		}
	} while(option != 'N');
}
Example #5
0
void configureSwapRule() {
    char command = 'Z';
    do {
        printf("\n\t----- Configuring Swaprule -----\n\n");

        printf("\tSwapmode is currently \"Swap %s\"\n\n", swapmodeToString(swapmode));

        printf("\tt)\tChange (T)urn when swap is offered (currently %d)\n\n", swapturn+1);

        if(swapmode != SWAP_BOTH) printf("\ta)\tChange mode to \"Swap direction (A)nd color\"\n");
        if(swapmode != SWAP_DIRECTION) printf("\td)\tChange mode to \"Swap (D)irection only\"\n");
        if(swapmode != SWAP_COLOR) printf("\tc)\tChange mode to \"Swap (C)olor only\"\n");
        if(swapmode != SWAP_NONE) printf("\tn)\tChange mode to \"No swaprule\"\n\n");

        printf("\tb)\tGo (B)ack to previous screen\n\n");

        printf("Please select an option: ");

        command = toupper(GetMyChar());

        switch(command) {

        case 'T':
            getIntVal(&swapturn);
            swapturn--;
            command = 'Z';
            break;

        case 'A':
            swapmode = SWAP_BOTH;
            command = 'Z';
            break;

        case 'D':
            swapmode = SWAP_DIRECTION;
            command = 'Z';
            break;

        case 'C':
            swapmode = SWAP_COLOR;
            command = 'Z';
            break;

        case 'B':
            return;

        default:
            printf("\nI don't understand %c - please choose another option.\n", command);
            command = 'Z';
            break;

        }

    } while(1);

}
Example #6
0
void WorldSession::SendEmote(uint32 id)
{
    if(!_logged)
        return;
    WorldPacket packet;
    int32 variation = 0; // randomized usually
    packet << id << (uint32)variation << GetMyChar()->GetTarget();
    packet.SetOpcode(CMSG_TEXT_EMOTE);
    SendWorldPacket(packet);
}
Example #7
0
void GameSpecificMenu()
{
	do {
		printf("\n\t----- Game-specific options for %s -----\n\n", kGameName);

		printf("\tCurrent Initial Position:\n");
		PrintPosition(gInitialPosition, gPlayerName[kPlayerOneTurn], kHumansTurn);

		printf("\tI)\tChoose the (I)nitial position\n");
		printf("\tT)\t(T)rapping opponent toggle from %s to %s\n",
		       gToTrapIsToWin ? "GOOD (WINNING)" : "BAD (LOSING)",
		       !gToTrapIsToWin ? "GOOD (WINNING)" : "BAD (LOSING)");
		printf("\tD)\tChange the number of (D)ragons (Currently %d)\n",
		       gNumDragons);

		printf("\n\n\tb)\t(B)ack = Return to previous activity.\n");
		printf("\n\nSelect an option: ");

		switch(GetMyChar()) {
		case 'Q': case 'q':
			ExitStageRight();
		case 'H': case 'h':
			HelpMenus();
			break;
		case 'I': case 'i':
			gInitialPosition = GetInitialPosition();
			break;
		case 'T': case 't':
			gToTrapIsToWin = !gToTrapIsToWin;
			break;
		case 'D': case 'd':
			printf("How many dragons [%d-%d]? ", MIN_DRAGONS, MAX_DRAGONS);
			/*scanf("%d", &gNumDragons);*/
			gNumDragons = GetMyInt();
			while (gNumDragons > MAX_DRAGONS || gNumDragons < MIN_DRAGONS) {
				printf("Invalid entry. Please try again\n");
				printf("How many dragons [%d-%d]? ", MIN_DRAGONS, MAX_DRAGONS);
				/*scanf("%d", &gNumDragons);*/
				gNumDragons = GetMyInt();
			}
			InitializeGame();
			break;
		case 'b': case 'B':
			return;
		default:
			printf("\nSorry, I don't know that option. Try another.\n");
			HitAnyKeyToContinue();
			break;
		}
	} while(TRUE);
}
Example #8
0
void ChangeBoardSize (){
	int newWidth, newLength;
	while (TRUE) {
		printf("\n\nCurrent board of size %dx%d:\n\n", width, length);
		PrintPosition(gInitialPosition, "Gamesman", 0);
		printf("\n\nEnter the new width (%d - %d):  ", WIDTH_MIN, WIDTH_MAX);
		newWidth = GetMyChar()-48;
		if(newWidth > WIDTH_MAX || newWidth < WIDTH_MIN) {
			printf("\nInvalid width!\n");
			continue;
		}
		printf("\n\nEnter the new length (%d - %d):  ", LENGTH_MIN, LENGTH_MAX);
		newLength = GetMyChar()-48;
		if(newLength > LENGTH_MAX || newLength < LENGTH_MIN) {
			printf("\nInvalid length!\n");
			continue;
		}
		width = newWidth;
		length = newLength;
		boardsize = width*length;
		SetupGame();
		break;
	}
}
Example #9
0
void DebugMenu()
{
    #if 0
	int tttppm();
	char GetMyChar();
    
	do {
		printf("\n\t----- Module DEBUGGER for %s -----\n\n", kGameName);

		printf("\tc)\tWrite PPM to s(C)reen\n");
		printf("\ti)\tWrite PPM to f(I)le\n");
		printf("\ts)\tWrite Postscript to (S)creen\n");
		printf("\tf)\tWrite Postscript to (F)ile\n");
		printf("\n\n\tb)\t(B)ack = Return to previous activity.\n");
		printf("\n\nSelect an option: ");

		switch(GetMyChar()) {
		case 'Q': case 'q':
			ExitStageRight();
		case 'H': case 'h':
			HelpMenus();
			break;
		case 'C': case 'c': /* Write PPM to s(C)reen */
			tttppm(0,0);
			break;
		case 'I': case 'i': /* Write PPM to f(I)le */
			tttppm(0,1);
			break;
		case 'S': case 's': /* Write Postscript to (S)creen */
			tttppm(1,0);
			break;
		case 'F': case 'f': /* Write Postscript to (F)ile */
			tttppm(1,1);
			break;
		case 'B': case 'b':
			return;
		default:
			BadMenuChoice();
			HitAnyKeyToContinue();
			break;
		}
	} while(TRUE);
    #endif
}
Example #10
0
void GameSpecificMenu()
{
	do {
		printf("\n\t----- Game-specific options for %s -----\n\n", kGameName);

		printf("\tCurrent Initial Position:\n");
		PrintPosition(gInitialPosition, gPlayerName[kPlayerOneTurn], kHumansTurn);

		printf("\n\tI)\tChoose the (I)nitial position\n");
		printf("\tC)\tCreate a (C)ustom board\n");
		printf("\tD)\tUse (D)efault board\n");

		printf("\n\n\tB)\t(B)ack = Return to previous activity.\n");
		printf("\n\nSelect an option: ");

		switch(GetMyChar()) {
		case 'Q': case 'q':
			ExitStageRight();
		case 'H': case 'h':
			HelpMenus();
			break;
		case '1': case 'I': case 'i':
			gInitialPosition = GetInitialPosition();
			break;
		case 'c': case 'C':
			kUseCustomBoard = TRUE;
			gCreateCustomBoard();
			break;
		case 'd': case 'D':
			kUseCustomBoard = FALSE;
			break;
		case 'b': case 'B':
			return;
		default:
			printf("\nSorry, I don't know that option. Try another.\n");
			HitAnyKeyToContinue();
			break;
		}
	} while(TRUE);
}
Example #11
0
void GameSpecificMenu ()
{
    char command = 'Z';

    do {

        printf("\n\t----- Game-specific options for Hex -----\n\n");
        printf("\td)\tChange board (D)imensions (currently %dx%d)\n", boardrows, boardcols);
        printf("\ts)\tConfigure (S)waprule\n\n");
        printf("\tb)\t(B)ack to previous screen\n\n");
        printf("Please select an option: ");

        command = toupper(GetMyChar());

        switch(command) {
        case 'D':
            modifyBoardSize();
            command = 'Z';
            break;

        case 'S':
            configureSwapRule();
            command = 'Z';
            break;

        case 'B':
            return;

        default:
            printf("\nI don't understand %c - please choose another option.", command);
            command = 'Z';

        }

    } while (command != 'B');

}
Example #12
0
void GameSpecificMenu()
{
	int temp = 0, temp2 = 0;
	do {
		printf("\n\t----- Game Specific options for %s -----\n\n", kGameName);

		printf("\n\tCurrent game configuration: \n");

		if(gStandardGame == TRUE) {
			printf("\n\tG)\tChange (G)ame type FROM standard TO misere\n");
		}
		else {
			printf("\n\tG)\tChange (G)ame type FROM misere TO standard\n");
		}

		if(OPT_NOCAPTURE == 0) {
			printf("\n\tE)\tChange landing in an (E)mpty bin rule\n\t\tFROM capturing yours and opponent's stones TO your turn just ending\n");
		}
		else {
			printf("\n\tE)\tChange landing in an (E)mpty bin rule\n\t\tFROM your turn just ending TO capturing yours and opponent's stones\n");
		}

		if(OPT_CHAIN == 0) {
			printf("\n\tN)\tChange landing in a (N)on-empty bin rule\n\t\tFROM doing nothing TO chaining the dispersal\n");
		}
		else {
			printf("\n\tN)\tChange landing in a (N)on-empty bin rule\n\t\tFROM chaining the dispersal TO doing nothing\n");
		}

		if(OPT_MOVEOPP == 0) {
			printf("\n\tS)\tChange (S)electable bins rule\n\t\tFROM just your own TO any\n");
		}
		else {
			printf("\n\tS)\tChange (S)electable bins rule\n\t\tFROM any TO just your own\n");
		}

		if(OPT_NOEXTRATURN == 0) {
			printf("\n\tL)\tChange (L)anding in own kalaha rule\n\t\tFROM getting an extra turn TO doing nothing\n\t\t(CURRENTLY NOT SUPPORTED - NO EFFECT)\n");
		}
		else {
			printf("\n\tL)\tChange (L)anding in own kalaha rule\n\t\tFROM doing nothing TO getting an extra turn\n\t\t(CURRENTLY NOT SUPPORTED - NO EFFECT)\n");
		}

		switch(OPT_WINEMPTY) {
		case 0:
			printf("\n\tY)\tChange emptying (Y)our side of the board rule\n\t\tFROM your opponent capturing all his stones at the end of your turn\n\t\tTO your opponent capturing all his stones at the start of your next turn\n");
			break;
		case 1:
			printf("\n\tY)\tChange emptying (Y)our side of the board rule\n\t\tFROM your opponent capturing all his stones at the start of your next turn\n\t\tTO choosing to disperse stones from your opponent's bins\n");
			break;
		case 2:
			printf("\n\tY)\tChange emptying (Y)our side of the board rule\n\t\tFROM choosing to disperse stones from your opponent's bins\n\t\tTO you winning at the start of your next turn\n");
			break;
		case 3:
			printf("\n\tY)\tChange emptying (Y)our side of the board rule\n\t\tFROM you winning at the start of your next turn\n\t\tTO you passing\n");
			break;
		case 4:
			printf("\n\tY)\tChange emptying (Y)our side of the board rule\n\t\tFROM you passing\n\t\tTO your opponent capturing all his stones at the end of your turn\n");
		}

		printf("\n\tT)\tChange (T)he number of bins per player\n\t\t(CURRENTLY NOT SUPPORTED - CRASHES IF OPTION IS MODIFIED)\n");
		printf("\tP)\tChange number of (P)ieces per bin\n\t\t(CURRENTLY NOT SUPPORTED - CRASHES IF OPTION IS MODIFIED)\n");
		printf("\n\tB)\t(B)ack = Return to previous activity.\n");
		printf("\n\nSelect an option: ");

		switch(GetMyChar())
		{
		case 'G': case 'g':
			gStandardGame = !gStandardGame;
			break;
		case 'E': case 'e':
			OPT_NOCAPTURE = !OPT_NOCAPTURE;
			break;
		case 'N': case 'n':
			OPT_CHAIN = !OPT_CHAIN;
			break;
		case 'S': case 's':
			OPT_MOVEOPP = !OPT_MOVEOPP;
			break;
		case 'L': case 'l':
			OPT_NOEXTRATURN = !OPT_NOEXTRATURN;
			break;
		case 'Y': case 'y':
			OPT_WINEMPTY = (OPT_WINEMPTY += 1) > 4 ? 0 : OPT_WINEMPTY;
			break;
		case 'Q': case 'q':
			ExitStageRight();
			break;

		case 'T': case 't':
			printf( "Enter #N bins/player (N > 0): " );
			/*fflush(stdin);	no longer needed
			   scanf( "%d", &temp );*/
			temp = GetMyInt();
			temp2 = numOfPieces / (boardSize - 2);
			temp2 *= (temp * 2);
			temp *= 2;
			temp += 2;
			if(temp + temp2 <= 32) {
				boardSize = temp;
				numOfPieces = temp2;
				UpdateGameSpecs();
			}
			else {
				printf( "\nERROR: (#bins + #pieces + 2) > 32!!!\n" );
			}
			break;

		case 'P': case 'p':
			printf( "Enter #N pieces/bin (N > 0): " );
			/*fflush(stdin);		no longer needed
			   scanf( "%d", &temp );*/
			temp *= (boardSize - 2);
			if(temp + boardSize <= 32) {
				numOfPieces = temp;
				UpdateGameSpecs();
			}
			else {
				printf( "\nERROR: (#bins + #pieces + 2) > 32!!!\n" );
			}
			break;

		case 'B': case 'b':
			return;
		default:
			BadMenuChoice();
			HitAnyKeyToContinue();
			break;
		}

		/*fflush(stdin); no longer needed */
	} while(TRUE);
}