Changeset 52 for ttyvaders


Ignore:
Timestamp:
Dec 23, 2002, 11:06:27 AM (17 years ago)
Author:
Sam Hocevar
Message:
  • added support for --disable-slang.
  • fixed an overflow in the tunnel update code.
  • fragbomb is now 'f', not 'd'.
  • added a missing call to init_bonus().
Location:
ttyvaders/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • ttyvaders/trunk/configure.ac

    r40 r52  
    1414AC_PROG_CPP
    1515
     16AC_ARG_ENABLE(slang,
     17  [  --enable-slang          slang graphics support (default enabled)])
    1618AC_ARG_ENABLE(ncurses,
    17   [  --enable-ncurses        ncurses interface support (default is slang)])
     19  [  --enable-ncurses        ncurses graphics support (default disabled)])
    1820
    1921if test "${enable_ncurses}" = "yes"
     
    2224  AC_CHECK_LIB(ncurses,initscr,:,AC_MSG_ERROR([cannot find ncurses library]))
    2325else
    24   AC_CHECK_HEADER(slang.h,:,AC_MSG_ERROR([cannot find slang headers]))
    25   AC_CHECK_LIB(slang,SLkp_init,:,AC_MSG_ERROR([cannot find slang library]))
     26  if test "${enable_slang}" != "no"
     27  then
     28    AC_CHECK_HEADER(slang.h,:,AC_MSG_ERROR([cannot find slang headers]))
     29    AC_CHECK_LIB(slang,SLkp_init,:,AC_MSG_ERROR([cannot find slang library]))
     30  else
     31    :
     32  fi
    2633fi
    2734
     35AM_CONDITIONAL(USE_SLANG, test "${enable_slang}" != "no")
    2836AM_CONDITIONAL(USE_NCURSES, test "${enable_ncurses}" = "yes")
    2937
  • ttyvaders/trunk/src/Makefile.am

    r44 r52  
    88AM_CFLAGS += -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs
    99
     10if USE_SLANG
     11CPPFLAGS_slang = -DUSE_SLANG
     12LDFLAGS_slang = -lslang
     13endif
    1014if USE_NCURSES
    11 CPPFLAGS_gfx = -DUSE_NCURSES
    12 LDFLAGS_gfx = -lncurses
    13 else
    14 CPPFLAGS_gfx = -DUSE_SLANG
    15 LDFLAGS_gfx = -lslang
     15CPPFLAGS_ncurses = -DUSE_NCURSES
     16LDFLAGS_ncurses = -lncurses
    1617endif
    1718
     
    3435        $(NULL)
    3536
    36 ttyvaders_CPPFLAGS = $(CPPFLAGS_gfx)
    37 ttyvaders_LDADD = $(LDFLAGS_gfx)
     37ttyvaders_CPPFLAGS = $(CPPFLAGS_slang) $(CPPFLAGS_ncurses)
     38ttyvaders_LDADD = $(LDFLAGS_slang) $(LDFLAGS_ncurses)
    3839
  • ttyvaders/trunk/src/ceo.c

    r42 r52  
    44 *                 All Rights Reserved
    55 *
    6  *   $Id: ceo.c,v 1.4 2002/12/22 22:17:41 sam Exp $
     6 *   $Id: ceo.c,v 1.5 2002/12/23 10:06:27 sam Exp $
    77 *
    88 *   This program is free software; you can redistribute it and/or modify
     
    2323#include "config.h"
    2424
     25#include <stdio.h>
    2526#include <unistd.h>
    2627
  • ttyvaders/trunk/src/common.h

    r50 r52  
    44 *                 All Rights Reserved
    55 *
    6  *   $Id: common.h,v 1.10 2002/12/23 09:28:37 sam Exp $
     6 *   $Id: common.h,v 1.11 2002/12/23 10:06:27 sam Exp $
    77 *
    88 *   This program is free software; you can redistribute it and/or modify
     
    3333#   define gfx_putchar(x) SLsmg_write_char(x)
    3434#   define gfx_putstr(x) SLsmg_write_string(x)
    35 #else
     35#elif USE_NCURSES
    3636#   include <curses.h>
    3737#   define gfx_color(x) attrset(COLOR_PAIR(x))
     
    3939#   define gfx_putchar(x) addch(x)
    4040#   define gfx_putstr(x) addstr(x)
     41#else
     42#   define gfx_color(x) do{}while(0)
     43#   define gfx_goto(x,y) do{}while(0)
     44#   define gfx_putchar(x) do{}while(0)
     45#   define gfx_putstr(x) do{}while(0)
    4146#endif
    4247
  • ttyvaders/trunk/src/graphics.c

    r38 r52  
    44 *                 All Rights Reserved
    55 *
    6  *   $Id: graphics.c,v 1.4 2002/12/22 18:44:12 sam Exp $
     6 *   $Id: graphics.c,v 1.5 2002/12/23 10:06:27 sam Exp $
    77 *
    88 *   This program is free software; you can redistribute it and/or modify
     
    5050    SLsmg_cls();
    5151    SLsmg_refresh();
    52 #else
     52#elif USE_NCURSES
    5353    /* Initialize ncurses library */
    5454    initscr();
     
    5858    noecho();
    5959    nodelay(stdscr, TRUE);
     60#else
     61    /* Dummy driver */
    6062#endif
    6163
     
    8183    g->w = SLtt_Screen_Cols;
    8284    g->h = SLtt_Screen_Rows;
    83 #else
     85#elif USE_NCURSES
    8486    start_color();
    8587
     
    9799    g->w = COLS;
    98100    g->h = LINES;
     101#else
     102    /* Use dummy driver */
     103    g->w = 80;
     104    g->h = 25;
    99105#endif
    100106}
     
    107113        return SLang_getkey();
    108114    }
    109 #else
     115#elif USE_NCURSES
    110116    char key;
    111117
     
    114120        return key;
    115121    }
     122#else
     123    /* Use dummy driver */
    116124#endif
    117125
     
    123131#ifdef USE_SLANG
    124132    SLsmg_cls();
     133#elif USE_NCURSES
     134    clear();
    125135#else
    126     clear();
     136    /* Use dummy driver */
    127137#endif
    128138}
     
    133143#ifdef USE_SLANG
    134144    SLsmg_refresh();
     145#elif USE_NCURSES
     146    refresh();
    135147#else
    136     refresh();
     148    /* Use dummy driver */
    137149#endif
    138150}
     
    143155    SLang_reset_tty();
    144156    SLsmg_reset_smg();
     157#elif USE_NCURSES
     158    endwin();
    145159#else
    146     endwin();
     160    /* Use dummy driver */
    147161#endif
    148162}
    149163
    150 
  • ttyvaders/trunk/src/main.c

    r50 r52  
    44 *                 All Rights Reserved
    55 *
    6  *   $Id: main.c,v 1.9 2002/12/23 09:28:37 sam Exp $
     6 *   $Id: main.c,v 1.10 2002/12/23 10:06:27 sam Exp $
    77 *
    88 *   This program is free software; you can redistribute it and/or modify
     
    7070    g->al = malloc(sizeof(aliens));
    7171
     72    init_bonus( g, g->bo );
    7273    init_weapons( g, g->wp );
    7374    init_explosions( g, g->ex );
     
    129130                    }
    130131                    break;
    131                 case 'd':
     132                case 'f':
    132133                    if( g->p->nuke == 0 )
    133134                    {
     
    223224
    224225    free_starfield( g, g->sf );
    225 
    226 #if 0
    227     free_player( p );
    228226    free_tunnel( g->t );
    229 #endif
     227//    free_player( g->p );
    230228}
    231229
  • ttyvaders/trunk/src/tunnel.c

    r50 r52  
    44 *                 All Rights Reserved
    55 *
    6  *   $Id: tunnel.c,v 1.5 2002/12/23 09:28:37 sam Exp $
     6 *   $Id: tunnel.c,v 1.6 2002/12/23 10:06:27 sam Exp $
    77 *
    88 *   This program is free software; you can redistribute it and/or modify
     
    4040    if( t->w >= g->w )
    4141    {
    42         t->left[0] = -10;
    43         t->right[0] = g->w + 10;
    4442        for( i = 0; i < g->h; i++ )
    4543        {
     
    8280
    8381    /* Slide tunnel one block vertically */
    84     for( i = t->h; i--; )
     82    for( i = t->h - 1; i--; )
    8583    {
    8684        t->left[i+1] = t->left[i];
Note: See TracChangeset for help on using the changeset viewer.