Browse Source

Gather curses dependencies

metaverse
jl777 5 years ago
parent
commit
c9b2389854
  1. 2
      src/cc/rogue/armor.c
  2. 4
      src/cc/rogue/chase.c
  3. 5
      src/cc/rogue/command.c
  4. 2
      src/cc/rogue/daemon.c
  5. 2
      src/cc/rogue/daemons.c
  6. 2
      src/cc/rogue/extern.c
  7. 3
      src/cc/rogue/extern.h
  8. 8
      src/cc/rogue/fight.c
  9. 8
      src/cc/rogue/init.c
  10. 11
      src/cc/rogue/io.c
  11. 6
      src/cc/rogue/list.c
  12. 3
      src/cc/rogue/mach_dep.c
  13. 2
      src/cc/rogue/mdport.c
  14. 8
      src/cc/rogue/misc.c
  15. 6
      src/cc/rogue/monsters.c
  16. 4
      src/cc/rogue/move.c
  17. 4
      src/cc/rogue/new_level.c
  18. 8
      src/cc/rogue/options.c
  19. 6
      src/cc/rogue/pack.c
  20. 4
      src/cc/rogue/passages.c
  21. 4
      src/cc/rogue/potions.c
  22. 2
      src/cc/rogue/rings.c
  23. 14
      src/cc/rogue/rip.c
  24. 40
      src/cc/rogue/rogue.c
  25. 91
      src/cc/rogue/rogue.h
  26. 4
      src/cc/rogue/rooms.c
  27. 14
      src/cc/rogue/save.c
  28. 4
      src/cc/rogue/scrolls.c
  29. 6
      src/cc/rogue/state.c
  30. 6
      src/cc/rogue/sticks.c
  31. 94
      src/cc/rogue/things.c
  32. 6
      src/cc/rogue/weapons.c
  33. 8
      src/cc/rogue/wizard.c

2
src/cc/rogue/armor.c

@ -9,7 +9,7 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
//#include <curses.h>
#include "rogue.h"
/*

4
src/cc/rogue/chase.c

@ -10,8 +10,8 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <stdlib.h>
#include <curses.h>
//#include <stdlib.h>
//#include <curses.h>
#include "rogue.h"
#define DRAGONSHOT 5 /* one chance in DRAGONSHOT that a dragon will flame */

5
src/cc/rogue/command.c

