Esempio n. 1
0
/*Abstraction of press note button actions */
void pressNote(uint8_t n) {

	/* set current note */
	note = n;
	/* set frequency (notes.h) */
	start_note();
	/* print out note (serial.h) */
	output_note();	
}
Esempio n. 2
0
File: notes.c Progetto: jcubic/ToME
/*
 * Add note to file using a string + character symbol
 * to specify its type so that the notes file can be
 * searched easily by external utilities.
 */
void add_note(char *note, char code)
{
	char buf[100];
	char final_note[100];
	char depths[32];
	char *tmp;

	/* Get the first 60 chars - so do not have an overflow */
	tmp = C_WIPE(buf, 100, char);
	strncpy(buf, note, 60);

	/* Get depth  */
	if (!dun_level) strcpy(depths, "  Town");
	else if (depth_in_feet) sprintf(depths, "%4dft", dun_level * 50);
	else sprintf(depths, "Lev%3d", dun_level);

	/* Make note */
	sprintf(final_note, "%-20s %s %c: %s", get_note_date_string(turn), depths, code, buf);

	/* Output to the notes file */
	output_note(final_note);
}
Esempio n. 3
0
File: notes.c Progetto: jcubic/ToME
/*
 * Append a note to the notes file using a "type".
 */
void add_note_type(s32b note_number)
{
	char true_long_day[50];
	char buf[1024];
	time_t ct = time((time_t*)0);

	/* Get the date */
	strftime(true_long_day, 30, "%Y-%m-%d at %H:%M:%S", localtime(&ct));

	/* Work out what to do */
	switch (note_number)
	{
	case NOTE_BIRTH:
		{
			/* Player has just been born */
			/*char player[100];*/

			/* Build the string containing the player information */
//DGDGDGDG			sprintf(player, "the %s %s", get_player_race_name(p_ptr->prace, p_ptr->pracem), class_info[p_ptr->pclass].spec[p_ptr->pspec].title);

			/* Add in "character start" information */
			sprintf(buf,
			        "\n"
			        "================================================\n"
			        "%s "/*%s*/"\n"
			        "Born on %s\n"
			        "================================================\n",
			        player_name, /*player,*/ true_long_day);

			break;
		}

	case NOTE_WINNER:
		{
			sprintf(buf,
			        "%s slew Morgoth on %s\n"
			        "Long live %s!\n"
			        "================================================",
			        player_name, get_long_note_date_string(turn), player_name);

			break;
		}

	case NOTE_SAVE_GAME:
		{
			/* Saving the game */
			sprintf(buf, "\nSession end: %s", true_long_day);

			break;
		}

	case NOTE_ENTER_DUNGEON:
		{
			/* Entering the game after a break. */
			sprintf(buf,
			        "================================================\n"
			        "New session start: %s\n",
			        true_long_day);

			break;
		}

	default:
		return;
	}

	/* Output the notes to the file */
	output_note(buf);
}