Exemple #1
0
void gameOver() {
	cpct_etm_setTileset2x4(g_tile_tileset_4);
	cpct_etm_drawTilemap2x4_f(MAP_WIDTH_TILES, MAP_HEIGHT_TILES, SCR_VMEM, g_backgroundGameOver);

	waitNVSYNCs(3000);
	gameScene=MENUSCREEN;
}
Exemple #2
0
void mainMenu() {
		u8 option=0;
		cpct_etm_setTileset2x4(g_tile_tileset_bg);
		cpct_etm_drawTilemap2x4_f(MAP_WIDTH_TILES, MAP_HEIGHT_TILES, SCR_VMEM, g_background);

		cpct_drawSprite (g_tile_titulo, getScreenPosition(5, 2), 32, 16);
		cpct_drawStringM0 ("PLAY GAME", getScreenPosition(5, 5), 15, 7);
		cpct_drawStringM0 ("CONTROLS", getScreenPosition(5, 7), 15, 7);
		cpct_drawStringM0 ("CREDITS", getScreenPosition(5, 9), 15, 7);

		initScroll();
		initPlayer();
		cpct_scanKeyboard_f ();
		do {
		    waitNVSYNCs(3);
			cpct_akp_musicPlay();

			Road();
			drawPlayer();
			if ( cpct_isKeyPressed (Key_CursorUp) && option != 0) {
				--option;
			}
			else if ( cpct_isKeyPressed (Key_CursorDown) && option != 2) {
				++option;
			}

			switch (option) {
				case 0:
					cpct_drawSprite(g_tile_sky_blue, getScreenPosition(3, 7), 4, 8);
					cpct_drawSprite(sprite_skate, getScreenPosition(3, 5), 4, 8);
					break;
				case 1:
					cpct_drawSprite(g_tile_sky_blue, getScreenPosition(3, 5), 4, 8);
					cpct_drawSprite(g_tile_sky_blue, getScreenPosition(3, 9), 4, 8);
					cpct_drawSprite(sprite_skate, getScreenPosition(3, 7), 4, 8);
					break;
				case 2:
					cpct_drawSprite(g_tile_sky_blue, getScreenPosition(3, 7), 4, 8);
					cpct_drawSprite(sprite_skate, getScreenPosition(3, 9), 4, 8);
					break;
			}
			cpct_scanKeyboard_f ();
//			waitNVSYNCs(5);
	} while (!cpct_isKeyPressed(Key_Return));

		switch (option) {
    		case 0:	playMenu();
				break;
    		case 1: 
				gameScene=CONTROLSSCREEN;
				break;
		    case 2: 
				gameScene=CREDITSSCEENE;
				break;
		}
}
Exemple #3
0
void playMenu() {
		u8 option=0;

		cpct_etm_setTileset2x4(g_tile_tileset_bg);
		cpct_etm_drawTilemap2x4_f(MAP_WIDTH_TILES, MAP_HEIGHT_TILES, SCR_VMEM, g_background);

		cpct_drawSprite (g_tile_titulo, getScreenPosition(5, 2), 32, 16);
		cpct_drawStringM0 ("PLAY GAME", getScreenPosition(5, 5), 15, 7);
		cpct_drawStringM0 ("INFINITY MODE", getScreenPosition(6, 7), 15, 7);
		cpct_drawStringM0 ("LEVELS MODE", getScreenPosition(6, 9), 15, 7);

		initScroll();
		initPlayer();
		cpct_scanKeyboard_f ();
		do {
			waitNVSYNCs(3);
			cpct_akp_musicPlay();
			Road();
			drawPlayer();
			if ( cpct_isKeyPressed (Key_Esc)) {
				gameScene=MENUSCREEN;
				return;
			}
			else if ( cpct_isKeyPressed (Key_CursorUp) && option != 0) {
				--option;
			}
			else if ( cpct_isKeyPressed (Key_CursorDown) && option != 1) {
				++option;
			}

			switch (option) {
				case 0:
					cpct_drawSprite(g_tile_sky_blue, getScreenPosition(4, 9), 4, 8);
					cpct_drawSprite(sprite_skate, getScreenPosition(4, 7), 4, 8);
					break;
				case 1:
					cpct_drawSprite(g_tile_sky_blue, getScreenPosition(4, 7), 4, 8);
					cpct_drawSprite(sprite_skate, getScreenPosition(4, 9), 4, 8);
					break;
			}
			cpct_scanKeyboard_f ();
//			waitNVSYNCs(5);
	} while (!cpct_isKeyPressed(Key_Return));

		switch (option) {
			case 0:
				cpct_akp_stop();
				gameScene=PLAYGAMESCREEN;
				break;
			case 1:
				cpct_akp_stop();
				gameScene=NEXTLEVELSCREEN;
				break;
		}
}
Exemple #4
0
/////////////////////////////////////////////////////////////////////////
// Initialization routine
//    Disables firmware, initializes palette and video mode and
// draws the background
//
void initialization (){ 
   cpct_disableFirmware();          // Disable firmware to prevent it from interfering
   cpct_setPalette(g_palette, 7);   // Set palette using hardware colour values
   cpct_setBorder (g_palette[0]);   // Set border colour same as background (0)
   cpct_setVideoMode(0);            // Change to Mode 0 (160x200, 16 colours)

   // Set the internal tileset for drawing Tilemaps
   cpct_etm_setTileset2x4(g_tileset);

   // Draw the background tilemap
   cpct_etm_drawTilemap2x4_f(MAP_WIDTH_TILES, MAP_HEIGHT_TILES, 
                             CPCT_VMEM_START, g_background);  
}
Exemple #5
0
/////////////////////////////////////////////////////////////////////////////////
// Main application's code
//
void application(void) {
   // Screen tilemap
   TScreenTilemap scr = { 0, 0, { 0, 0, MAP_WIDTH, MAP_HEIGHT} };

   // First show user messages
   showMessages();

   // Initialize the application
   cpct_disableFirmware();     // Firmware must be disabled for this application to work
   cpct_setBorder(0x00);       //    Set the border colour gray and.. 
   cpct_setPALColour(0, 0x14); // ...background black

   // VERY IMPORTANT: Before using EasyTileMap functions (etm), the internal
   // pointer to the tileset must be set. 
   cpct_etm_setTileset2x4(g_tileset);

   // Indefinitely draw the tilemap, listen to user input, 
   // do changes and draw it again
   while(1) {
      drawScreenTilemap(&scr);   // Redraws the tilemap
      readKeyboardInput(&scr);   // Waits for a user input and makes associated changes
   }
}
Exemple #6
0
/////////////////////////////////////////////////////////////////////////////////
// Machine initialization code
//
void initialize_CPC() {
   // Initialize the application
   cpct_disableFirmware();         // Firmware must be disabled for this application to work
   cpct_setVideoMode(0);           // Set Mode 0 (160x200, 16 Colours)
   cpct_setPalette(g_palette, 13); // Set Palette 
   cpct_setBorder(HW_BLACK);       // Set the border and background colours to black

   // VERY IMPORTANT: Before using EasyTileMap functions (etm), the internal
   // pointer to the tileset must be set. 
   cpct_etm_setTileset2x4(g_tileset);   

   // Clean up the screen 
   cpct_memset(CPCT_VMEM_START, 0x00, 0x4000);

   // Draw the full tilemap for the first time
   cpct_etm_drawTileBox2x4(0, 0,                       // (X, Y) upper-left corner of the tilemap
                           SCR_TILE_WIDTH, MAP_HEIGHT, // (Width, Height) of the Box to be drawn (all the screen)
                           MAP_WIDTH,                  // Width of the full tilemap (which is wider than the screen)
                           CPCT_VMEM_START,                   // Pointer to the start of video memory (upper-left corner of the
                                                       // ...tilemap in the screen)
                           g_tilemap);                 // Pointer to the first tile of the tilemap to be drawn (upper-left
                                                       // ... corner of the tilemap viewport window)
}
Exemple #7
0
//////////////////////////////////////////////////////////////////
// initialization
//
//  initializes the whole program
//
// Returns:
//    void
//
void initialization() {
    u32 seed;    // Value to initialize the random seed

    // Music on
    activateMusic();
    cpct_setInterruptHandler(interruptHandler);

    drawText("AMSTHREES IS READY", 31, 76, 1);
    drawText("PRESS ANY KEY", 20, 90, 1);

    seed = wait4UserKeypress();
    // Random seed may never be 0, so check first and add 1 if it was 0
    if (!seed)
        seed++;
    cpct_srand(seed);

    //Deactivates Camelot Mode
    camelotMode = 0;
    // Asign the classic deck to the game
    cards = &(*cards1);

    scoreHallOfFame[0] = 10000;
    scoreHallOfFame[1] = 8000;
    scoreHallOfFame[2] = 6000;
    scoreHallOfFame[3] = 4000;
    scoreHallOfFame[4] = 2000;
    scoreHallOfFame[5] = 1000;
    scoreHallOfFame[6] = 500;
    scoreHallOfFame[7] = 300;

    strcpy(nameHallOfFame[0], "MARTIN [");
    strcpy(nameHallOfFame[1], "DIEGO \\");
    strcpy(nameHallOfFame[2], "MARIA ]");
    strcpy(nameHallOfFame[3], "DAVID ^");
    strcpy(nameHallOfFame[4], "MASTER");
    strcpy(nameHallOfFame[5], "EXPERT");
    strcpy(nameHallOfFame[6], "INTERMEDIATE");
    strcpy(nameHallOfFame[7], "BEGINNER");


    clearScreen();

    keys.up    = Key_CursorUp;
    keys.down  = Key_CursorDown;
    keys.left  = Key_CursorLeft;
    keys.right = Key_CursorRight;
    keys.fire  = Key_Space;
    keys.pause = Key_Del;
    keys.abort = Key_Esc;
    keys.music = Key_M;
    keys.camelotmode = Key_C;

    selectedOption = 0;

    highestCardAll = 0;


    cpct_etm_setTileset2x4(tileset);

    resetChangedCards();

}