home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oceans Below (Bundled Version)
/
OCEANS_MPC.bin
/
oceans.rul
< prev
next >
Wrap
Text File
|
1993-08-26
|
13KB
|
411 lines
//
// OCEANS BELOW v1.0 Installation Script
// by Terry R. Schussler
// (c) 1993 by gray matter design. All rights reserved.
// This code licensed to Amazing Media, Inc. for internal use.
//
//
// Notes: Requires ~235K of hard disk space to install
//
/*--------------------------------------------------------*/
/* Constant Declarations */
/*--------------------------------------------------------*/
#define STD_MAX_SIZE 200
#define TOTAL_FILE_SIZE 400000
#define ALT_FILE_SIZE 50000
#define BASE_FILE_SIZE 125000
/*--------------------------------------------------------*/
/* Variable Declarations */
/*--------------------------------------------------------*/
declare
string szText[ STD_MAX_SIZE ], szDefPath[ STD_MAX_SIZE ];
string szResultPath[ STD_MAX_SIZE ];
string szDisk[ 50 ];
string szBitmapPath[ STD_MAX_SIZE ];
string szErrMsg [ STD_MAX_SIZE ];
string szErrFile [ STD_MAX_SIZE ];
string szREADME [ STD_MAX_SIZE ];
string szDir[ STD_MAX_SIZE ];
string szQTWPath[ STD_MAX_SIZE ];
string szPath[ STD_MAX_SIZE ];
string szIconPath[ STD_MAX_SIZE ];
string szBMPPath[ STD_MAX_SIZE ];
string szProgramPath[ STD_MAX_SIZE ];
string szDrive[ STD_MAX_SIZE ];
string szText2[ STD_MAX_SIZE ];
number nSpaceRequired;
number fileHandle;
number nNumber;
program /* Must use program keyword to start the statements */
Start:
Enable( DEFWINDOWMODE );
Handler( EXIT, HandleExit );
// Set the color of the back to be WHITE
SetColor( BACKGROUND, RGB(255,255,255) );
SetColor( STATUSBAR, RGB(255,0,0) );
SetFont( FONT_TITLE, STYLE_BOLD, "Helv" );
SetTitle( "OCEANS BELOW INSTALLER", 45, BACKGROUNDCAPTION );
SetStatusWindow( 0, "Beginning installation process..." );
// Enable various objects.
Enable( BITMAPFADE ); // All bitmaps will fade into the screen.
Disable( FEEDBACK_FULL ); // Feedback window disabled
// Enable( FEEDBACK_OPERATION ); // Feedback window enabled
Disable( HELP ); // Help Button
Disable( EXIT ); // Exit Button
Disable( PAUSE ); // Pause Button
Enable( STATUS ); // Status, % Complete Bar Window
Enable( TEXT ); // Info Windows
Enable( BACKGROUND ); // Display background and all windows
SizeWindow( INFO, 460, 150 );
PlaceWindow( INFO, 60, 10, LOWER_RIGHT );
// In Info Window to display the shuttle.lis information
SetInfoWindow( "Information", "OCEANS.LIS" );
// Determine target location for files
GetDisk( TARGETDIR, szDisk );
StrCopy( szDefPath, szDisk );
StrConcat( szDefPath, "\\" );
nSpaceRequired = TOTAL_FILE_SIZE;
DrawBitmaps:
// Place OCEANS logo in the top center
// StrCopy( szBMPPath, SRCDIR );
// AppendToPath( szBMPPath, "OCEANS.BMP" );
// PlaceBitmap( szBMPPath, 101, 210, 3, UPPER_LEFT );
Disable( BITMAPFADE ); // Bitmaps will now be drawn and not faded in
TargetLoc:
SetStatusWindow( 0, "Installing OCEANS BELOW..." );
BeginInstall:
// Check to see if enough space is free on the destination.
// GetDiskSpace returns free space in LAST_RESULT.
GetDiskSpace( szDisk );
if LAST_RESULT > nSpaceRequired goto EnoughSpace;
StrCopy( szText, "Not enough space on ");
StrConcat( szText, szDisk );
StrConcat( szText, " - Aborting installation.");
MessageBox( szText, WARNING );
StrCopy( TARGETDIR, SRCDIR );
DeleteFile( "sync.fil" );
exit;
EnoughSpace:
DirExists:
SetStatusWindow( 0, "Continuing installation..." );
StrCopy( TARGETDIR, szResultPath );
// Check to see if INSTALL.INS exists on the CD
// If it does, then it must the right disk.
StrCopy( szText, SRCDIR );
AppendToPath( szText, "INSTALL.INS" );
GetFileInfo( szText, FILE_DATE, nNumber, szText2 );
if LAST_RESULT != FALSE then
// Ask user to enter a disk in drive.
StrCopy( szText, "Please insert OCEANS BELOW CD...");
SetDialogTitle( DLG_ENTER_DISK, "CD Disk Request" );
EnterDisk( szText, "install.ins");
if LAST_RESULT != TRUE then
call ConfirmCancel; // Call to confirm cancel
goto DirExists; // returned, therefore continue
endif;
endif;
call FileTransfer;
endInstall:
StrCopy( szText, "OCEANS BELOW has just been\nsuccessfully installed.\nPlease reboot your computer before\nrunning OCEANS BELOW.");
MessageBeep( 0 );
SetDialogTitle( DLG_MSG_INFORMATION, "Successful Installation" );
MessageBox( szText, INFORMATION ); // Get the user to acknowledge success
StrCopy( TARGETDIR, SRCDIR );
DeleteFile( "sync.fil" );
AskYesNo( "Would you like to view\nthe Read Me file for\nOCEANS BELOW?", TRUE );
if LAST_RESULT = YES then
StrCopy( szREADME, szResultPath );
AppendToPath( szREADME,"OCEANS.TXT");
LaunchApp("notepad.exe", szREADME );
else
// Show the Program Manager and the Program Group we created
AppCommand( PROGMAN, CMD_MAXIMIZE );
ShowGroup( "OCEANS", 1 );
endif;
exit; //Exit installation program.
//-----------------------------------------------------------------------------
//
// Name: FileTransfer
//
// Descrip: This procedure will handle the file transfer for this
// installation.
//
// Params:
//
//-----------------------------------------------------------------------------
FileTransfer:
StrCopy( TARGETDIR, szDefPath );
StatusUpdate( ON, 3);
SetStatusWindow( 3, "Copying file ... OCEANS.ICO" );
CopyFile( "OCEANS.ICO", "OCEANS.ICO" );
if LAST_RESULT < 0 then
StrCopy( szErrFile, "OCEANS.ICO" );
call CopyError;
endif;
// Put this into the Windows directory //
StrCopy( TARGETDIR, WINDIR);
StatusUpdate( ON, 3);
SetStatusWindow( 3, "Copying file ... OCEANS.INI" );
CopyFile( "OCEANS.INI", "OCEANS.INI" );
if LAST_RESULT < 0 then
StrCopy( szErrFile, "OCEANS.INI" );
call CopyError;
endif;
StatusUpdate( ON, 5);
SetStatusWindow( 3, "Copying file ... OCEANS.TXT" );
CopyFile( "OCEANS.TXT", "OCEANS.TXT" );
if LAST_RESULT < 0 then
StrCopy( szErrFile, "OCEANS.TXT" );
call CopyError;
endif;
//////////////////////////////////////////////////////////////////
//
// Install QTW
//
// Ask the user if we can install the required QTW files.
// If he is agreeable install it
//----------------------------------------------------------------
// BeginQTWInstall:
StrCopy(szText, "Oceans Below requires QuickTime to run properly. Click YES to install QuickTime and add its path to your AUTOEXEC.BAT file.");
// GetDisk(szResultPath, szDisk);
// StrCopy(szPath, szDisk);
// AppendToPath(szPath, "QTW");
AskYesNo(szText, YES);
if LAST_RESULT = YES then
call CopyQuickTime;
else
StrCopy(szText, "Warning: You will need QuickTime installed\nto properly run OCEANS BELOW.");
MessageBeep( 0 );
SetDialogTitle( DLG_MSG_WARNING, "QuickTime Reminder!" );
MessageBox( szText, WARNING );
endif;
// finishInstall:
// This creates a Windows Program Group for OCEANS
CreateProgGroup( "OCEANS" );
StrCopy( szProgramPath, SRCDIR );
AppendToPath( szProgramPath, "OCEANS.EXE" );
StrCopy( szIconPath, szDefPath );
AppendToPath( szIconPath, "OCEANS.ICO" );
AddProgItem( "OCEANS", "OCEANS", szProgramPath, szIconPath);
StrCopy( TARGETDIR, szDefPath );
DeleteFile( "OCEANS.ICO" );
StrCopy( szProgramPath, WINDIR );
AppendToPath( szProgramPath, "OCEANS.TXT" );
AddProgItem( "OCEANS", "OCEANS Read Me", szProgramPath, "");
// Installation is done
Disable( STATUS );
return;
//----------------------------------------------------------------
CopyQuickTime:
StatusUpdate( ON, 8);
SetStatusWindow( 7, "Continuing installation..." );
// QuickTime for Windows needs to be installed
StrCopy(szQTWPath, szDefPath);
AppendToPath(szQTWPath, "QTW");
// Check to see if Directory Exists
ExistsDir(szQTWPath);
if LAST_RESULT = EXISTS goto QTWDirExists;
CreateDir(szQTWPath);
if LAST_RESULT = EXISTS goto QTWDirExists;
StrCopy( szText, "Cannot create QuickTime directory. ");
StrConcat( szText, " - Aborting installation.");
MessageBox( szText, WARNING );
StrCopy( TARGETDIR, SRCDIR );
DeleteFile( "sync.fil" );
exit;
QTWDirExists:
// Check to see if QTIM.DLL exists in the QuickTime
// directory. If it doesn't, then install QuickTime.
StrCopy( szText, szQTWPath );
AppendToPath( szText, "QTIM.DLL" );
GetFileInfo( szText, FILE_DATE, nNumber, szText2 );
if LAST_RESULT != FALSE then
// Copy the files to szQTWPath
StrCopy(TARGETDIR, szQTWPath);
StatusUpdate( ON, 96);
SetStatusWindow( 9, "Decompressing QuickTime files ... QTIME.LI$" );
DeCompress( "QTIME.LI$", "" );
if LAST_RESULT < 0 then
StrCopy( szErrFile, "QTIME.LI$" );
call CopyError;
endif;
else
StrCopy( szText, "QuickTime is already installed in\nthe \\QTW directory, so I will not\n install QuickTime.");
MessageBeep( 0 );
SetDialogTitle( DLG_MSG_WARNING, "QuickTime Installation Warning!" );
MessageBox( szText, WARNING );
endif;
StrCopy(TARGETDIR, WINDIR);
StatusUpdate( ON, 100);
SetStatusWindow( 96, "Copying file ... QTW.INI");
CopyFile( "QTW.INI", "QTW.INI" );
if LAST_RESULT < 0 then
StrCopy(szErrFile, "QTW.INI" );
call CopyError;
endif;
// Now install things in the user specified directory
StrCopy( TARGETDIR, szDefPath );
// Now back up the user's AUTOEXEC.BAT file to AUTOEXEC.OLD
BatchGetFileName( szText );
GetDisk( szText, szText2 );
StrConcat( szText2, "\\AUTOEXEC.OLD" );
BatchFileLoad( szText );
BatchFileSave( "AUTOEXEC.OLD" );
StrCopy( szText, "Your AUTOEXEC.BAT file has been backed\nup to ");
StrConcat( szText, szText2 );
StrConcat( szText, " and a new AUTOEXEC.BAT has been created." );
MessageBeep( 0 );
SetDialogTitle( DLG_MSG_INFORMATION, "AUTOEXEC.BAT Modification Note" );
MessageBox( szText, INFORMATION );
// Add QuickTime path to the AUTOEXEC.BAT file
EzBatchAddPath("PATH", szQTWPath, "", BEFORE);
//--end of QuickTime installation section
return;
//-----------------------------------------------------------------------------
//
// Name: ConfirmCancel
//
// Descrip: This will as the users if they want to terminate the
// installation.
//
// Params:
//
//-----------------------------------------------------------------------------
ConfirmCancel:
AskYesNo( "Are you sure you want to CANCEL installation ?", FALSE );
if LAST_RESULT = FALSE then return;
endif;
StrCopy( szText, "Installation is aborted.");
MessageBeep( 0 );
SetDialogTitle( DLG_MSG_WARNING, "Aborted Installation Warning!" );
MessageBox( szText, WARNING );
StrCopy( TARGETDIR, SRCDIR );
DeleteFile( "sync.fil" );
exit;
return;
//-----------------------------------------------------------------------------
//
// Name: CopyError
//
// Descrip: This will be invoked when an error occurs during a
// file transfer operation.
//
// Params: szErrFile
//
//-----------------------------------------------------------------------------
CopyError:
StrCopy( szErrMsg, "Unable to copy or decompress file: ");
StrConcat( szErrMsg, szErrFile);
MessageBeep( 0 );
SetDialogTitle( DLG_MSG_SEVERE, "Problem Occurred!" );
MessageBox( szErrMsg, SEVERE );
return;
//-----------------------------------------------------------------------------
//
// Name: HandleExit
//
// Descrip: This will be invoked when the exit button is hit.
//
//-----------------------------------------------------------------------------
HandleExit: // This will handle the exit button
AskYesNo( "Are you sure you want to exit?", FALSE );
if LAST_RESULT = NO then
return;
endif;
StrCopy( szText, "Installation is aborted.");
MessageBeep( 0 );
SetDialogTitle( DLG_MSG_WARNING, "Aborted Installation Warning!" );
MessageBox( szText, WARNING );
StrCopy( TARGETDIR, SRCDIR );
DeleteFile( "sync.fil" );
exit;