the cutting room mirror

Hunter Killer (Atari ST)

Did you know that Hunter Killer was coded in C? Now you know. And speaking of which...

Source Code#

To do:
Rip the rest of it. Sometime soon.

The game's disk contains a large chunk of the game's code. A small portion of which has been included here. This portion starts at F710 in the .stx dump for the 1989 release.

ChangeView()
{

          bpxy[ 0 ] = 11;          bpxy[ 1 ] = 2;
          bpxy[ 2 ] = 105;         bpxy[ 3 ] = 12;

          vswr_mode( handle, 1 );
          vsf_interior( handle, 1 );
          vsf_color( handle, 10 );
          vr_recfl( handle, bpxy );

      if ( crackview == 1 )
      {
           plotCrackview();
      }
          else
      if ( damageview == 1 )
      {
           if ( prevDmgInq != 7 )
           {
               sector = tempSect = prevDmgInq;
           dmgSectorview = 1;
           }

           Damage_button(  NochgBothScr );
      }
      else
          if ( catview != -1 )
      {
           plotCatView();
      }     
      else
      if ( pscopeview == 1 )
      {
           plot_pscopeview();
      }
      else
      if ( bridgeview == 1 )
      {
           plot_bridgeview();
      }
      else
      if ( birdseyeview == 1 )
      {
           plot_bridgeviewFrame(  61, 18, 1 );
           plotMap();
           dot_in_map();
           Plot_MapFlags();
      }
      change_view = 0;
}




Up_submarine()
{
   /*   This function checks if submarine has surface, updates the
    view, if at periscope depth and periscope up, it lower it.  */

    int  i, j, prevdepth;
    long k;

    if ( depth > 0 )
    {
     prevdepth = depth;

     if ( depth <= time_scale )
         depth = 0;
     else
         depth -= time_scale;

     if ( !dmgGauge[ dmgGaugDepth ] )
     {
         whichscr_mfdb = savescr_mfdb;
             justEraseMouse( oldscreen, savescr_mfdb );
         update_display( 1, ( long ) depth );
         savePlotMouse( oldscreen, savescr_mfdb ); 

         whichscr_mfdb = curscr_mfdb;
         update_display( 1, ( long ) depth );
     }

         if (( prevdepth > 45 ) && ( depth <= 45 ) && 
         ( up_pscope ) && ( ! pscopeview ))
     {
           JustLowerPscope = 1;
           Default_View();
           JustLowerPscope = 0;
     }
     else
         if (( prevdepth > 9 ) && ( depth <= 9 ) && ( ! bridgeview ))
     {
           if (( down_pscope == -1 ) && ( !dmgFeatSec2[ dmgPscope ] ))
           {
            PscopeMoving = 1;         /* down periscope */
                down_pscope = 1;
                perisup_mfdb.fd_addr = &perismidup;
                vro_cpyfm( handle, 3, pscopexy, &perisup_mfdb, 
                   whichscr_mfdb);
                pscopefill[ 3 ] = 5;
           }
           if ( MusicFileOn  )
           {
                   SoundFxC = WavesFx;
               SoundDiffC = 0;
                   Supexec ( SoundEffectC );
           }
           JustLowerPscope = 1;
           Default_View();
     }
    }
    else
    if ( depth < 1 )
    {
     updownsub_mfdb.fd_addr = &upsdirbtn;
     justEraseMouse( oldscreen, savescr_mfdb );
         whichscr_mfdb = savescr_mfdb;
     colors[ 0 ] = 7;
     colors[ 1 ] = 0;
     press_button( prevUpDown, &updownsub_mfdb );
     savePlotMouse( oldscreen, savescr_mfdb ); 
     whichscr_mfdb = curscr_mfdb;
     colors[ 0 ] = 7;
     colors[ 1 ] = 0;
     press_button( prevUpDown, &updownsub_mfdb );
     prevUpDown = 0;
     nextUpDown = 0;
     UpDownInertia = 0;
    }
}