home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / GAMES_C / DEU50.ZIP / SOURCE.ZIP / EDIT.C < prev    next >
C/C++ Source or Header  |  1994-03-30  |  35KB  |  1,213 lines

  1. /*
  2.    Doom Editor Utility, by Brendon Wyber and Raphaël Quinet.
  3.  
  4.    You are allowed to use any parts of this code in another program, as
  5.    long as you give credits to the authors in the documentation and in
  6.    the program itself.  Read the file README.1ST for more information.
  7.  
  8.    This program comes with absolutely no warranty.
  9.  
  10.    EDIT.C - Editor routines.
  11. */
  12.  
  13. /* the includes */
  14. #include "deu.h"
  15. #include "levels.h"
  16. int  MoveSpeed = 20;        /* movement speed */
  17. Bool InfoShown = FALSE;        /* should we display the info bar? */
  18.  
  19.  
  20. /*
  21.    the driving program
  22. */
  23.  
  24. void EditLevel( int episode, int level, Bool newlevel)
  25. {
  26.    ReadWTextureNames();
  27.    ReadFTextureNames();
  28.    InitGfx();
  29.    CheckMouseDriver();
  30.    if (episode < 1 || level < 1)
  31.       SelectLevel( &episode, &level);
  32.    if (episode > 0 && level > 0)
  33.    {
  34.       ClearScreen();
  35.       ReadLevelData( episode, level);
  36.       if (newlevel)
  37.       {
  38.      ForgetLevelData();
  39.      MapMinX = -4000;
  40.      MapMinY = -4000;
  41.      MapMaxX = 4000;
  42.      MapMaxY = 4000;
  43.       }
  44.       EditorLoop( episode, level);
  45.       TermGfx();
  46.       if (! Registered)
  47.      printf( "Please register DOOM if you want to be able to save your changes.\n");
  48.       else if (! MadeChanges)
  49.      printf( "No changes made, nothing to save.\n");
  50.       ForgetLevelData();
  51.       /* forget the level pointer */
  52.       Level = NULL;
  53.    }
  54.    else
  55.       TermGfx();
  56.    ForgetWTextureNames();
  57.    ForgetFTextureNames();
  58. }
  59.  
  60.  
  61.  
  62. /*
  63.    select a level
  64. */
  65.  
  66. void SelectLevel( int *episode, int *level)
  67. {
  68.    MDirPtr dir;
  69.    char name[ 7];
  70.    char **levels;
  71.    int n = 0;
  72.  
  73.    dir = MasterDir;
  74.    while (dir)
  75.    {
  76.       if (dir->dir.size == 0 && dir->dir.name[ 0] == 'E' && dir->dir.name[ 2] == 'M' && dir->dir.name[ 4] == '\0')
  77.       {
  78.      if (n > 0)
  79.         levels = ResizeMemory( levels, (n + 1) * sizeof( char *));
  80.      else
  81.         levels = GetMemory( sizeof( char *));
  82.      levels[ n] = dir->dir.name;
  83.      n++;
  84.       }
  85.       dir = dir->next;
  86.    }
  87.    if (*episode < 1)
  88.       *episode = 1;
  89.    if (*level < 1)
  90.       *level = 1;
  91.    sprintf( name, "E%dM%d", *episode, *level);
  92.    InputNameFromList( -1, -1, "Select an episode and a level number:", n, levels, name);
  93.    free( levels);
  94.    if (*name)
  95.       sscanf( name, "E%dM%d", episode, level);
  96.    else
  97.    {
  98.       *episode = 0;
  99.       *level = 0;
  100.    }
  101. }
  102.  
  103.  
  104.  
  105. /*
  106.    get the name of the new WAD file
  107. */
  108.  
  109. char *GetWadFileName( int episode, int level)
  110. {
  111.    char *outfile = GetMemory( 80);
  112.    char *dotp;
  113.    WadPtr wad;
  114.  
  115.    /* get the file name */
  116.    if (! strcmp(Level->wadfile->filename, MainWad))
  117.       sprintf( outfile, "E%dL%d.WAD", episode, level);
  118.    else
  119.       strcpy( outfile, Level->wadfile->filename);
  120.    do
  121.    {
  122.       InputFileName( -1, -1, "Name of the new WAD file:", 79, outfile);
  123.    }
  124.    while (!strcmp(outfile, MainWad));
  125.    /* escape */
  126.    if (outfile[ 0] == '\0')
  127.    {
  128.       free( outfile);
  129.       return NULL;
  130.    }
  131.    /* if the WAD file already exists, rename it to "*.BAK" */
  132.    for (wad = WadFileList; wad; wad = wad->next)
  133.       if (!stricmp( outfile, wad->filename))
  134.       {
  135.      dotp = strrchr( wad->filename, '.');
  136.      if (dotp == NULL)
  137.         strcat( wad->filename, ".BAK");
  138.      else
  139.         strcpy( dotp, ".BAK");
  140.      /* need to close, then reopen: problems with SHARE.EXE */
  141.      fclose( wad->fileinfo);
  142.      if (rename( outfile, wad->filename) < 0)
  143.      {
  144.         if (unlink( wad->filename) < 0)
  145.            ProgError( "could not delete file \"%s\"", wad->filename);
  146.         if (rename( outfile, wad->filename) < 0)
  147.            ProgError( "could not rename \"%s\" to \"%s\"", outfile, wad->filename);
  148.      }
  149.      wad->fileinfo = fopen( wad->filename, "rb");
  150.      if (wad->fileinfo == NULL)
  151.         ProgError( "could not reopen file \"%s\"", wad->filename);
  152.      break;
  153.       }
  154.    return outfile;
  155. }
  156.  
  157.  
  158.  
  159. /*
  160.    display the help screen
  161.  */
  162.  
  163. void DisplayHelp( int objtype, int grid)
  164. {
  165.    int x0 = 137;
  166.    int y0 = 50;
  167.  
  168.    if (UseMouse)
  169.       HideMousePointer();
  170.    /* put in the instructions */
  171.    DrawScreenBox3D( x0, y0, x0 + 364, y0 + 355);
  172.    SetColor( LIGHTCYAN);
  173.    DrawScreenText( x0 + 100, y0 + 20, "Doom Editor Utility");
  174.    DrawScreenText( 269 - strlen(GetEditModeName( objtype)) * 4, y0 + 32, "- %s Editor -", GetEditModeName( objtype));
  175.    SetColor( BLACK);
  176.    DrawScreenText( x0 + 10, y0 + 60, "Use the mouse or the cursor keys to move");
  177.    DrawScreenText( -1, -1, "around.  The map scrolls when the pointer");
  178.    DrawScreenText( -1, -1, "reaches the edge of the screen.");
  179.    DrawScreenText( -1, y0 + 100, "Other useful keys are:");
  180.    if (Registered)
  181.       DrawScreenText( -1, y0 + 115, "Q     - Quit, saving changes");
  182.    else
  183.    {
  184.       SetColor( DARKGRAY);
  185.       DrawScreenText( -1, y0 + 115, "Q     - Quit without saving changes");
  186.       SetColor( BLACK);
  187.    }
  188.    DrawScreenText( -1, -1, "Esc   - Exit without saving changes");
  189.    DrawScreenText( -1, -1, "Tab   - Switch to the next editing mode");
  190.    DrawScreenText( -1, -1, "Space - Change the move/scroll speed");
  191.    DrawScreenText( -1, -1, "+/-   - Change the map scale (current: %d)", Scale);
  192.    DrawScreenText( -1, -1, "G     - Change the grid scale (cur.: %d)", grid);
  193.    if (GetCurObject( objtype, MAPX( PointerX - 4), MAPY( PointerY - 4), MAPX( PointerX + 4), MAPY( PointerY + 4)) >= 0)
  194.       SetColor( DARKGRAY);
  195.    DrawScreenText( -1, -1, "N, >  - Jump to the next object.");
  196.    DrawScreenText( -1, -1, "P, <  - Jump to the previous object.");
  197.    DrawScreenText( -1, -1, "J, #  - Jump to a specific object (enter #)");
  198.    SetColor( BLACK);
  199.    DrawScreenText( -1, -1, "M     - Mark/unmark current object (select)");
  200.    if (objtype == OBJ_THINGS || objtype == OBJ_VERTEXES)
  201.       DrawScreenText( -1, -1, "D     - Toggle drag mode");
  202.    else
  203.       DrawScreenText( -1, -1, "C     - Clear all marks and redraw map");
  204.    DrawScreenText( -1, -1, "Ins   - Insert a new object");
  205.    DrawScreenText( -1, -1, "Del   - Delete the current object");
  206.    DrawScreenText( -1, -1, "Enter - Edit the current/selected object(s)");
  207.    DrawScreenText( -1, y0 + 265, "Mouse buttons:");
  208.    if (SwapButtons)
  209.    {
  210.       DrawScreenText( -1, y0 + 280, "Left  - Edit the current/selected object(s)");
  211.       DrawScreenText( -1, -1, "Middle- Mark/unmark the current object.");
  212.    }
  213.    else
  214.    {
  215.       DrawScreenText( -1, y0 + 280, "Left  - Mark/unmark the current object");
  216.       DrawScreenText( -1, -1, "Middle- Edit the current/selected object(s)");
  217.    }
  218.    DrawScreenText( -1, -1, "Right - Drag the current/selected object(s)");
  219.    DrawScreenText( -1, y0 + 320, "Please read DEU.TXT for more information");
  220.    SetColor( YELLOW);
  221.    DrawScreenText( -1, y0 + 340, "Press any key to return to the editor...");
  222.    bioskey( 0);
  223.    if (UseMouse)
  224.       ShowMousePointer();
  225. }
  226.  
  227.  
  228.  
  229. /*
  230.    the editor main loop
  231. */
  232.  
  233. void EditorLoop( int episode, int level)
  234. {
  235.    int    EditMode = OBJ_THINGS;
  236.    int    CurObject = -1;
  237.    int    OldObject = -1;
  238.    Bool   RedrawMap = TRUE;
  239.    Bool   RedrawObj = FALSE;
  240.    Bool   DragObject = FALSE;
  241.    int    key, altkey, buttons, oldbuttons;
  242.    int    GridScale = 0;
  243.    SelPtr Selected = NULL;
  244.    char   keychar;
  245.    int    SelBoxX, SelBoxY;
  246.    Bool   StretchSelBox = FALSE;
  247.  
  248.    OrigX = (MapMinX + MapMaxX) / 2;
  249.    OrigY = (MapMinY + MapMaxY) / 2;
  250.    if (InitialScale < 1)
  251.       InitialScale = 1;
  252.    else if (InitialScale > 20)
  253.       InitialScale = 20;
  254.    Scale = InitialScale;
  255.    MadeChanges = FALSE;
  256.    MadeMapChanges = FALSE;
  257.    PointerX = ScrCenterX;
  258.    PointerY = ScrCenterY;
  259.    if (UseMouse)
  260.    {
  261.       ResetMouseLimits();
  262.       SetMouseCoords(PointerX, PointerY);
  263.       ShowMousePointer();
  264.       oldbuttons = 0;
  265.    }
  266.    else
  267.       FakeCursor = TRUE;
  268.  
  269.    for (;;)
  270.    {
  271.       key = 0;
  272.  
  273.       /* get mouse position and button status */
  274.       if (UseMouse)
  275.       {
  276.      if (FakeCursor)
  277.         DrawPointer();
  278.      GetMouseCoords( &PointerX, &PointerY, &buttons);
  279.      if (FakeCursor)
  280.         DrawPointer();
  281.      if ( buttons == 1 && PointerY < 17)
  282.      {
  283.         /* kluge for the menu bar */
  284.         altkey = 0x08;
  285.         if (PointerX < 12)
  286.            Beep();
  287.         else if (PointerX < 60)
  288.            key = 0x2100; /* 'F' */
  289.         else if (PointerX < 108)
  290.            key = 0x1200; /* 'E' */
  291.         else if (PointerX < 172)
  292.            key = 0x1f00; /* 'S' */
  293.         else if (PointerX < 244)
  294.            key = 0x1800; /* 'O' */
  295.         else if (PointerX < ScrMaxX - 43)
  296.            Beep();
  297.         else
  298.            key = 0x2300; /* 'H' */
  299.      }
  300.      else
  301.      {
  302.         if (buttons != oldbuttons)
  303.            switch (buttons)
  304.            {
  305.            case 1:
  306.           if (SwapButtons)
  307.              key = 0x000D;
  308.           else
  309.              key = 'M'; /* Press left button = Mark/Unmark ('M') */
  310.           break;
  311.            case 2:
  312.           DragObject = TRUE; /* Press right button = Drag */
  313.           if (EditMode == OBJ_THINGS && CurObject >= 0)
  314.              MoveObjectsToCoords( EditMode, NULL, Things[ CurObject].xpos, Things[ CurObject].ypos, 0);
  315.           else if (EditMode == OBJ_VERTEXES && CurObject >= 0)
  316.              MoveObjectsToCoords( EditMode, NULL, Vertexes[ CurObject].x, Vertexes[ CurObject].y, 0);
  317.           else
  318.              MoveObjectsToCoords( EditMode, NULL, MAPX( PointerX), MAPY( PointerY), GridScale);
  319.           break;
  320.            case 3:
  321.            case 4:
  322.           if (SwapButtons)
  323.              key = 'M';
  324.           else
  325.              key = 0x000D;    /* Press middle button = Edit ('Enter') */
  326.           break;
  327.            default:
  328.           if (StretchSelBox) /* Release left button = End Selection Box */
  329.              key = 'M';
  330.           DragObject = FALSE; /* Release right button = End Drag */
  331.           break;
  332.            }
  333.      }
  334.      oldbuttons = buttons;
  335.       }
  336.  
  337.       /* drag object(s) */
  338.       if (DragObject)
  339.       {
  340.      int forgetit = FALSE;
  341.  
  342.      if (IsSelected( Selected, CurObject) == FALSE)
  343.         ForgetSelection( &Selected);
  344.      else if (Selected->objnum != CurObject)
  345.      {
  346.         /* current object must be first in the list */
  347.         UnSelectObject( &Selected, CurObject);
  348.         SelectObject( &Selected, CurObject);
  349.      }
  350.      if (Selected == NULL && CurObject >= 0)
  351.      {
  352.         SelectObject( &Selected, CurObject);
  353.         forgetit = TRUE;
  354.      }
  355.      if (Selected)
  356.      {
  357.         if (MoveObjectsToCoords( EditMode, Selected, MAPX( PointerX), MAPY( PointerY), GridScale))
  358.            RedrawMap = TRUE;
  359.         if (forgetit)
  360.            ForgetSelection( &Selected);
  361.      }
  362.      else
  363.      {
  364.         Beep();
  365.         DragObject = FALSE;
  366.      }
  367.       }
  368.       else if (StretchSelBox)
  369.       {
  370.      int x = MAPX( PointerX);
  371.      int y = MAPY( PointerY);
  372.  
  373.      /* draw selection box */
  374.      SetColor( CYAN);
  375.      setwritemode( XOR_PUT);
  376.      if (UseMouse)
  377.         HideMousePointer();
  378.      DrawMapLine( SelBoxX, SelBoxY, SelBoxX, y);
  379.      DrawMapLine( SelBoxX, y, x, y);
  380.      DrawMapLine( x, y, x, SelBoxY);
  381.      DrawMapLine( x, SelBoxY, SelBoxX, SelBoxY);
  382.      if (UseMouse)
  383.         ShowMousePointer();
  384.      delay( 50);
  385.      if (UseMouse)
  386.         HideMousePointer();
  387.      DrawMapLine( SelBoxX, SelBoxY, SelBoxX, y);
  388.      DrawMapLine( SelBoxX, y, x, y);
  389.      DrawMapLine( x, y, x, SelBoxY);
  390.      DrawMapLine( x, SelBoxY, SelBoxX, SelBoxY);
  391.      setwritemode( COPY_PUT);
  392.      if (UseMouse)
  393.         ShowMousePointer();
  394.       }
  395.       else if (!RedrawObj)
  396.       {
  397.      /* check if there is something near the pointer */
  398.      OldObject = CurObject;
  399.      if ((bioskey( 2) & 0x03) == 0x00)  /* no shift keys */
  400.         CurObject = GetCurObject( EditMode, MAPX( PointerX - 4), MAPY( PointerY - 4), MAPX( PointerX + 4), MAPY( PointerY + 4));
  401.      if (CurObject < 0)
  402.         CurObject = OldObject;
  403.       }
  404.  
  405.       /* draw the map */
  406.       if (RedrawMap)
  407.       {
  408.      if (UseMouse)
  409.         HideMousePointer();
  410.      DrawMap( EditMode, GridScale);
  411.      HighlightSelection( EditMode, Selected);
  412.      if (UseMouse)
  413.         ShowMousePointer();
  414.       }
  415.  
  416.       /* highlight the current object and display the information box */
  417.       if (RedrawMap || CurObject != OldObject || RedrawObj)
  418.       {
  419.      RedrawObj = FALSE;
  420.      if (UseMouse)
  421.         HideMousePointer();
  422.      if (!RedrawMap && OldObject >= 0)
  423.         HighlightObject( EditMode, OldObject, YELLOW);
  424.      if (CurObject != OldObject)
  425.      {
  426.         if (! Quiet)
  427.         {
  428.            sound( 50);
  429.            delay( 10);
  430.            nosound();
  431.         }
  432.         OldObject = CurObject;
  433.      }
  434.      if (CurObject >= 0)
  435.         HighlightObject( EditMode, CurObject, YELLOW);
  436.      if (bioskey( 1)) /* speedup */
  437.         RedrawObj = TRUE;
  438.      else
  439.         DisplayObjectInfo( EditMode, CurObject);
  440.      if (UseMouse)
  441.         ShowMousePointer();
  442.       }
  443.       if (RedrawMap && FakeCursor)
  444.      DrawPointer();
  445.  
  446.       /* the map is up to date */
  447.       RedrawMap = FALSE;
  448.  
  449.       /* get user input */
  450.       if (bioskey( 1) || key)
  451.       {
  452.      if (! key)
  453.      {
  454.         key = bioskey( 0);
  455.         altkey = bioskey( 2);
  456.      }
  457.  
  458.      /* user wants to access the drop-down menus */
  459.      if (altkey & 0x08)    /* if alt is pressed... */
  460.      {
  461.         if ((key & 0xFF00) == 0x2100)       /* Scan code for F */
  462.         {
  463.            key = PullDownMenu( 18, 19,
  464.                    "  Save     F2", 0x001B,    (int) 'S',
  465.                    "X Print      ", -1,        (int) 'P',
  466.                    "  Quit      Q", (int) 'Q', (int) 'Q',
  467.                    NULL);
  468.            RedrawMap = TRUE;
  469.         }
  470.  
  471.         else if ((key & 0xFF00) == 0x1200)  /* Scan code for E */
  472.         {
  473.            key = PullDownMenu( 66, 19,
  474.                    "X Copy object(s)       ", -1,        (int) 'C',
  475.                    "  Add object        Ins", 0x5200,    (int) 'A',
  476.                    "  Delete object(s)  Del", 0x5300,    (int) 'D',
  477.                    "  Next object         N", (int) 'N', (int) 'N',
  478.                    "  Prev object         P", (int) 'P', (int) 'P',
  479.                    "  Jump to object...   J", (int) 'J', (int) 'J',
  480.                    NULL);
  481.            RedrawMap = TRUE;
  482.         }
  483.  
  484.         else if ((key & 0xFF00) == 0x1F00)  /* Scan code for S */
  485.         {
  486.            key = PullDownMenu( 114, 19,
  487.                    "X Find/Change       F3", -1, (int) 'F',
  488.                    "X Repeat last find    ", -1, (int) 'R',
  489.                    NULL);
  490.            RedrawMap = TRUE;
  491.         }
  492.  
  493.         else if ((key & 0xFF00) == 0x1800)  /* Scan code for O */
  494.         {
  495.            key = PullDownMenu( 178, 19,
  496.                    "Things              T", (int) 'T', (int) 'T',
  497.                    "Linedefs+Sidedefs   L", (int) 'L', (int) 'L',
  498.                    "Vertexes            V", (int) 'V', (int) 'V',
  499.                    "Sectors             S", (int) 'S', (int) 'S',
  500.                    "Next Mode         Tab", 0x0009,    (int) 'N',
  501.                    "Last Mode   Shift+Tab", 0x0f00,    (int) 'L',
  502.                    NULL);
  503.            RedrawMap = TRUE;
  504.         }
  505.  
  506.         else if ((key & 0xFF00) == 0x2300)  /* Scan code for H */
  507.         {
  508.            key = PullDownMenu( ScrMaxX - 195, 19,
  509.                    "X Getting Started     ", -1,        (int) 'G',
  510.                    "  Keyboard & Mouse  F1", 0x3b00,    (int) 'K',
  511.                    (InfoShown ?
  512.                    "√ Info Box           I"
  513.                    :
  514.                    "  Info Box           I"
  515.                    ),                          (int) 'I', (int) 'I',
  516.                    "X About...            ", -1,        (int) 'A',
  517.                    NULL);
  518.            RedrawMap = TRUE;
  519.         }
  520.      }
  521.  
  522.      /* User wants to do the impossible. */
  523.      if (key == -1)
  524.      {
  525.         NotImplemented();
  526.         RedrawMap = TRUE;
  527.      }
  528.  
  529.      /* simplify the checks later on */
  530.      if (isprint(key & 0x00ff))
  531.         keychar = toupper(key);
  532.      else
  533.         keychar = '\0';
  534.  
  535.      /* erase the (keyboard) pointer */
  536.      if (FakeCursor)
  537.         DrawPointer();
  538.  
  539.      /* user wants to exit */
  540.      if (keychar == 'Q')
  541.      {
  542.         ForgetSelection( &Selected);
  543.         if (Registered && MadeChanges)
  544.         {
  545.            char *outfile;
  546.  
  547.            outfile = GetWadFileName( episode, level);
  548.            if (outfile)
  549.            {
  550.           SaveLevelData( outfile);
  551.           break;
  552.            }
  553.            else
  554.           RedrawMap = TRUE;
  555.         }
  556.         else
  557.            break;
  558.      }
  559.      else if ((key & 0x00FF) == 0x001B) /* 'Esc' */
  560.      {
  561.         if (DragObject)
  562.            DragObject = FALSE;
  563.         else if (StretchSelBox)
  564.            StretchSelBox = FALSE;
  565.         else
  566.         {
  567.            ForgetSelection( &Selected);
  568.            if (!MadeChanges || Confirm(-1, -1, "You have unsaved changes.  Do you really want to quit?", NULL))
  569.           break;
  570.            RedrawMap = TRUE;
  571.         }
  572.      }
  573.  
  574.      /* user is lost */
  575.      else if ((key & 0xFF00) == 0x3B00) /* 'F1' */
  576.      {
  577.         DisplayHelp( EditMode, GridScale);
  578.         RedrawMap = TRUE;
  579.      }
  580.  
  581.      /* user wants to save the level data */
  582.      else if ((key & 0xFF00) == 0x3C00 && Registered) /* 'F2' */
  583.      {
  584.         char *outfile;
  585.  
  586.         outfile = GetWadFileName( episode, level);
  587.         if (outfile)
  588.            SaveLevelData( outfile);
  589.         RedrawMap = TRUE;
  590.      }
  591.  
  592.      /* user wants to insert a standard shape */
  593.      else if ((key & 0xFF00) == 0x4300) /* 'F9' */
  594.      {
  595.         int savednum, i;
  596.  
  597.         savednum = NumLineDefs;
  598.         InsertStandardObject( -1, -1, MAPX( PointerX), MAPY( PointerY));
  599.         if (NumLineDefs > savednum)
  600.         {
  601.            ForgetSelection( &Selected);
  602.            EditMode = OBJ_LINEDEFS;
  603.            for (i = savednum; i < NumLineDefs; i++)
  604.           SelectObject( &Selected, i);
  605.            CurObject = NumLineDefs - 1;
  606.            OldObject = -1;
  607.            DragObject = FALSE;
  608.            StretchSelBox = FALSE;
  609.         }
  610.         RedrawMap = TRUE;
  611.      }
  612.  
  613.      /* user wants to get the menu of misc. ops */
  614.      else if ((key & 0xFF00) == 0x4400) /* 'F10' */
  615.      {
  616.         if (Selected)
  617.            MiscOperations( -1, -1, EditMode, Selected);
  618.         else
  619.         {
  620.            if (CurObject >= 0)
  621.           SelectObject( &Selected, CurObject);
  622.            MiscOperations( -1, -1, EditMode, Selected);
  623.            if (CurObject >= 0)
  624.           UnSelectObject( &Selected, CurObject);
  625.         }
  626.         CurObject = -1;
  627.         RedrawMap = TRUE;
  628.         DragObject = FALSE;
  629.         StretchSelBox = FALSE;
  630.      }
  631.  
  632.      /* user wants to display/hide the info box */
  633.      else if (keychar == 'I')
  634.      {
  635.         InfoShown = !InfoShown;
  636.         RedrawMap = TRUE;
  637.      }
  638.  
  639.      /* user wants to change the scale */
  640.      else if ((keychar == '+' || keychar == '=') && Scale > 1)
  641.      {
  642.         OrigX += (PointerX - ScrCenterX) * Scale;
  643.         OrigY += (ScrCenterY - PointerY) * Scale;
  644.         Scale--;
  645.         OrigX -= (PointerX - ScrCenterX) * Scale;
  646.         OrigY -= (ScrCenterY - PointerY) * Scale;
  647.         RedrawMap = TRUE;
  648.      }
  649.      else if ((keychar == '-' || keychar == '_') && Scale < 20)
  650.      {
  651.         OrigX += (PointerX - ScrCenterX) * Scale;
  652.         OrigY += (ScrCenterY - PointerY) * Scale;
  653.         Scale++;
  654.         OrigX -= (PointerX - ScrCenterX) * Scale;
  655.         OrigY -= (ScrCenterY - PointerY) * Scale;
  656.         RedrawMap = TRUE;
  657.      }
  658.  
  659.      /* user wants to move */
  660.      else if ((key & 0xFF00) == 0x4800 && (PointerY - MoveSpeed) >= 0)
  661.      {
  662.         PointerY -= MoveSpeed;
  663.         if (UseMouse)
  664.            SetMouseCoords( PointerX, PointerY);
  665.      }
  666.      else if ((key & 0xFF00) == 0x5000 && (PointerY + MoveSpeed) <= ScrMaxY)
  667.      {
  668.         PointerY += MoveSpeed;
  669.         if (UseMouse)
  670.            SetMouseCoords( PointerX, PointerY);
  671.      }
  672.      else if ((key & 0xFF00) == 0x4B00 && (PointerX - MoveSpeed) >= 0)
  673.      {
  674.         PointerX -= MoveSpeed;
  675.         if (UseMouse)
  676.            SetMouseCoords( PointerX, PointerY);
  677.      }
  678.      else if ((key & 0xFF00) == 0x4D00 && (PointerX + MoveSpeed) <= ScrMaxX)
  679.      {
  680.         PointerX += MoveSpeed;
  681.         if (UseMouse)
  682.            SetMouseCoords( PointerX, PointerY);
  683.      }
  684.  
  685.      /* user wants so scroll the map */
  686.      else if ((key & 0xFF00) == 0x4900 && MAPY( ScrCenterY) < MapMaxY)
  687.      {
  688.         OrigY += MoveSpeed * 2 * Scale;
  689.         RedrawMap = TRUE;
  690.      }
  691.      else if ((key & 0xFF00) == 0x5100 && MAPY( ScrCenterY) > MapMinY)
  692.      {
  693.         OrigY -= MoveSpeed * 2 * Scale;
  694.         RedrawMap = TRUE;
  695.      }
  696.      else if ((key & 0xFF00) == 0x4700 && MAPX( ScrCenterX) > MapMinX)
  697.      {
  698.         OrigX -= MoveSpeed * 2 * Scale;
  699.         RedrawMap = TRUE;
  700.      }
  701.      else if ((key & 0xFF00) == 0x4F00 && MAPX( ScrCenterX) < MapMaxX)
  702.      {
  703.         OrigX += MoveSpeed * 2 * Scale;
  704.         RedrawMap = TRUE;
  705.      }
  706.  
  707.      /* user wants to change the movement speed */
  708.      else if (keychar == ' ')
  709.         MoveSpeed = MoveSpeed == 1 ? 20 : 1;
  710.  
  711.      /* user wants to change the edit mode */
  712.      else if ((key & 0x00FF) == 0x0009 || (key & 0xFF00) == 0x0F00 || keychar == 'T' || keychar == 'V' || keychar == 'L' || keychar == 'S')
  713.      {
  714.         if ((key & 0x00FF) == 0x0009) /* 'Tab' */
  715.         {
  716.            switch (EditMode)
  717.            {
  718.            case OBJ_THINGS:
  719.           EditMode = OBJ_VERTEXES;
  720.           break;
  721.            case OBJ_VERTEXES:
  722.           EditMode = OBJ_LINEDEFS;
  723.           break;
  724.            case OBJ_LINEDEFS:
  725.           EditMode = OBJ_SECTORS;
  726.           break;
  727.            case OBJ_SECTORS:
  728.           EditMode = OBJ_THINGS;
  729.           break;
  730.            }
  731.         }
  732.         else if ((key & 0xFF00) == 0x0F00) /* 'Shift-Tab' */
  733.         {
  734.            switch (EditMode)
  735.            {
  736.            case OBJ_THINGS:
  737.           EditMode = OBJ_SECTORS;
  738.           break;
  739.            case OBJ_VERTEXES:
  740.           EditMode = OBJ_THINGS;
  741.           break;
  742.            case OBJ_LINEDEFS:
  743.           EditMode = OBJ_VERTEXES;
  744.           break;
  745.            case OBJ_SECTORS:
  746.           EditMode = OBJ_LINEDEFS;
  747.           break;
  748.            }
  749.         }
  750.         else if (keychar == 'T')
  751.            EditMode = OBJ_THINGS;
  752.         else if (keychar == 'V')
  753.            EditMode = OBJ_VERTEXES;
  754.         else if (keychar == 'L')
  755.            EditMode = OBJ_LINEDEFS;
  756.         else if (keychar == 'S')
  757.            EditMode = OBJ_SECTORS;
  758.         /* unselect all */
  759.         ForgetSelection( &Selected);
  760.         if (GetMaxObjectNum( EditMode) >= 0)
  761.            CurObject = 0;
  762.         else
  763.            CurObject = -1;
  764.         OldObject = -1;
  765.         DragObject = FALSE;
  766.         StretchSelBox = FALSE;
  767.         RedrawMap = TRUE;
  768.      }
  769.  
  770.      /* user wants to display or hide the grid */
  771.      else if (keychar == 'G')
  772.      {
  773.         if (GridScale == 0)
  774.            GridScale = 256;
  775.         else if (GridScale > 8)
  776.            GridScale /= 2;
  777.         else
  778.            GridScale = 0;
  779.         RedrawMap = TRUE;
  780.      }
  781.      else if (keychar == 'H')
  782.      {
  783.         GridScale = 0;
  784.         RedrawMap = TRUE;
  785.      }
  786.  
  787.      /* user wants to toggle drag mode */
  788.      else if (keychar == 'D')
  789.      {
  790.         StretchSelBox = FALSE;
  791.         if (DragObject)
  792.            DragObject = FALSE;
  793.         else
  794.         {
  795.            DragObject = TRUE;
  796.            if (EditMode == OBJ_THINGS && CurObject >= 0)
  797.           MoveObjectsToCoords( EditMode, NULL, Things[ CurObject].xpos, Things[ CurObject].ypos, 0);
  798.            else if (EditMode == OBJ_VERTEXES && CurObject >= 0)
  799.           MoveObjectsToCoords( EditMode, NULL, Vertexes[ CurObject].x, Vertexes[ CurObject].y, 0);
  800.            else
  801.           MoveObjectsToCoords( EditMode, NULL, MAPX( PointerX), MAPY( PointerY), GridScale);
  802.         }
  803.      }
  804.  
  805.      /* user wants to select the next or previous object */
  806.      else if ((keychar == 'N' || keychar == '>') && GetCurObject( EditMode, MAPX( PointerX - 4), MAPY( PointerY - 4), MAPX( PointerX + 4), MAPY( PointerY + 4)) < 0)
  807.      {
  808.         if (CurObject < GetMaxObjectNum( EditMode))
  809.            CurObject++;
  810.         else if (GetMaxObjectNum( EditMode) >= 0)
  811.            CurObject = 0;
  812.         else
  813.            CurObject = -1;
  814.         RedrawObj = TRUE;
  815.      }
  816.      else if ((keychar == 'P' || keychar == '<') && GetCurObject( EditMode, MAPX( PointerX - 4), MAPY( PointerY - 4), MAPX( PointerX + 4), MAPY( PointerY + 4)) < 0)
  817.      {
  818.         if (CurObject > 0)
  819.            CurObject--;
  820.         else
  821.            CurObject = GetMaxObjectNum( EditMode);
  822.         RedrawObj = TRUE;
  823.      }
  824.      else if ((keychar == 'J' || keychar == '#') && GetCurObject( EditMode, MAPX( PointerX - 4), MAPY( PointerY - 4), MAPX( PointerX + 4), MAPY( PointerY + 4)) < 0)
  825.      {
  826.         OldObject = InputObjectNumber( -1, -1, EditMode, CurObject);
  827.         if (OldObject >= 0)
  828.            CurObject = OldObject;
  829.         else
  830.            OldObject = CurObject;
  831.         RedrawMap = TRUE;
  832.      }
  833.  
  834.      /* user wants to mark/unmark an object or a group of objects */
  835.      else if (keychar == 'M')
  836.      {
  837.         if (StretchSelBox)
  838.         {
  839.            /* select all objects in the selection box */
  840.            StretchSelBox = FALSE;
  841.            RedrawMap = TRUE;
  842.            ForgetSelection( &Selected);
  843.            Selected = SelectObjectsInBox( EditMode, SelBoxX, SelBoxY, MAPX( PointerX), MAPY( PointerY));
  844.            if (Selected)
  845.           CurObject = Selected->objnum;
  846.            else
  847.           CurObject = -1;
  848.            if (Selected && !Quiet)
  849.            {
  850.           sound( 440);
  851.           delay( 10);
  852.           nosound();
  853.            }
  854.         }
  855.         else if ((bioskey( 2) & 0x03) == 0x00)  /* no shift keys */
  856.         {
  857.            if (CurObject >= 0)
  858.            {
  859.           /* mark or unmark one object */
  860.           if (IsSelected( Selected, CurObject))
  861.              UnSelectObject( &Selected, CurObject);
  862.           else
  863.              SelectObject( &Selected, CurObject);
  864.           if (UseMouse)
  865.              HideMousePointer();
  866.           HighlightObject( EditMode, CurObject, GREEN);
  867.           if (UseMouse)
  868.              ShowMousePointer();
  869.           if (Selected && !Quiet)
  870.           {
  871.              sound( 440);
  872.              delay( 10);
  873.              nosound();
  874.           }
  875.           DragObject = FALSE;
  876.            }
  877.            else
  878.           Beep();
  879.         }
  880.         else
  881.         {
  882.            /* begin "stretch selection box" mode */
  883.            SelBoxX = MAPX( PointerX);
  884.            SelBoxY = MAPY( PointerY);
  885.            StretchSelBox = TRUE;
  886.            DragObject = FALSE;
  887.         }
  888.      }
  889.  
  890.      /* user wants to clear all marks and redraw the map */
  891.      else if (keychar == 'C')
  892.      {
  893.         ForgetSelection( &Selected);
  894.         RedrawMap = TRUE;
  895.         DragObject = FALSE;
  896.         StretchSelBox = FALSE;
  897.      }
  898.  
  899.      /* user wants to edit the current object */
  900.      else if ((key & 0x00FF) == 0x000D && CurObject >= 0) /* 'Enter' */
  901.      {
  902.         if (Selected)
  903.            EditObjectsInfo( 0, 30, EditMode, Selected);
  904.         else
  905.         {
  906.            SelectObject( &Selected, CurObject);
  907.            EditObjectsInfo( 0, 30, EditMode, Selected);
  908.            UnSelectObject( &Selected, CurObject);
  909.         }
  910.         RedrawMap = TRUE;
  911.         DragObject = FALSE;
  912.         StretchSelBox = FALSE;
  913.      }
  914.  
  915.      /* user wants to delete the current object */
  916.      else if ((key & 0xFF00) == 0x5300 && CurObject >= 0) /* 'Del' */
  917.      {
  918.         if (EditMode == OBJ_THINGS || Expert || Confirm( -1, -1,
  919.                 (Selected ? "Do you really want to delete these objects?" : "Do you really want to delete this object?"),
  920.                 (Selected ? "This will also delete the objects bound to them." : "This will also delete the objects bound to it.")))
  921.         {
  922.            if (Selected)
  923.           DeleteObjects( EditMode, &Selected);
  924.            else
  925.           DeleteObject( EditMode, CurObject);
  926.            CurObject = -1;
  927.         }
  928.         DragObject = FALSE;
  929.         StretchSelBox = FALSE;
  930.         RedrawMap = TRUE;
  931.      }
  932.  
  933.      /* user wants to insert a new object */
  934.      else if ((key & 0xFF00) == 0x5200) /* 'Ins' */
  935.      {
  936.         SelPtr cur;
  937.  
  938.         /* first special case: if several Vertices are selected, add new LineDefs */
  939.         if (EditMode == OBJ_VERTEXES && Selected != NULL && Selected->next != NULL)
  940.         {
  941.            EditMode = OBJ_LINEDEFS;
  942.            for (cur = Selected; cur->next; cur = cur->next)
  943.            {
  944.           InsertObject( EditMode, -1, 0, 0);
  945.           CurObject = GetMaxObjectNum( EditMode);
  946.           LineDefs[ CurObject].start = cur->next->objnum;
  947.           LineDefs[ CurObject].end = cur->objnum;
  948.           cur->objnum = CurObject;
  949.            }
  950.            UnSelectObject( &Selected, cur->objnum);
  951.         }
  952.         /* second special case: if several LineDefs are selected, add new SideDefs and one Sector */
  953.         else if (EditMode == OBJ_LINEDEFS && Selected != NULL)
  954.         {
  955.            for (cur = Selected; cur; cur = cur->next)
  956.           if (LineDefs[ cur->objnum].sidedef1 >= 0 && LineDefs[ cur->objnum].sidedef2 >= 0)
  957.           {
  958.              Beep();
  959.              break;
  960.           }
  961.            if (cur == NULL)
  962.            {
  963.           EditMode = OBJ_SECTORS;
  964.           InsertObject( EditMode, -1, 0, 0);
  965.           CurObject = GetMaxObjectNum( EditMode);
  966.           for (cur = Selected; cur; cur = cur->next)
  967.           {
  968.              InsertObject( OBJ_SIDEDEFS, -1, 0, 0);
  969.              SideDefs[ NumSideDefs - 1].sector = CurObject;
  970.              if (LineDefs[ cur->objnum].sidedef1 >= 0)
  971.              {
  972.             LineDefs[ cur->objnum].sidedef2 = NumSideDefs - 1;
  973.             LineDefs[ cur->objnum].flags = 4;
  974.             strncpy( SideDefs[ NumSideDefs - 1].tex3, "-", 8);
  975.             strncpy( SideDefs[ LineDefs[ cur->objnum].sidedef1].tex3, "-", 8);
  976.              }
  977.              else
  978.             LineDefs[ cur->objnum].sidedef1 = NumSideDefs - 1;
  979.           }
  980.           ForgetSelection( &Selected);
  981.            }
  982.         }
  983.         /* normal case: add a new object of the current type */
  984.         else
  985.         {
  986.            ForgetSelection( &Selected);
  987.            if (GridScale > 0)
  988.           InsertObject( EditMode, CurObject, (MAPX( PointerX) + GridScale / 2) & ~(GridScale - 1), (MAPY( PointerY) + GridScale / 2) & ~(GridScale - 1));
  989.            else
  990.           InsertObject( EditMode, CurObject, MAPX( PointerX), MAPY( PointerY));
  991.            CurObject = GetMaxObjectNum( EditMode);
  992.            if (EditMode == OBJ_LINEDEFS)
  993.            {
  994.           if (! Input2VertexNumbers( -1, -1, "Choose the two vertices for the new LineDef",
  995.                          &(LineDefs[ CurObject].start), &(LineDefs[ CurObject].end)))
  996.           {
  997.              DeleteObject( EditMode, CurObject);
  998.              CurObject = -1;
  999.           }
  1000.            }
  1001.         }
  1002.         DragObject = FALSE;
  1003.         StretchSelBox = FALSE;
  1004.         RedrawMap = TRUE;
  1005.      }
  1006.  
  1007.      /* user likes music */
  1008.      else if (key)
  1009.         Beep();
  1010.  
  1011.      /* redraw the (keyboard) pointer */
  1012.      if (FakeCursor)
  1013.         DrawPointer();
  1014.       }
  1015.  
  1016.       /* check if Scroll Lock is off */
  1017.       if ((bioskey( 2) & 0x10) == 0x00)
  1018.       {
  1019.      /* move the map if the pointer is near the edge of the screen */
  1020.      if (PointerY <= (UseMouse ? 2 : 20))
  1021.      {
  1022.         if (! UseMouse)
  1023.            PointerY += MoveSpeed;
  1024.         if (MAPY( ScrCenterY) < MapMaxY)
  1025.         {
  1026.            OrigY += MoveSpeed * 2 * Scale;
  1027.            RedrawMap = TRUE;
  1028.         }
  1029.      }
  1030.      if (PointerY >= ScrMaxY - (UseMouse ? 8 : 20))
  1031.      {
  1032.         if (! UseMouse)
  1033.            PointerY -= MoveSpeed;
  1034.         if (MAPY( ScrCenterY) > MapMinY)
  1035.         {
  1036.            OrigY -= MoveSpeed * 2 * Scale;
  1037.            RedrawMap = TRUE;
  1038.         }
  1039.      }
  1040.      if (PointerX <= (UseMouse ? 8 : 20))
  1041.      {
  1042.         if (! UseMouse)
  1043.            PointerX += MoveSpeed;
  1044.         if (MAPX( ScrCenterX) > MapMinX)
  1045.         {
  1046.            OrigX -= MoveSpeed * 2 * Scale;
  1047.            RedrawMap = TRUE;
  1048.         }
  1049.      }
  1050.      if (PointerX >= ScrMaxX - (UseMouse ? 8 : 20))
  1051.      {
  1052.         if (! UseMouse)
  1053.            PointerX -= MoveSpeed;
  1054.         if (MAPX( ScrCenterX) < MapMaxX)
  1055.         {
  1056.            OrigX += MoveSpeed * 2 * Scale;
  1057.            RedrawMap = TRUE;
  1058.         }
  1059.      }
  1060.       }
  1061.    }
  1062. }
  1063.  
  1064.  
  1065.  
  1066. /*
  1067.    draw the actual game map
  1068. */
  1069.  
  1070. void DrawMap( int editmode, int grid)
  1071. {
  1072.    int  n, m;
  1073.    char texname[9];
  1074.  
  1075.    /* clear the screen */
  1076.    ClearScreen();
  1077.  
  1078.    /* draw the grid */
  1079.    if (grid > 0)
  1080.    {
  1081.       int mapx0 = MAPX( 0) & ~(grid - 1);
  1082.       int mapx1 = (MAPX( ScrMaxX) + grid) & ~(grid - 1);
  1083.       int mapy0 = (MAPY( ScrMaxY) - grid) & ~(grid - 1);
  1084.       int mapy1 = MAPY( 0) & ~(grid - 1);
  1085.  
  1086.       SetColor( BLUE);
  1087.       for (n = mapx0; n <= mapx1; n += grid)
  1088.      DrawMapLine( n, mapy0, n, mapy1);
  1089.       for (n = mapy0; n <= mapy1; n += grid)
  1090.      DrawMapLine( mapx0, n, mapx1, n);
  1091.    }
  1092.  
  1093.    /* draw the linedefs to form the map */
  1094.    if (editmode == OBJ_VERTEXES)
  1095.    {
  1096.       SetColor( LIGHTGRAY);
  1097.       for (n = 0; n < NumLineDefs; n++)
  1098.      DrawMapVector( Vertexes[ LineDefs[ n].start].x, Vertexes[ LineDefs[ n].start].y,
  1099.             Vertexes[ LineDefs[ n].end].x, Vertexes[ LineDefs[ n].end].y);
  1100.    }
  1101.    else if (editmode == OBJ_THINGS)
  1102.       for (n = 0; n < NumLineDefs; n++)
  1103.       {
  1104.      if (LineDefs[ n].flags & 1)
  1105.         SetColor( WHITE);
  1106.      else
  1107.         SetColor( LIGHTGRAY);
  1108.      DrawMapLine( Vertexes[ LineDefs[ n].start].x, Vertexes[ LineDefs[ n].start].y,
  1109.               Vertexes[ LineDefs[ n].end].x, Vertexes[ LineDefs[ n].end].y);
  1110.       }
  1111.    else if (editmode == OBJ_LINEDEFS)
  1112.       for (n = 0; n < NumLineDefs; n++)
  1113.       {
  1114.      if (LineDefs[ n].type > 0)
  1115.      {
  1116.         if (LineDefs[ n].tag > 0)
  1117.            SetColor( LIGHTMAGENTA);
  1118.         else
  1119.            SetColor( LIGHTGREEN);
  1120.      }
  1121.      else if (LineDefs[ n].tag > 0)
  1122.         SetColor( LIGHTRED);
  1123.      else if (LineDefs[ n].flags & 1)
  1124.         SetColor( WHITE);
  1125.      else
  1126.         SetColor( LIGHTGRAY);
  1127.      DrawMapLine( Vertexes[ LineDefs[ n].start].x, Vertexes[ LineDefs[ n].start].y,
  1128.               Vertexes[ LineDefs[ n].end].x, Vertexes[ LineDefs[ n].end].y);
  1129.       }
  1130.    else if (editmode == OBJ_SECTORS)
  1131.       for (n = 0; n < NumLineDefs; n++)
  1132.       {
  1133.      if ((m = LineDefs[ n].sidedef1) < 0 || (m = SideDefs[ m].sector) < 0)
  1134.         SetColor( LIGHTRED);
  1135.      else
  1136.      {
  1137.         if (Sectors[ m].tag > 0)
  1138.            SetColor( LIGHTGREEN);
  1139.         else if (Sectors[ m].special > 0)
  1140.            SetColor( LIGHTCYAN);
  1141.         else if (LineDefs[ n].flags & 1)
  1142.            SetColor( WHITE);
  1143.         else
  1144.            SetColor( LIGHTGRAY);
  1145.         if ((m = LineDefs[ n].sidedef2) >= 0)
  1146.         {
  1147.            if ((m = SideDefs[ m].sector) < 0)
  1148.           SetColor( LIGHTRED);
  1149.            else if (Sectors[ m].tag > 0)
  1150.           SetColor( LIGHTGREEN);
  1151.            else if (Sectors[ m].special > 0)
  1152.           SetColor( LIGHTCYAN);
  1153.         }
  1154.      }
  1155.      DrawMapLine( Vertexes[ LineDefs[ n].start].x, Vertexes[ LineDefs[ n].start].y,
  1156.               Vertexes[ LineDefs[ n].end].x, Vertexes[ LineDefs[ n].end].y);
  1157.       }
  1158.  
  1159.    /* draw in the vertices */
  1160.    if (editmode == OBJ_VERTEXES)
  1161.    {
  1162.       SetColor( LIGHTGREEN);
  1163.       for (n = 0; n < NumVertexes; n++)
  1164.       {
  1165.      DrawMapLine( Vertexes[ n].x - OBJSIZE, Vertexes[ n].y - OBJSIZE, Vertexes[ n].x + OBJSIZE, Vertexes[ n].y + OBJSIZE);
  1166.      DrawMapLine( Vertexes[ n].x + OBJSIZE, Vertexes[ n].y - OBJSIZE, Vertexes[ n].x - OBJSIZE, Vertexes[ n].y + OBJSIZE);
  1167.       }
  1168.    }
  1169.  
  1170.    /* draw in the things */
  1171.    if (editmode == OBJ_THINGS)
  1172.    {
  1173.       for (n = 0; n < NumThings; n++)
  1174.       {
  1175.      m = GetThingRadius( Things[ n].type);
  1176.      SetColor( GetThingColour( Things[ n].type));
  1177.      DrawMapLine( Things[ n].xpos - m, Things[ n].ypos, Things[ n].xpos + m, Things[ n].ypos);
  1178.      DrawMapLine( Things[ n].xpos, Things[ n].ypos - m, Things[ n].xpos, Things[ n].ypos + m);
  1179.      DrawMapCircle( Things[ n].xpos, Things[ n].ypos, m);
  1180.       }
  1181.    }
  1182.    else
  1183.    {
  1184.       SetColor( LIGHTGRAY);
  1185.       for (n = 0; n < NumThings; n++)
  1186.       {
  1187.      DrawMapLine( Things[ n].xpos - OBJSIZE, Things[ n].ypos, Things[ n].xpos + OBJSIZE, Things[ n].ypos);
  1188.      DrawMapLine( Things[ n].xpos, Things[ n].ypos - OBJSIZE, Things[ n].xpos, Things[ n].ypos + OBJSIZE);
  1189.       }
  1190.    }
  1191.  
  1192.    /* draw in the title bar */
  1193.    DrawScreenBox3D( 0, 0, ScrMaxX, 16);
  1194.    setcolor( WHITE);
  1195.    DrawScreenText( 20,  4, "File  Edit  Search  Options");
  1196.    DrawScreenText( 20,  6, "_     _     _       _      ");
  1197.    DrawScreenText( ScrMaxX - 45, 4, "Help");
  1198.    DrawScreenText( ScrMaxX - 45, 6, "_   ");
  1199.  
  1200.    /* draw the bottom line, if needed */
  1201.    if (InfoShown)
  1202.    {
  1203.       DrawScreenBox3D( 0, ScrMaxY - 11, ScrMaxX, ScrMaxY);
  1204.       DrawScreenText( 5, ScrMaxY - 8, "Editing %s on %s", GetEditModeName( editmode), Level->dir.name);
  1205.       DrawScreenText( ScrCenterX, ScrMaxY - 8, "Free mem: %lu", farcoreleft());
  1206.       DrawScreenText( ScrMaxX - 140, ScrMaxY - 8, "Press F1 for Help");
  1207.    }
  1208. }
  1209.  
  1210.  
  1211.  
  1212. /* end of file */
  1213.