@ -10,10 +10,7 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <stdlib.h>
#include <string.h>
#include <curses.h>
#include <ctype.h>
//#include <curses.h>
#include "rogue.h"
/*

2
src/cc/rogue/daemon.c

@ -11,7 +11,7 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
//#include <curses.h>
#include "rogue.h"
#define EMPTY 0

2
src/cc/rogue/daemons.c

@ -10,7 +10,7 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
//#include <curses.h>
#include "rogue.h"
/*

2
src/cc/rogue/extern.c

@ -10,7 +10,7 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
//#include <curses.h>
#include "rogue.h"

3
src/cc/rogue/extern.h

@ -13,6 +13,9 @@
#ifndef H_EXTERN_ROGUE_H
#define H_EXTERN_ROGUE_H
#include <stdio.h>
#include <stdbool.h>
#ifdef HAVE_CONFIG_H
#ifdef PDCURSES
#undef HAVE_UNISTD_H

8
src/cc/rogue/fight.c

@ -10,10 +10,10 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <stdlib.h>
#include <curses.h>
#include <string.h>
#include <ctype.h>
//#include <stdlib.h>
//#include <curses.h>
//#include <string.h>
//#include <ctype.h>
#include "rogue.h"
//#define EQSTR(a, b) (strcmp(a, b) == 0)

8
src/cc/rogue/init.c

@ -10,10 +10,10 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <stdlib.h>
#include <curses.h>
#include <ctype.h>
#include <string.h>
//#include <stdlib.h>
//#include <curses.h>
//#include <ctype.h>
//#include <string.h>
#include "rogue.h"
/*

11
src/cc/rogue/io.c

@ -4,10 +4,10 @@
* @(#)io.c 4.32 (Berkeley) 02/05/99
*/
#include <stdarg.h>
#include <curses.h>
#include <ctype.h>
#include <string.h>
//#include <stdarg.h>
//#include <curses.h>
//#include <ctype.h>
//#include <string.h>
#include "rogue.h"
/*
@ -162,7 +162,8 @@ readchar(struct rogue_state *rs)
//fprintf(stderr,"(%c) ",rs->keystrokes[rs->ind]);
return(rs->keystrokes[rs->ind++]);
}
fprintf(stderr,"replay finished but readchar called\n");
if ( rs->replaydone != 0 )
fprintf(stderr,"replay finished but readchar called\n");
rs->replaydone = (uint32_t)time(NULL);
//if ( (rand() & 1) == 0 )
// return(ESCAPE);

6
src/cc/rogue/list.c

@ -10,9 +10,9 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <stdlib.h>
#include <curses.h>
#include <memory.h>
//#include <stdlib.h>
//#include <curses.h>
//#include <memory.h>
#include "rogue.h"
#ifdef MASTER

3
src/cc/rogue/mach_dep.c

@ -46,7 +46,8 @@
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#include <curses.h>
//#include <curses.h>
#include "rogue.h"
#include "extern.h"
#define NOOP(x) (x += 0)

2
src/cc/rogue/mdport.c

@ -44,7 +44,7 @@
#undef MOUSE_MOVED
#endif
#include <curses.h>
//#include <curses.h>
#include "extern.h"
#if defined(HAVE_SYS_TYPES)

8
src/cc/rogue/misc.c

@ -10,10 +10,10 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <stdlib.h>
#include <curses.h>
#include <string.h>
#include <ctype.h>
//#include <stdlib.h>
//#include <curses.h>
//#include <string.h>
//#include <ctype.h>
#include "rogue.h"
/*

6
src/cc/rogue/monsters.c

@ -10,10 +10,10 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
#include <string.h>
//#include <curses.h>
//#include <string.h>
#include "rogue.h"
#include <ctype.h>
//#include <ctype.h>
/*
* List of monsters in rough order of vorpalness

4
src/cc/rogue/move.c

@ -10,8 +10,8 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
#include <ctype.h>
//#include <curses.h>
//#include <ctype.h>
#include "rogue.h"
/*

4
src/cc/rogue/new_level.c

@ -11,8 +11,8 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
#include <string.h>
//#include <curses.h>
//#include <string.h>
#include "rogue.h"
#define TREAS_ROOM 20 /* one chance in TREAS_ROOM for a treasure room */

8
src/cc/rogue/options.c

@ -12,10 +12,10 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <stdlib.h>
#include <curses.h>
#include <ctype.h>
#include <string.h>
//#include <stdlib.h>
//#include <curses.h>
//#include <ctype.h>
//#include <string.h>
#include "rogue.h"
#define EQSTR(a, b, c) (strncmp(a, b, c) == 0)

6
src/cc/rogue/pack.c

