move titles, loading screen and order form showing to titles.c
authorChris Taylor <chris@icculus.org>
Sat, 29 Jul 2006 03:49:00 +0000 (03:49 +0000)
committerChris Taylor <chris@icculus.org>
Sat, 29 Jul 2006 03:49:00 +0000 (03:49 +0000)
ChangeLog
main/inferno.c
main/titles.c
main/titles.h

index a706d0b..fd47da3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-07-27  Chris Taylor  <chris@icculus.org>
+
+       * main/inferno.c, main/titles.c, main/titles.h:
+       move titles, loading screen and order form showing to titles.c
+
 2006-07-27  Chris Taylor  <chris@icculus.org>
 
        * main/inferno.c, main/multi.c, main/multi.h:
index e68aaa9..d2a5509 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: inferno.c,v 1.107 2006-07-27 10:07:31 chris Exp $ */
+/* $Id: inferno.c,v 1.108 2006-07-29 03:49:00 chris Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -68,7 +68,6 @@ char copyright[] = "DESCENT II  COPYRIGHT (C) 1994-1996 PARALLAX SOFTWARE CORPOR
 #include "polyobj.h"
 #include "effects.h"
 #include "digi.h"
-#include "pcx.h"
 #include "palette.h"
 #include "args.h"
 #include "sounds.h"
@@ -442,8 +441,6 @@ extern char Language[];
 //can we do highres menus?
 extern int MenuHiresAvailable;
 
-int intro_played = 0;
-
 int Inferno_verbose = 0;
 
 //added on 11/18/98 by Victor Rachels to add -mission and -startgame
@@ -804,140 +801,10 @@ int main(int argc, char *argv[])
        if ( FindArg( "-notitles" ) )
                songs_play_song( SONG_TITLE, 1);
        else
-       {
-#ifndef SHAREWARE
-               int played=MOVIE_NOT_PLAYED;    //default is not played
-#endif
-               int song_playing = 0;
-
-               #ifdef D2_OEM
-               #define MOVIE_REQUIRED 0
-               #else
-               #define MOVIE_REQUIRED 1
-               #endif
-
-               {       //show bundler screens
-                       char filename[FILENAME_LEN];
-
-                       played=MOVIE_NOT_PLAYED;        //default is not played
-
-            played = PlayMovie("pre_i.mve",0);
-
-                       if (!played) {
-                strcpy(filename,MenuHires?"pre_i1b.pcx":"pre_i1.pcx");
-
-                               while (PHYSFS_exists(filename))
-                               {
-                                       show_title_screen( filename, 1, 0 );
-                    filename[5]++;
-                               }
-                       }
-               }
-
-               #ifndef SHAREWARE
-                       init_subtitles("intro.tex");
-                       played = PlayMovie("intro.mve",MOVIE_REQUIRED);
-                       close_subtitles();
-               #endif
-
-               if (played != MOVIE_NOT_PLAYED)
-                       intro_played = 1;
-               else {                                          //didn't get intro movie, try titles
-
-                       played = PlayMovie("titles.mve",MOVIE_REQUIRED);
-
-                       if (played == MOVIE_NOT_PLAYED)
-                       {
-                               char filename[FILENAME_LEN];
-
-                               gr_set_mode(MenuHires?SM(640,480):SM(320,200));
-#ifdef OGL
-                               set_screen_mode(SCREEN_MENU);
-#endif
-                               con_printf( CON_DEBUG, "\nPlaying title song..." );
-                               songs_play_song( SONG_TITLE, 1);
-                               song_playing = 1;
-                               con_printf( CON_DEBUG, "\nShowing logo screens..." );
-
-                               strcpy(filename, MenuHires?"iplogo1b.pcx":"iplogo1.pcx"); // OEM
-                               if (! cfexist(filename))
-                                       strcpy(filename, "iplogo1.pcx"); // SHAREWARE
-                               if (! cfexist(filename))
-                                       strcpy(filename, "mplogo.pcx"); // MAC SHAREWARE
-                               if (cfexist(filename))
-                                       show_title_screen(filename, 1, 1);
-
-                               strcpy(filename, MenuHires?"logob.pcx":"logo.pcx"); // OEM
-                               if (! cfexist(filename))
-                                       strcpy(filename, "logo.pcx"); // SHAREWARE
-                               if (! cfexist(filename))
-                                       strcpy(filename, "plogo.pcx"); // MAC SHAREWARE
-                               if (cfexist(filename))
-                                       show_title_screen(filename, 1, 1);
-                       }
-               }
-
-               {       //show bundler movie or screens
-
-                       char filename[FILENAME_LEN];
-                       PHYSFS_file *movie_handle;
-
-                       played=MOVIE_NOT_PLAYED;        //default is not played
-
-                       //check if OEM movie exists, so we don't stop the music if it doesn't
-                       movie_handle = PHYSFS_openRead("oem.mve");
-                       if (movie_handle)
-                       {
-                               PHYSFS_close(movie_handle);
-                               played = PlayMovie("oem.mve",0);
-                               song_playing = 0;               //movie will kill sound
-                       }
-
-                       if (!played) {
-                               strcpy(filename,MenuHires?"oem1b.pcx":"oem1.pcx");
-
-                               while (PHYSFS_exists(filename))
-                               {
-                                       show_title_screen( filename, 1, 0 );
-                                       filename[3]++;
-                               }
-                       }
-               }
-
-               if (!song_playing)
-                       songs_play_song( SONG_TITLE, 1);
-                       
-       }
+               show_titles();
 
        con_printf( CON_DEBUG, "\nShowing loading screen..." );
-       {
-               //grs_bitmap title_bm;
-               int pcx_error;
-               char filename[14];
-
-               strcpy(filename, MenuHires?"descentb.pcx":"descent.pcx");
-               if (! cfexist(filename))
-                       strcpy(filename, MenuHires?"descntob.pcx":"descento.pcx"); // OEM
-               if (! cfexist(filename))
-                       strcpy(filename, "descentd.pcx"); // SHAREWARE
-               if (! cfexist(filename))
-                       strcpy(filename, "descentb.pcx"); // MAC SHAREWARE
-
-               gr_set_mode(MenuHires?SM(640,480):SM(320,200));
-#ifdef OGL
-               set_screen_mode(SCREEN_MENU);
-#endif
-
-               FontHires = FontHiresAvailable && MenuHires;
-
-               if ((pcx_error=pcx_read_fullscr( filename, title_pal ))==PCX_ERROR_NONE)        {
-                       //vfx_set_palette_sub( title_pal );
-                       gr_palette_clear();
-                       gr_palette_fade_in( title_pal, 32, 0 );
-                       gr_update();
-               } else
-                       Error( "Couldn't load pcx file '%s', PCX load error: %s\n",filename, pcx_errormsg(pcx_error));
-       }
+       show_loading_screen(title_pal); // title_pal is needed (see below)
 
        con_printf( CON_DEBUG , "\nDoing bm_init..." );
        #ifdef EDITOR
@@ -1117,44 +984,6 @@ void check_joystick_calibration() {
 
 }
 
-void show_order_form()
-{
-#ifndef EDITOR
-
-       int pcx_error;
-       unsigned char title_pal[768];
-       char    exit_screen[16];
-
-       gr_set_current_canvas( NULL );
-       gr_palette_clear();
-
-       key_flush();
-
-       strcpy(exit_screen, MenuHires?"ordrd2ob.pcx":"ordrd2o.pcx"); // OEM
-       if (! cfexist(exit_screen))
-               strcpy(exit_screen, MenuHires?"orderd2b.pcx":"orderd2.pcx"); // SHAREWARE, prefer mac if hires
-       if (! cfexist(exit_screen))
-               strcpy(exit_screen, MenuHires?"orderd2.pcx":"orderd2b.pcx"); // SHAREWARE, have to rescale
-       if (! cfexist(exit_screen))
-               strcpy(exit_screen, MenuHires?"warningb.pcx":"warning.pcx"); // D1
-       if (! cfexist(exit_screen))
-               return; // D2 registered
-
-       if ((pcx_error=pcx_read_fullscr( exit_screen, title_pal ))==PCX_ERROR_NONE) {
-               //vfx_set_palette_sub( title_pal );
-               gr_palette_fade_in( title_pal, 32, 0 );
-               gr_update();
-               while (!key_inkey() && !mouse_button_state(0)) {} //key_getch();
-               gr_palette_fade_out( title_pal, 32, 0 );
-       }
-       else
-               Int3();         //can't load order screen
-
-       key_flush();
-
-#endif
-}
-
 void quit_request()
 {
 #ifdef NETWORK
index acc71cc..f298379 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: titles.c,v 1.39 2005-11-29 09:44:24 chris Exp $ */
+/* $Id: titles.c,v 1.40 2006-07-29 03:49:00 chris Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -213,6 +213,145 @@ int show_title_screen( char * filename, int allow_keys, int from_hog_only )
        return 0;
 }
 
+int intro_played = 0;
+
+void show_titles(void)
+{
+#ifndef SHAREWARE
+       int played=MOVIE_NOT_PLAYED;    //default is not played
+#endif
+       int song_playing = 0;
+
+#ifdef D2_OEM
+#define MOVIE_REQUIRED 0
+#else
+#define MOVIE_REQUIRED 1
+#endif
+
+       {       //show bundler screens
+               char filename[FILENAME_LEN];
+
+               played=MOVIE_NOT_PLAYED;        //default is not played
+
+               played = PlayMovie("pre_i.mve",0);
+
+               if (!played) {
+                       strcpy(filename,MenuHires?"pre_i1b.pcx":"pre_i1.pcx");
+
+                       while (PHYSFS_exists(filename))
+                       {
+                               show_title_screen( filename, 1, 0 );
+                               filename[5]++;
+                       }
+               }
+       }
+
+#ifndef SHAREWARE
+       init_subtitles("intro.tex");
+       played = PlayMovie("intro.mve",MOVIE_REQUIRED);
+       close_subtitles();
+#endif
+
+       if (played != MOVIE_NOT_PLAYED)
+               intro_played = 1;
+       else
+       {                                               //didn't get intro movie, try titles
+
+               played = PlayMovie("titles.mve",MOVIE_REQUIRED);
+
+               if (played == MOVIE_NOT_PLAYED)
+               {
+                       char filename[FILENAME_LEN];
+
+                       gr_set_mode(MenuHires?SM(640,480):SM(320,200));
+#ifdef OGL
+                       set_screen_mode(SCREEN_MENU);
+#endif
+                       con_printf( CON_DEBUG, "\nPlaying title song..." );
+                       songs_play_song( SONG_TITLE, 1);
+                       song_playing = 1;
+                       con_printf( CON_DEBUG, "\nShowing logo screens..." );
+
+                       strcpy(filename, MenuHires?"iplogo1b.pcx":"iplogo1.pcx"); // OEM
+                       if (! cfexist(filename))
+                               strcpy(filename, "iplogo1.pcx"); // SHAREWARE
+                       if (! cfexist(filename))
+                               strcpy(filename, "mplogo.pcx"); // MAC SHAREWARE
+                       if (cfexist(filename))
+                               show_title_screen(filename, 1, 1);
+
+                       strcpy(filename, MenuHires?"logob.pcx":"logo.pcx"); // OEM
+                       if (! cfexist(filename))
+                               strcpy(filename, "logo.pcx"); // SHAREWARE
+                       if (! cfexist(filename))
+                               strcpy(filename, "plogo.pcx"); // MAC SHAREWARE
+                       if (cfexist(filename))
+                               show_title_screen(filename, 1, 1);
+               }
+       }
+
+       {       //show bundler movie or screens
+
+               char filename[FILENAME_LEN];
+               PHYSFS_file *movie_handle;
+
+               played=MOVIE_NOT_PLAYED;        //default is not played
+
+               //check if OEM movie exists, so we don't stop the music if it doesn't
+               movie_handle = PHYSFS_openRead("oem.mve");
+               if (movie_handle)
+               {
+                       PHYSFS_close(movie_handle);
+                       played = PlayMovie("oem.mve",0);
+                       song_playing = 0;               //movie will kill sound
+               }
+
+               if (!played)
+               {
+                       strcpy(filename,MenuHires?"oem1b.pcx":"oem1.pcx");
+                       
+                       while (PHYSFS_exists(filename))
+                       {
+                               show_title_screen( filename, 1, 0 );
+                               filename[3]++;
+                       }
+               }
+       }
+
+       if (!song_playing)
+               songs_play_song( SONG_TITLE, 1);
+}
+
+void show_loading_screen(ubyte *title_pal)
+{
+       //grs_bitmap title_bm;
+       int pcx_error;
+       char filename[14];
+       
+       strcpy(filename, MenuHires?"descentb.pcx":"descent.pcx");
+       if (! cfexist(filename))
+               strcpy(filename, MenuHires?"descntob.pcx":"descento.pcx"); // OEM
+       if (! cfexist(filename))
+               strcpy(filename, "descentd.pcx"); // SHAREWARE
+       if (! cfexist(filename))
+               strcpy(filename, "descentb.pcx"); // MAC SHAREWARE
+       
+       gr_set_mode(MenuHires?SM(640,480):SM(320,200));
+#ifdef OGL
+       set_screen_mode(SCREEN_MENU);
+#endif
+       
+       FontHires = FontHiresAvailable && MenuHires;
+       
+       if ((pcx_error=pcx_read_fullscr( filename, title_pal ))==PCX_ERROR_NONE)        {
+               //vfx_set_palette_sub( title_pal );
+               gr_palette_clear();
+               gr_palette_fade_in( title_pal, 32, 0 );
+               gr_update();
+       } else
+               Error( "Couldn't load pcx file '%s', PCX load error: %s\n",filename, pcx_errormsg(pcx_error));
+}
+
 typedef struct {
        char    bs_name[14];                //  filename, eg merc01.  Assumes .lbm suffix.
        sbyte   level_num;
@@ -1394,3 +1533,41 @@ int get_new_message_num(char **message)
        return num;
 }
 
+void show_order_form()
+{
+#ifndef EDITOR
+       
+       int pcx_error;
+       unsigned char title_pal[768];
+       char    exit_screen[16];
+       
+       gr_set_current_canvas( NULL );
+       gr_palette_clear();
+       
+       key_flush();
+       
+       strcpy(exit_screen, MenuHires?"ordrd2ob.pcx":"ordrd2o.pcx"); // OEM
+       if (! cfexist(exit_screen))
+               strcpy(exit_screen, MenuHires?"orderd2b.pcx":"orderd2.pcx"); // SHAREWARE, prefer mac if hires
+       if (! cfexist(exit_screen))
+               strcpy(exit_screen, MenuHires?"orderd2.pcx":"orderd2b.pcx"); // SHAREWARE, have to rescale
+       if (! cfexist(exit_screen))
+               strcpy(exit_screen, MenuHires?"warningb.pcx":"warning.pcx"); // D1
+       if (! cfexist(exit_screen))
+               return; // D2 registered
+       
+       if ((pcx_error=pcx_read_fullscr( exit_screen, title_pal ))==PCX_ERROR_NONE) {
+               //vfx_set_palette_sub( title_pal );
+               gr_palette_fade_in( title_pal, 32, 0 );
+               gr_update();
+               while (!key_inkey() && !mouse_button_state(0)) {} //key_getch();
+               gr_palette_fade_out( title_pal, 32, 0 );
+       }
+       else
+               Int3();         //can't load order screen
+       
+       key_flush();
+       
+#endif
+}
+
index e01c20d..4fdc414 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: titles.h,v 1.5 2004-10-24 12:46:49 schaffner Exp $ */
+/* $Id: titles.h,v 1.6 2006-07-29 03:49:00 chris Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -27,12 +27,14 @@ extern int  Skip_briefing_screens;
 #define Skip_briefing_screens 0
 #endif
 
-extern int show_title_screen( char * filename, int allow_keys, int from_hog_only );
+extern void show_titles(void);
+extern void show_loading_screen(ubyte *title_pal);
 extern int show_briefing_screen( char * filename, int allow_keys );
 extern void show_title_flick(char *name, int allow_keys );
 extern void do_briefing_screens(char *filename,int level_num);
 extern char * get_briefing_screen( int level_num );
 
 extern void show_endgame_briefing(void);
+extern void show_order_form(void);
 
 #endif