Gather curses dependencies

This commit is contained in:
jl777
2019-02-15 04:44:22 -11:00
parent 2b4dfbbcda
commit c9b2389854
33 changed files with 242 additions and 149 deletions

View File

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

View File

@@ -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 */

View File

@@ -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"
/*

View File

@@ -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

View File

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

View File

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

View File

@@ -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

View File

@@ -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)

View File

@@ -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"
/*

View File

@@ -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);

View File

@@ -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

View File

@@ -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)

View File

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

View File

@@ -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"
/*

View File

@@ -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

View File

@@ -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"
/*

View File

@@ -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 */

View File

@@ -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)

View File

@@ -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"
/*

View File

@@ -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"
/*

View File

@@ -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

View File

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

View File

@@ -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"

View File

@@ -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);

View File

@@ -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 "extern.h"
#include <time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#undef lines
#ifndef DONTUSEGUI
#include <curses.h>
#else
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
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
#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) )
/*

View File

@@ -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 */

View File

@@ -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"

View File

@@ -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"
/*

View File

@@ -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"
/************************************************************************/

View File

@@ -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"
/*

View File

@@ -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'))
{

View File

@@ -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

View File

@@ -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"
/*