@ -10,9 +10,9 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <string.h>
#include <curses.h>
#include <ctype.h>
//#include <string.h>
//#include <curses.h>
//#include <ctype.h>
#include "rogue.h"
/*

4
src/cc/rogue/passages.c

@ -10,8 +10,8 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <stdlib.h>
#include <curses.h>
//#include <stdlib.h>
//#include <curses.h>
#include "rogue.h"
/*

4
src/cc/rogue/potions.c

@ -10,8 +10,8 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
#include <ctype.h>
//#include <curses.h>
//#include <ctype.h>
#include "rogue.h"
typedef struct

2
src/cc/rogue/rings.c

@ -10,7 +10,7 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
//#include <curses.h>
#include "rogue.h"
/*

14
src/cc/rogue/rip.c

@ -11,14 +11,14 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <stdlib.h>
#include <string.h>
#include <time.h>
//#include <stdlib.h>
//#include <string.h>
//#include <time.h>
#include <signal.h>
#include <sys/types.h>
#include <ctype.h>
#include <fcntl.h>
#include <curses.h>
//#include <sys/types.h>
//#include <ctype.h>
//#include <fcntl.h>
//#include <curses.h>
#include "rogue.h"
#include "score.h"

40
src/cc/rogue/rogue.c

@ -8,12 +8,11 @@
* @(#)main.c 4.22 (Berkeley) 02/05/99
*/
#include <stdlib.h>
#include <string.h>
//#include <stdlib.h>
//#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <time.h>
#include <curses.h>
//#include <unistd.h>
//#include <curses.h>
#include "rogue.h"
#ifdef STANDALONE
#include "../komodo/src/komodo_cJSON.h"
@ -88,6 +87,8 @@ void rogueiterate(struct rogue_state *rs)
endwin();
my_exit(1);
}
//fprintf(stderr,"LINES %d, COLS %d\n",LINES,COLS);
// Set up windows
if ( hw == NULL )
hw = newwin(LINES, COLS, 0, 0);
@ -247,21 +248,24 @@ int32_t rogue_replay2(uint8_t *newdata,uint64_t seed,char *keystrokes,int32_t nu
}
uint32_t starttime = (uint32_t)time(NULL);
rogueiterate(rs);
/*fprintf(stderr,"elapsed %d seconds\n",(uint32_t)time(NULL) - starttime);
sleep(2);
starttime = (uint32_t)time(NULL);
for (i=0; i<100; i++)
if ( 0 )
{
memset(rs,0,sizeof(*rs));
rs->seed = seed;
rs->keystrokes = keystrokes;
rs->numkeys = num;
rs->sleeptime = 0;
rogueiterate(rs);
fprintf(stderr,"elapsed %d seconds\n",(uint32_t)time(NULL) - starttime);
sleep(2);
starttime = (uint32_t)time(NULL);
for (i=0; i<10000; i++)
{
memset(rs,0,sizeof(*rs));
rs->seed = seed;
rs->keystrokes = keystrokes;
rs->numkeys = num;
rs->sleeptime = 0;
rogueiterate(rs);
}
fprintf(stderr,"elapsed %d seconds\n",(uint32_t)time(NULL)-starttime);
sleep(3);
}
fprintf(stderr,"elapsed %d seconds\n",(uint32_t)time(NULL)-starttime);
sleep(1);*/
if ( (fp= fopen("checkfile","wb")) != 0 )
{
save_file(rs,fp,0);

91
src/cc/rogue/rogue.h

@ -12,10 +12,92 @@
#ifndef H_ROGUE_H
#define H_ROGUE_H
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <unistd.h>
#include <stdarg.h> /* we need va_list */
#include <stddef.h> /* we want wchar_t */
#include <stdbool.h>
#include <ctype.h>
#include <time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#ifndef DONTUSEGUI
#include <curses.h>
#else
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#include "extern.h"
typedef void *WINDOW;
WINDOW stdscr;
#define standout()
#define standend()
#define refresh()
#define raw()
#define noecho()
#define flushinp()
#define initscr()
#define clear()
#define clrtoeol()
#define addch(a)
#define werase(a)
#define wclear(a)
#define delwin(a)
#define addstr(a)
#define touchwin(a)
#define idlok(a,b)
#define clearok(a,b)
#define keypad(a,b)
#define leaveok(a,b)
#define waddch(a,b)
#define waddstr(a,b)
#define move(a,b)
#define mvwin(a,b,c)
#define wmove(a,b,c)
#define mvaddch(a,b,c)
#define mvaddstr(a,b,c)
#define wgetnstr(a,b,c)
#define getyx(a,b,c)
#define mvcur(a,b,c,d)
#define mvwaddch(a,b,c,d)
#define mvprintw(...)
#define printw(...)
#define wprintw(...)
#define mvwprintw(...)
#define A_CHARTEXT 0xff
#define inch() 0
#define endwin() 1
#define isendwin() 0
#define baudrate() 9600
#define killchar() 3
#define erasechar() 8
#define wclrtoeol(a) 0
#define wrefresh(a) 0
#define unctrl(a) "^x"
#define getmaxx(a) COLS
#define getmaxy(a) LINES
#define mvinch(a,b) '.'
#define mvwinch(a,b,c) 0
#define newwin(a,b,c,d) 0
#define subwin(a,b,c,d,e) 0
#undef lines
#endif
#ifdef LINES
#undef LINES
@ -27,6 +109,11 @@
#define LINES 24
#define COLS 80
#include "extern.h"
#undef lines
#define NOOP(x) (x += 0)
#define CCHAR(x) ( (char) (x & A_CHARTEXT) )
/*

4
src/cc/rogue/rooms.c

@ -10,8 +10,8 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <ctype.h>
#include <curses.h>
//#include <ctype.h>
//#include <curses.h>
#include "rogue.h"
typedef struct spot { /* position matrix for maze positions */

14
src/cc/rogue/save.c

@ -10,13 +10,13 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <curses.h>
//#include <stdlib.h>
//#include <sys/types.h>
//#include <sys/stat.h>
//#include <errno.h>
//#include <signal.h>
//#include <string.h>
//#include <curses.h>
#include "rogue.h"
#include "score.h"

4
src/cc/rogue/scrolls.c

@ -10,8 +10,8 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
#include <ctype.h>
//#include <curses.h>
//#include <ctype.h>
#include "rogue.h"
/*

6
src/cc/rogue/state.c

@ -29,9 +29,9 @@
SUCH DAMAGE.
*/
#include <stdlib.h>
#include <string.h>
#include <curses.h>
//#include <stdlib.h>
//#include <string.h>
//#include <curses.h>
#include "rogue.h"
/************************************************************************/

6
src/cc/rogue/sticks.c

@ -11,9 +11,9 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
#include <string.h>
#include <ctype.h>
//#include <curses.h>
//#include <string.h>
//#include <ctype.h>
#include "rogue.h"
/*

94
src/cc/rogue/things.c

@ -11,9 +11,9 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
#include <string.h>
#include <ctype.h>
//#include <curses.h>
//#include <string.h>
//#include <ctype.h>
#include "rogue.h"
/*
@ -498,55 +498,55 @@ add_line(struct rogue_state *rs,char *fmt, char *arg)
if (line_cnt >= LINES - 1 || fmt == NULL)
{
if (inv_type == INV_OVER && fmt == NULL && !newpage)
{
msg(rs,"");
{
msg(rs,"");
if ( rs->sleeptime != 0 )
refresh();
tw = newwin(line_cnt + 1, maxlen + 2, 0, COLS - maxlen - 3);
sw = subwin(tw, line_cnt + 1, maxlen + 1, 0, COLS - maxlen - 2);
for (y = 0; y <= line_cnt; y++)
{
wmove(sw, y, 0);
for (x = 0; x <= maxlen; x++)
waddch(sw, mvwinch(hw, y, x));
}
wmove(tw, line_cnt, 1);
waddstr(tw, prompt);
/*
* if there are lines below, use 'em
*/
if (LINES > NUMLINES)
{
if (NUMLINES + line_cnt > LINES)
mvwin(tw, LINES - (line_cnt + 1), COLS - maxlen - 3);
else
mvwin(tw, NUMLINES, 0);
}
touchwin(tw);
wrefresh(tw);
wait_for(rs,' ');
if (md_hasclreol())
{
werase(tw);
leaveok(tw, TRUE);
wrefresh(tw);
}
delwin(tw);
touchwin(stdscr);
tw = newwin(line_cnt + 1, maxlen + 2, 0, COLS - maxlen - 3);
sw = subwin(tw, line_cnt + 1, maxlen + 1, 0, COLS - maxlen - 2);
for (y = 0; y <= line_cnt; y++)
{
wmove(sw, y, 0);
for (x = 0; x <= maxlen; x++)
waddch(sw, mvwinch(hw, y, x));
}
wmove(tw, line_cnt, 1);
waddstr(tw, prompt);
/*
* if there are lines below, use 'em
*/
if (LINES > NUMLINES)
{
if (NUMLINES + line_cnt > LINES)
mvwin(tw, LINES - (line_cnt + 1), COLS - maxlen - 3);
else
mvwin(tw, NUMLINES, 0);
}
touchwin(tw);
wrefresh(tw);
wait_for(rs,' ');
if (md_hasclreol())
{
werase(tw);
leaveok(tw, TRUE);
wrefresh(tw);
}
delwin(tw);
touchwin(stdscr);
}
else
{
wmove(hw, LINES - 1, 0);
waddstr(hw, prompt);
wrefresh(hw);
wait_for(rs,' ');
clearok(curscr, TRUE);
wclear(hw);
touchwin(stdscr);
}
newpage = TRUE;
line_cnt = 0;
maxlen = (int) strlen(prompt);
wmove(hw, LINES - 1, 0);
waddstr(hw, prompt);
wrefresh(hw);
wait_for(rs,' ');
clearok(curscr, TRUE);
wclear(hw);
touchwin(stdscr);
}
newpage = TRUE;
line_cnt = 0;
maxlen = (int) strlen(prompt);
}
if (fmt != NULL && !(line_cnt == 0 && *fmt == '\0'))
{

6
src/cc/rogue/weapons.c

@ -10,9 +10,9 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
#include <string.h>
#include <ctype.h>
//#include <curses.h>
//#include <string.h>
//#include <ctype.h>
#include "rogue.h"
#define NO_WEAPON -1

8
src/cc/rogue/wizard.c

@ -11,10 +11,10 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <stdlib.h>
#include <curses.h>
#include <string.h>
#include <ctype.h>
//#include <stdlib.h>
//#include <curses.h>
//#include <string.h>
//#include <ctype.h>
#include "rogue.h"
/*

Loading…
Cancel
Save