home *** CD-ROM | disk | FTP | other *** search
/ Fractal Creations (Second Edition) / FRACTALS_2E.iso / frasrc.exe / INTRO.C < prev    next >
C/C++ Source or Header  |  1993-08-21  |  3KB  |  134 lines

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