File: common\intro.c
1
2 /*
3 * intro.c
4 *
5 * FRACTINT intro screen (authors & credits)
6 *
7 *
8 */
9
10 #include <time.h>
11
12 /* see Fractint.c for a description of the "include" hierarchy */
13 #include "port.h"
14 #include "prototyp.h"
15 #include "helpdefs.h"
16
17 /* stuff from fractint */
18
19 #ifdef XFRACT
20 extern int slowdisplay; 21 #endif
22
23 void intro(void)
24 {
25 /* following overlayed data safe if "putstrings" are resident */
26 #ifdef XFRACT
27 static FCODE PRESS_ENTER[] = {"Press ENTER for main menu, Shift-1 for help."}; 28 #else
29 static FCODE PRESS_ENTER[] = {"Press ENTER for main menu, F1 for help."};
30 #endif
31 int toprow, botrow, i, j, delaymax;
32 char oldchar;
33 int authors[100]; /* this should be enough for awhile */
34 char far *credits;
35 char far *screen_text;
36 int oldlookatmouse;
37 int oldhelpmode;
38
39 timer_start -= clock_ticks(); /* "time out" during help */
40 oldlookatmouse = lookatmouse;
41 oldhelpmode = helpmode;
42 lookatmouse = 0; /* de-activate full mouse checking */
43
44 screen_text = MK_FP(extraseg, 0);
45
46 i = 32767 + read_help_topic(INTRO_AUTHORS, 0, 32767, screen_text);
47 screen_text[i++] = '\0';
48 credits = screen_text + i;
49 i = 32767 + read_help_topic(INTRO_CREDITS, 0, 32767, credits);
50 credits[i++] = '\0';
51
52 j = 0;
53 authors[j] = 0; /* find the start of each credit-line */
54 for (i = 0; credits[i] != 0; i++)
55 if (credits[i] == 10)
56 authors[++j] = i+1;
57 authors[j+1] = i;
58
59 helptitle();
60 #define END_MAIN_AUTHOR 5
61 toprow = END_MAIN_AUTHOR+1;
62 #ifndef XFRACT
63 botrow = 21;
68 #endif
69 putstringcenter(1,0,80,C_TITLE, PRESS_ENTER);
70 putstring(2,0,C_CONTRIB,screen_text);
71 setattr(2,0,C_AUTHDIV1,80);
72 setattr(END_MAIN_AUTHOR,0,C_AUTHDIV1,80);
73 setattr(22,0,C_AUTHDIV2,80);
74 setattr(3,0,C_PRIMARY,80*(END_MAIN_AUTHOR-3));
75 setattr(23,0,C_TITLE_LOW,160);
76 for (i = 3; i < END_MAIN_AUTHOR; ++i)
77 setattr(i,21,C_CONTRIB,58);
78 setattr(toprow,0,C_CONTRIB,(21-END_MAIN_AUTHOR)*80);
79 i = botrow - toprow;
80 srand((unsigned int)clock_ticks());
81 j = rand()%(j-(botrow-toprow)); /* first to use */
82 i = j+botrow-toprow; /* last to use */
83 oldchar = credits[authors[i+1]];
84 credits[authors[i+1]] = 0;
85 putstring(toprow,0,C_CONTRIB,credits+authors[j]);
86 credits[authors[i+1]] = oldchar;
87 delaymax = 10;
88 movecursor(25,80); /* turn it off */
89 helpmode = HELPMENU;
90 while (! keypressed())
91 {
92 #ifdef XFRACT
94 #endif
95 for (j = 0; j < delaymax && !(keypressed()); j++)
96 delay(100);
97 if (keypressed() == 32)
98 { /* spacebar pauses */
99 getakey();
100 #ifndef XFRACT
101 while (!keypressed()) ;
102 #else
103 waitkeypressed(0); 104 #endif
105 if (keypressed() == 32)
106 getakey();
107 }
108 delaymax = 15;
109 scrollup(toprow, botrow);
110 i++;
111 if (credits[authors[i]] == 0)
112 i = 0;
113 oldchar = credits[authors[i+1]];
114 credits[authors[i+1]] = 0;
115 putstring(botrow,0,C_CONTRIB,&credits[authors[i]]);
116 setattr(botrow,0,C_CONTRIB,80);
117 credits[authors[i+1]] = oldchar;
118 movecursor(25,80); /* turn it off */
119 }
120
121 lookatmouse = oldlookatmouse; /* restore the mouse-checking */
122 helpmode = oldhelpmode;
123 return ;
124 }
125