intro.c

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2005 Michael K. McCarty & Fritz Bronner
00003 
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with this program; if not, write to the Free Software
00016     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018 // Interplay's BUZZ ALDRIN's RACE into SPACE
00019 //
00020 // Formerly -=> LiftOff : Race to the Moon :: IBM version MCGA
00021 // Copyright 1991 by Strategic Visions, Inc.
00022 // Designed by Fritz Bronner
00023 // Programmed by Michael K McCarty
00024 //
00025 
00026 #include "Buzz_inc.h"
00027 #include "externs.h"
00028 #include "utils.h"
00029 #include "logging.h"
00030 GXHEADER local2;
00031 
00032 LOG_DEFAULT_CATEGORY(LOG_ROOT_CAT);
00033 
00034 struct CREDIT {
00035   char page;
00036   int col;
00037   int x,y;
00038   char Txt[35];
00039 } CREDIT[] ={
00040     { 0,11,108, 12,"CREATION AND DESIGN"},
00041     { 0, 1,124, 20,"FRITZ BRONNER"},
00042     { 0,11,128, 34,"PROGRAMMING"},
00043     { 0, 1,116, 42,"MICHAEL K MCCARTY"},
00044     { 0,11, 83, 54,"A.I. AND ADDITIONAL PROGRAMMING"},
00045     { 0, 1,122, 62,"MORGAN ROARTY"},
00046     { 0,11,185, 74,"GRAPHIC MANAGEMENT"},
00047     { 0, 1,194, 82,"TOM CHAMBERLAIN"},
00048     { 0,11,190, 93,"COMPUTER ARTISTS"},
00049     { 0, 1,202,101,"DAVID MOSHER"},
00050     { 0, 1,198,108,"MARGIE BEESON"},
00051     { 0, 1,195,115,"TODD J CAMASTA"},
00052     { 0, 1,193,122,"TOM CHAMBERLAIN"},
00053     { 0, 1,199,129,"CHERYL AUSTIN"},
00054     { 0, 1,190,136,"CHARLES H WEIDMAN"},
00055     { 0, 1,206,143,"RONAN JOYCE"},
00056     { 0, 1,207,150,"STEVE STIPP"},
00057     { 0, 1,200,157,"FRITZ BRONNER"},
00058     { 0, 1,189,164,"MICHAEL K MCCARTY"},
00059     { 0,11,203,174,"SOUND EDITING"},
00060     { 0, 1,201,182,"FRITZ BRONNER"},
00061     { 0, 1,190,189,"MICHAEL K MCCARTY"},
00062     { 0,11, 33, 74,"VIDEO DIGITIZING"},
00063     { 0, 1, 33, 82,"TOM CHAMBERLAIN"},
00064     { 0, 1, 40, 89,"FRITZ BRONNER"},
00065     { 0, 1, 31, 96,"MICHAEL K MCCARTY"},
00066     { 0, 1, 42,103,"RONAN JOYCE"},
00067     { 0, 1, 37,110,"MORGAN ROARTY"},
00068     { 0,11,  9,121,"ORIGINAL MUSIC COMPOSITION"},
00069     { 0, 1, 35,129,"BRIAN LANGSBARD"},
00070     { 0, 1, 35,136,"MICHAEL MCNERNY"},
00071     { 0,11, 27,146,"MUSIC ADAPTATIONS"},
00072     { 0, 1, 32,154,"RICHARD JACKSON"},
00073     { 0,11, 34,165,"AUDIO DIGITIZING"},
00074     { 0, 1, 39,173,"FRITZ BRONNER"},
00075     { 0, 1, 30,180,"MICHAEL K MCCARTY"},
00076     { 0, 1, 35,187,"CHARLES DEENEN"},
00077     { 1,11,140, 10,"DIRECTOR"},
00078     { 1, 1,126, 18,"FRITZ BRONNER"},
00079     { 1,11,131, 28,"PRODUCED BY"},
00080     { 1, 1,127, 37,"FRITZ BRONNER"},
00081     { 1, 1,117, 44,"MICHAEL K MCCARTY"},
00082     { 1,11, 47, 62,"DATA ENTRY"},
00083     { 1, 1, 33, 70,"TOM CHAMBERLAIN"},
00084     { 1, 1, 42, 77,"ENDA MCCARTY"},
00085     { 1,11, 29, 88,"COSMONAUT VOICES"},
00086     { 1, 1, 33, 96,"GHERMAN TRIGUB"},
00087     { 1, 1, 37,103,"MARINA TRIGUB"},
00088     { 1,11, 40,114,"OTHER VOICES"},
00089     { 1, 1, 35,122,"GEORGE SPELVIN"},
00090     { 1, 1, 36,129,"GENNIE SPELVIN"},
00091     { 1, 1, 49,136,"JIM BROWN"},
00092     { 1,11, 34,149,"VECTOR GRAPHICS"},
00093     { 1, 1, 31,157,"J SCOTT MATTHEWS"},
00094     { 1, 1, 34,164,"MICHAEL PACKARD"},
00095     { 1,11, 34,179,"SPACE MINITURES"},
00096     { 1, 1, 33,187,"BRONNER STUDIOS"},
00097     { 1,11,178, 62,"INTERPLAY'S PRODUCER"},
00098     { 1, 1,183, 70,"JACOB R BUCHERT III"},
00099     { 1, 1,182, 78,"BRUCE SCHLICKBERND"},
00100     { 1,11,170, 88,"DIRECTOR OF PLAYTESTING"},
00101     { 1, 1,192, 96,"KERRY GARRISON"},
00102     { 1,11,186,110,"LEAD PLAY TESTERS"},
00103     { 1, 2,202,118,"JEREMY AIREY"},
00104     { 1, 2,193,125,"MICHAEL PACKARD"},
00105     { 1, 2,199,132,"MARK HARRISON"},
00106     { 1, 1,199,139,"ERIK ANDERSON"},
00107     { 1, 2,176,146,"JENNIFER SCHLICKBERND"},
00108     { 1,11,199,158,"COVER PAINTING"},
00109     { 1, 1,209,166,"KEN HODGES"},
00110     
00111     { 1,11,212,179,"SDL PORT"},
00112     { 1, 1,195,187,"PACE WILLISSON"},
00113 };
00114 int nCREDIT = sizeof CREDIT / sizeof CREDIT[0];
00115 
00116 void Credits(void)
00117 {
00118   int k,i;
00119   i32 len;
00120   strcpy(IKEY,"i999\0");
00121   FILE *fin;
00122 
00123   fin=sOpen("FIRST.IMG","rb",0);
00124   FadeOut(2,pal,30,0,0);
00125   
00126   fread(pal,768,1,fin);
00127   fread(&len,4,1,fin);
00128     Swap32bit(len);
00129   fseek(fin,len,SEEK_CUR);
00130   fread(pal,768,1,fin);
00131   fread(&len,4,1,fin);
00132     Swap32bit(len);
00133   fread(vhptr.vptr,len,1,fin);
00134   fclose(fin);
00135 
00136   for (k=0;k<2;k++) {
00137     
00138     if (k!=0) FadeOut(2,pal,30,0,0);  // Screen #2
00139     PCX_D((char *)vhptr.vptr,screen,len);
00140     memset(&pal[431],0x00,96);
00141     screen[63999]=0;
00142     for (i = 0; i < nCREDIT; i++) {
00143        if (CREDIT[i].page==k) {
00144          grSetColor(CREDIT[i].col);
00145          PrintAt(CREDIT[i].x,CREDIT[i].y,CREDIT[i].Txt);
00146        }
00147     }
00148     
00149     FadeIn(2,pal,30,0,0);
00150     
00151     while(1)  {
00152       GetMouse();
00153       if (mousebuttons==0) break;
00154     }
00155     key=0;
00156     while (mousebuttons==0 && key==0) {
00157       GetMouse();
00158       //UpdateMusic();
00159     }
00160     key=0;
00161   }
00162 
00163   FadeOut(2,pal,30,0,0);
00164   memset(screen,0x00,64000);
00165   strcpy(IKEY,"k000\0");
00166   return;
00167 }
00168 
00169 
00170 #define INTRO_IMAGE_COUNT 15
00171 
00172 struct intro_image {
00173     unsigned char map[256 * 3];
00174     unsigned char pixels[320 * 200];
00175 };
00176 struct intro_image *intro_images;
00177 
00178 int
00179 read_img_frame (FILE *inf, struct intro_image *ip)
00180 {
00181     unsigned long len;
00182     char compressed[64 * 1024];
00183 
00184     len = fread (&ip->map, 1, sizeof ip->map, inf);
00185 
00186     if (len == 0)
00187         return (-1);
00188 
00189     if (len != sizeof ip->map)
00190         goto bad;
00191     
00192     
00193     if (fread (&len, 4, 1, inf) != 1)
00194         goto bad;
00195 
00196     Swap32bit(len);
00197 
00198     if (len > sizeof compressed) {
00199         WARNING1("frame too big");
00200         goto bad;
00201     }
00202 
00203     if (fread (compressed, 1, len, inf) != len)
00204         goto bad;
00205         
00206     PCX_D (compressed, ip->pixels, len);
00207 
00208     return (0);
00209 
00210 bad:
00211     CRITICAL1("corrupted image file");
00212     /* XXX: quite drastic */
00213     exit(EXIT_FAILURE);
00214 }
00215 
00216 void
00217 read_intro_images (void)
00218 {
00219     FILE *fin;
00220     int i;
00221 
00222     intro_images = xmalloc(sizeof(struct intro_image)*INTRO_IMAGE_COUNT);
00223 
00224     fin = sOpen ("FIRST.IMG","rb",0);
00225 
00226     for (i = 0; i < 15; i++) {
00227         if (read_img_frame (fin, &intro_images[i]) < 0) {
00228             CRITICAL1("error reading first.img");
00229             /* XXX: quite drastic */
00230             exit(EXIT_FAILURE);
00231         }
00232     }
00233 
00234     fclose (fin);
00235 }
00236 
00237 void Introd(void)
00238 {
00239   int k;
00240   struct intro_image *ip;
00241   double start;
00242 
00243   read_intro_images ();
00244     
00245     music_start(M_LIFTOFF);
00246 
00247   /* Frame 0 is Interplay, and frame 1 is Strategic Visions */
00248   /* These are both defunct, so start at frame 2 instead */
00249   for (k=2;k<INTRO_IMAGE_COUNT;k++) {
00250     ip = &intro_images[k];
00251 
00252     gr_set_color_map (ip->map);
00253     memcpy (screen, ip->pixels, MAX_X * MAX_Y);
00254     FadeIn(2, pal, 30, 0, 0);
00255 
00256     start = get_time ();
00257     while (get_time () - start < 3) {
00258         av_step ();
00259 
00260         key = 0;
00261         PauseMouse();
00262         if (key)
00263             goto done;
00264         else if (key || grGetMouseButtons())
00265             break;
00266     }
00267     FadeOut(2, pal, 30, 0, 0);
00268   }
00269 
00270 done:
00271   gxClearDisplay(0,0);
00272   free(intro_images);
00273 }
00274 
00275 void NextTurn(char plr)
00276 {
00277   FILE *fin = NULL;
00278   i32 len = 0;
00279    
00280     memset(pal,0x00,sizeof(pal));
00281   gxSetDisplayPalette(pal);
00282   strcpy(IDT,"i000");strcpy(IKEY,"k000");
00283     
00284   fin=sOpen("TURN.BUT","rb",0);
00285   fread(&pal,768,1,fin);
00286   len=fread(screen,1,MAX_X*MAX_Y,fin);
00287   fclose(fin);
00288 
00289   RLED_img((char *)screen,vhptr.vptr,(unsigned int)len,
00290        vhptr.w,vhptr.h);
00291 
00292   gxClearDisplay(0,0);
00293 
00294   ShBox(0,60,319,80);
00295   grSetColor(6+plr*3);
00296   if (plr==0) DispBig(15,64,"DIRECTOR OF THE UNITED STATES",0,-1);
00297   else DispBig(30,64,"CHIEF DESIGNER OF THE USSR",0,-1);
00298   grSetColor(11);
00299   grMoveTo(175,122);
00300   if (Data->Season==0) PrintAt(0,0,"SPRING 19");
00301   else PrintAt(0,0,"FALL 19");
00302   DispNum(0,0,Data->Year);
00303   gxVirtualDisplay(&vhptr,110*plr,0,30,85,31+107,85+94,0);
00304   
00305   FadeIn(2,pal,10,0,0);
00306   music_start((plr==0) ? M_GOOD : M_FUTURE);
00307  
00308   WaitForMouseUp();
00309   WaitForKeyOrMouseDown();
00310   key = 0;
00311 
00312   music_stop();
00313   FadeOut(2,pal,10,0,0);
00314   gxClearDisplay(0,0);
00315   return;
00316 }
00317 
00318 /* vim: set noet ts=4 sw=4 tw=77: */

Generated on Fri Sep 28 00:35:45 2007 for raceintospace by  doxygen 1.5.3