Example #1
0
void planHide ( )
{
	u16 sprite;
	u16 width  = VDP_getScreenWidth()  / 8 + 1;
	s16 desp   = VDP_getScreenWidth() == 320 ? 0 : 4;

    for ( ; width > 0; width-- )
	{
        bool update = false;

		for ( sprite=0; sprite<MAX_SPRITE; sprite++ )
		{
			if ( vdpSpriteCache[sprite].x/8+2  - 16 + 1 >= width )
			{
				splist_hide_sprite ( sprite );
				update = true;
			}
		}

		if ( update )
		{
			VDP_updateSprites(80,1);
		}

		SYS_disableInts();
		VDP_clearTileMapRect ( PLAN_B, width - 1 + desp, 0, 1, planHeight );
		VDP_clearTileMapRect ( PLAN_A, width - 1 + desp, 0, 1, planHeight );
		SYS_enableInts();

		//waitMs ( PLAN_HIDE_MS );
		waitHz(1);
	}
}
Example #2
0
void planHide_and_sprites (  )
{
	u16 w, sprite;

	const u16 height = VDP_getPlanHeight();
	const u16 width  = VDP_getScreenWidth()  / 8 + 1;
	const s16 desp   = VDP_getScreenWidth() == 320 ? 0 : 4;

	for ( w = width; w > 0; w-- )
	{
		for ( sprite=0; sprite<MAX_SPRITE; sprite++ )
		{
			if ( vdpSpriteCache[sprite].x/8+2 >= w )
			{
				splist_hide_sprite ( sprite );
			}
		}

		VDP_updateSprites(80,1);

		SYS_disableInts();
        VDP_clearTileMapRect ( PLAN_B, w-1+desp, 0, 1, height );
        VDP_clearTileMapRect ( PLAN_A, w-1+desp, 0, 1, height );
        SYS_enableInts ( );

		//waitMs ( PLAN_HIDE_MS );
		waitHz(1);
	}
}
Example #3
0
void text_write ( char *str, u8 x, u8 y )
{
	SYS_disableInts ( );
	VDP_clearTileMapRect ( PLAN_B, x, y, strlen(str), 1 );
	VDP_drawText ( str, x, y );
	SYS_enableInts ( );
}
Example #4
0
File: main.c Project: clbr/SGDK
static void refreshDriverCmd()
{
    VDP_clearTileMapRect(PLAN_A, 0, 12, 40, 8);
    setTextPalette(1);

    switch(driver->id)
    {
    case Z80_DRIVER_PCM:
        VDP_drawText("press A to start/end playback", 1, 12);
        break;

    case Z80_DRIVER_2ADPCM:
        VDP_drawText("press A to start/end channel 1", 1, 12);
        VDP_drawText("press B to start/end channel 2", 1, 13);
        break;

    case Z80_DRIVER_4PCM_ENV:
        VDP_drawText("press A to start/end channel 1", 1, 12);
        VDP_drawText("press B to start/end channel 2", 1, 13);
        VDP_drawText("press C to start/end channel 3", 1, 14);
        VDP_drawText("press START to start/end channel 4", 1, 15);
        break;

    case Z80_DRIVER_MVS:
        VDP_drawText("press A to start/end play MVS music", 1, 12);
        VDP_drawText("press B to play PCM SFX", 1, 13);
        break;

    case Z80_DRIVER_TFM:
        VDP_drawText("press A to start play", 1, 12);
        VDP_drawText("press START to stop play", 1, 13);
        break;

    case Z80_DRIVER_VGM:
        VDP_drawText("press A to play Sonic 1 VGM", 1, 12);
        VDP_drawText("press B to play RoadRash VGM", 1, 13);
        VDP_drawText("press C to play Bad Apple VGM", 1, 14);
        VDP_drawText("press Start to stop/resume VGM", 1, 15);

        VDP_drawText("press X to play PCM SFX", 1, 17);
        break;

    case Z80_DRIVER_XGM:
        VDP_drawText("press A to play Streets Of Rage 2 XGM", 1, 12);
        VDP_drawText("press B to play Bad Apple (PCM) XGM", 1, 13);
        VDP_drawText("press C to play Midnight Resistance XGM", 1, 14);
        VDP_drawText("press START to pause/resume XGM music", 1, 15);

        VDP_drawText("press X to play PCM SFX ch 2", 1, 17);
        VDP_drawText("press Y to play PCM SFX ch 3", 1, 18);
        VDP_drawText("press Z to play PCM SFX ch 4", 1, 19);

        VDP_drawText("Z80 CPU load:", 1, 21);
        break;
    }
}
Example #5
0
File: main.c Project: clbr/SGDK
static void refreshDriverParams()
{
    const u16 driver_ind = getCurrentDriverIndex();
    const char* str;
    u16 start;
    u16 len;
    u16 posY;
    u16 i, j;

    VDP_clearTileMapRect(PLAN_A, 0, 3, 40, 8);

    str = driver->name;
    len = strlen(str);
    start = 20 - (len / 2);

    setTextPalette(driver != &drivers[0]);
    VDP_drawText("<", start - 2, 3);
    VDP_setTextPalette(PAL0);
    VDP_drawText(str, start, 3);
    setTextPalette(driver != &drivers[NUM_DRIVER - 1]);
    VDP_drawText(">", start + len + 1, 3);

    posY = 5;

    for(i = 0; i < driver->num_cmd; i++)
    {
        const cmd_def *cur_cmd = &driver->cmds[i];
        u16 posX = 2;

        str = cur_cmd->name;
        VDP_setTextPalette(PAL0);
        VDP_drawText(str, posX, posY);
        posX += strlen(str);

        for(j = 0; j < cur_cmd->num_param; j++)
        {
            const param_def *cur_param = &cur_cmd->params[j];

            str = cur_param->name;
            setTextPalette(params_value[driver_ind][i] == cur_param);
            VDP_drawText(str, posX, posY);
            posX += strlen(str);
        }

        posY++;
    }

    VDP_setTextPalette(PAL0);

    if (cmd == NULL) VDP_drawText("*", 0, 3);
    else VDP_drawText("*", 0, 5 + getCurrentCmdIndex());
}
Example #6
0
void drawBoard() {
	int x, y;
	char score_string[11];
	for (y = 0; y != BOARD_Y; y++) {
		for (x = 0; x != BOARD_X; x++) {
			if (board[y][x].id) {
				if (board[y][x].selected)
					VDP_fillTileMapRectInc(VDP_PLAN_A, TILE_ATTR_FULL(PAL2, PRIORITY_LOW, FALSE, FALSE, TILE_USERINDEX + (4 * board[y][x].id)), CUR(x), CUR(y), SWIRL_WIDTH, SWIRL_HEIGHT);
				else
					VDP_fillTileMapRectInc(VDP_PLAN_A, TILE_ATTR_FULL(PAL1, PRIORITY_LOW, FALSE, FALSE, TILE_USERINDEX + (4 * board[y][x].id)), CUR(x), CUR(y), SWIRL_WIDTH, SWIRL_HEIGHT);
			} else {
				VDP_clearTileMapRect(VDP_PLAN_A, CUR(x), CUR(y), SWIRL_WIDTH, SWIRL_HEIGHT);
			}
		}
	}
	VDP_drawText("Level 1", 31, 3);
	//VDP_drawText("Goals:", 32, 5);
	//VDP_drawText("0 / 0", 32, 6);
	VDP_drawText("Score:", 30, 26);
	intToStr((s32)score, score_string, 1);
	VDP_clearTileMapRect(VDP_PLAN_A, 30, 27, 10, 1);
	VDP_drawText(score_string, 30, 27);
	VDP_updateSprites();
}
Example #7
0
void planHide_Ex (  VDPPlan plan )
{
	u16 width = screenWidth / 8 + 1;
	s16 desp  = screenWidth == 320 ? 0 : 4;
	u16 pal   = PAL1;

	if ( plan.value == PLAN_B.value )
	{
		pal = PAL2;
	}

	while ( width-- )
	{
	    SYS_disableInts();
        VDP_clearTileMapRect ( plan, width - 1 + desp, 0, 1, planHeight );
        SYS_enableInts ( );

		//waitMs ( PLAN_HIDE_MS );
		waitHz(1);
	}
}
Example #8
0
void HUD_updateStatusView(u8 joy, u8 bA, u8 bB, u8 bC, u8 bStart, u8 statusCode){
	u8 i,j;
	u8 channel;
	char status[20];

	//for each line
	for (j=0;j<9;j++){
		if (statusCode & statusCodes[j]){
			drawStatusMsg(joy,j);
		}
	}

	// u16 x = X0 + (joy * (WIDTH_TILES/2));
	// if (joy) x--;
	// u16 x = (joy * ((WIDTH_TILES-(HORIZONTAL_MARGIN*2)) / 2)) + (HORIZONTAL_MARGIN);
	u16 x = leftEdge(joy);
	u16 y = Y_STATUS;

	if (bStart && statusCode){
		bA = bB = bC = 0;
	}
	else{
		if (bA > 0) bA = 1;
		if (bB > 0) bB = 1;
		if (bC > 0) bC = 1;
	}

	//draw either grey or white circles to represent the fingering buttons
	VDP_setTileMapXY(APLAN, TILE_ATTR_FULL(PAL0, 0, 0, 0, TILE_USERINDEX+bA), x+X_BUTTONS, y+Y_BUTTONS);
	VDP_setTileMapXY(APLAN, TILE_ATTR_FULL(PAL0, 0, 0, 0, TILE_USERINDEX+bB), x+X_BUTTONS+2, y+Y_BUTTONS);
	VDP_setTileMapXY(APLAN, TILE_ATTR_FULL(PAL0, 0, 0, 0, TILE_USERINDEX+bC), x+X_BUTTONS+4, y+Y_BUTTONS);

	char solfege[3];
	u8 mode = modeList[joy][keyIndex[joy]];
	u8 scalePitch = Instrument_buttonsToScalePitch(bA, bB, bC) % 7;
	u8 truePitch = SCALES[mode][scalePitch];
	switch (scalePitch){
		case 0:
			strcpy(solfege, "Do");
			break;
		case 1:
			strcpy(solfege, (truePitch == 1) ? "Ra" : "Re");
			break;
		case 2:
			strcpy(solfege, (truePitch == 3) ? "Me" : "Mi");
			break;
		case 3:
			strcpy(solfege, (truePitch == 6) ? "Fi" : "Fa");
			break;
		case 4:
			strcpy(solfege, (truePitch == 8) ? "Si" : (truePitch == 6) ? "Se" : "Sol");
			break;
		case 5:
			strcpy(solfege, (truePitch == 10) ? "Li" : (truePitch == 8) ? "Le" : "La");
			break;
		case 6:
			strcpy(solfege, (truePitch == 10) ? "Te" : "Ti");
			break;
		default:
			strcpy(solfege, "");
			break;
	}
	drawText(solfege, x+X_BUTTONS+6, y+Y_BUTTONS, 0, 3);

	// VDP_fillTileMapRectInc(APLAN, TILE_ATTR_FULL(PAL0, 0, 0, 0, TILE_USERINDEX+2), x+X_NOTE, 25, 1, 2);

	//draw musical note
	if (playing[joy]){
		VDP_fillTileMapRectInc(APLAN, TILE_ATTR_FULL(PAL0, 0, 0, 0, TILE_USERINDEX+2), x+X_NOTE, Y_NOTE, 1, 2);
	}
	else {
		VDP_clearTileMapRect(APLAN, x+X_NOTE, Y_NOTE, 1, 2);
	}

}