/***************************** text.c ******************************/ #include "sdi.h" /* * Copyright 1987 by Mark Weiser. * Permission to reproduce and use in any manner whatsoever on Suns is granted * so long as this copyright and other identifying marks of authorship * in the code and the game remain intact and visible. Use of this code * in other products is reserved to me--I'm working on Mac and IBM versions. */ /* * Find the size of the longest line in a string of lines separated by newlines */ max_line(s) char *s; { int max = 0, count = 0; while (*s) { if (*s++ == '\n') { if (count > max) max = count; count = 0; continue; } count += 1; } if (count > max) max = count; return max; } /* * Count the number of lines in a string of lines separated by newlines. */ count_lines(s) char *s; { int count = 0; while (*s) { if (*s++ == '\n') count += 1; } return count+1; } static char *help_msg[] = { #include "novice_advice.h" , #include "occasional_advice.h" , #include "expert_advice.h" }; /* * Display a brief message of advice appropriate to the current skill level. */ void help_proc() { int skill = (int)xv_get(skill_item, PANEL_VALUE); easy_pop(help_msg[skill]); } /* * Display a brief informative message about the game. */ void about_proc() { static char *about_msg = #include "about_msg.h" ; easy_pop(about_msg); } static char *art_msg = "This space reserved for Marcel Duchamp"; /* * Display a brief informative message about art. */ void art_proc() { easy_pop(art_msg); } /* * Display the complete source code of the game in a popup window. * The external variable 'source code' must be properly filled elsewhere. * (See the sdi makefile for one way.) */ void source_proc() { extern char *source_code; easy_pop(source_code); } /* * Display the history of the game's development in a popup window. * The external variable 'history_text' must be properly filled elsewhere. * (See the sdi makefile for one way.) */ void history_proc() { extern char *history_text; easy_pop(history_text); } /* * Display the man entry in a popup (sort of) window. * The external variable 'man_text' must be properly filled elsewhere. * (See the sdi makefile for one way.) */ void man_proc() { extern char *man_text; easy_pop(man_text); } void instructions_proc() { easy_pop( #include "instructions.h" ); } void version_proc() { extern char *version; easy_pop(version); } NOTES_proc() { extern char *NOTES_text; easy_pop(NOTES_text); } TODO_proc() { extern char *TODO_text; easy_pop(TODO_text); } README_proc() { extern char *README_text; easy_pop(README_text); } init_text() { things_to_read_menu = xv_create(NULL, MENU, MENU_TITLE_ITEM, "things to read", MENU_ACTION_ITEM, "Source", source_proc, MENU_ACTION_ITEM, "History", history_proc, MENU_ACTION_ITEM, "Man", man_proc, MENU_ACTION_ITEM, "Scores", scores_proc, MENU_ACTION_ITEM, "About", about_proc, MENU_ACTION_ITEM, "Art", art_proc, MENU_ACTION_ITEM, "Advice", help_proc, MENU_ACTION_ITEM, "Version", version_proc, MENU_ACTION_ITEM, "NOTES", NOTES_proc, MENU_ACTION_ITEM, "TODO", TODO_proc, MENU_ACTION_ITEM, "README", README_proc, NULL); } void text_options_proc(item, event) Panel_item item; Event *event; { extern struct pixfont *buttonfont; /* use 'struct pixfont' for 3.0 compatiblity */ suspend_proc(); menu_show(things_to_read_menu, controlframe, event, NULL); }