working on removing flicker

This commit is contained in:
rob 2022-08-28 21:00:26 +10:00
parent 281944bb5a
commit 17aef350b3
7 changed files with 140 additions and 97 deletions

8
data.c
View File

@ -5606,7 +5606,7 @@ void initobjects(void) {
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL); addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
addot(OT_S_CONFISCATE, "yoink", "Transports one random object directly from the target to the caster.", MT_NOTHING, 0, OC_SPELL, SZ_TINY); addot(OT_S_CONFISCATE, "yoink", "Transports one random object directly from the target to the caster.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "At power level II, the target object can be selected."); addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "At power level II, the target object can be selected.");
addflag(lastot->flags, F_SPELLSCHOOL, SS_DIVINE, NA, NA, NULL); addflag(lastot->flags, F_SPELLSCHOOL, SS_TRANSLOCATION, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 5, NA, NA, NULL); addflag(lastot->flags, F_SPELLLEVEL, 5, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 2, NA, NA, NULL); addflag(lastot->flags, F_MAXPOWER, 2, NA, NA, NULL);
addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL); addflag(lastot->flags, F_TARGETTEDSPELL, TT_MONSTER, NA, NA, NULL);
@ -5905,6 +5905,12 @@ void initobjects(void) {
addflag(lastot->flags, F_SPELLSCHOOL, SS_DIVINE, NA, NA, NULL); addflag(lastot->flags, F_SPELLSCHOOL, SS_DIVINE, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_FALSE, LOF_DONTNEED, NA, NULL); addflag(lastot->flags, F_LOSLOF, B_FALSE, LOF_DONTNEED, NA, NULL);
addot(OT_A_KILLALL, "killall", "Kills all other lifeforms on the level.", MT_NOTHING, 0, OC_ABILITY, SZ_TINY);
addflag(lastot->flags, F_SPELLLEVEL, 6, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_DIVINE, NA, NA, NULL);
//addflag(lastot->flags, F_PLEASESGOD, R_GODDEATH, 10, NA, NULL);
// abilities // abilities
addot(OT_A_AIMEDSTRIKE, "aimed strike", "A carefully placed strike. -4 accuracy but causes a critical hit if it connects.", MT_NOTHING, 0, OC_ABILITY, SZ_TINY); addot(OT_A_AIMEDSTRIKE, "aimed strike", "A carefully placed strike. -4 accuracy but causes a critical hit if it connects.", MT_NOTHING, 0, OC_ABILITY, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ABILITY, NA, NA, NULL); addflag(lastot->flags, F_SPELLSCHOOL, SS_ABILITY, NA, NA, NULL);

2
defs.h
View File

@ -12,6 +12,7 @@
#define ISINRANGE(a,min,max) ((a >= min) && (a <= max)) #define ISINRANGE(a,min,max) ((a >= min) && (a <= max))
#define foreach_bucket(a) for (a=0; a<NHASHBUCKETS; a++) #define foreach_bucket(a) for (a=0; a<NHASHBUCKETS; a++)
#define cset(a) _cset(a,__func__)
// #define PRACTICETIME 15 // #attempts it takes to learn new weapon skill // #define PRACTICETIME 15 // #attempts it takes to learn new weapon skill
@ -2228,6 +2229,7 @@ enum OBTYPE {
OT_A_ENHANCE, OT_A_ENHANCE,
OT_A_LEARN, OT_A_LEARN,
OT_A_LEVELUP, OT_A_LEVELUP,
OT_A_KILLALL,
// abilities // abilities
OT_A_AIMEDSTRIKE, OT_A_AIMEDSTRIKE,
OT_A_ALTERATTACK, OT_A_ALTERATTACK,

205
io.c
View File

@ -36,10 +36,8 @@ extern enum WINGAMETYPE wintype;
int statdirty = B_TRUE; int statdirty = B_TRUE;
int inaskcoords = B_FALSE; // are we inside this function? int inaskcoords = B_FALSE; // are we inside this function?
extern buildingusage_t buildingusage[]; extern buildingusage_t buildingusage[];
extern int nbuildingusage; extern int nbuildingusage;
@ -50,6 +48,8 @@ int noredraw = 0;
int escok = B_TRUE; int escok = B_TRUE;
int cursoron = 1;
extern int notime; extern int notime;
extern int needredraw; extern int needredraw;
extern int numdraws; extern int numdraws;
@ -259,7 +259,7 @@ void anim(cell_t *src, cell_t *dst, char ch, int colour) {
gl.ch = ch; gl.ch = ch;
gl.colour = colour; gl.colour = colour;
// hide cursor // hide cursor
curs_set(0); cset(0);
for (i = 0; i < numpixels ; i++) { for (i = 0; i < numpixels ; i++) {
cell_t *cell; cell_t *cell;
@ -275,7 +275,7 @@ void anim(cell_t *src, cell_t *dst, char ch, int colour) {
drawglyph(&gl, cell->x - viewx, cell->y - viewy); drawglyph(&gl, cell->x - viewx, cell->y - viewy);
//mvwprintw(gamewin, cell->y - viewy, cell->x - viewx, "%c", gl.ch); //mvwprintw(gamewin, cell->y - viewy, cell->x - viewx, "%c", gl.ch);
wmove(gamewin, cell->y - viewy, cell->x - viewx); wmove(gamewin, cell->y - viewy, cell->x - viewx);
wrefresh(gamewin); _wr(gamewin);
usleep(DEF_ANIMDELAY); usleep(DEF_ANIMDELAY);
} }
@ -295,7 +295,7 @@ void anim(cell_t *src, cell_t *dst, char ch, int colour) {
y += yinc; y += yinc;
} }
// show cursor // show cursor
curs_set(1); cset(1);
needredraw = B_TRUE; needredraw = B_TRUE;
} }
@ -307,7 +307,7 @@ void animcells(cell_t *src, cell_t **dst, int ndst, int gradual, char ch, char c
gl.colour = colour; gl.colour = colour;
// hide cursor // hide cursor
curs_set(0); cset(0);
for (i = 0; i < ndst; i++) { for (i = 0; i < ndst; i++) {
int n; int n;
@ -334,17 +334,17 @@ void animcells(cell_t *src, cell_t **dst, int ndst, int gradual, char ch, char c
} }
if (gradual) { if (gradual) {
wrefresh(gamewin); _wr(gamewin);
usleep(DEF_ANIMDELAY); usleep(DEF_ANIMDELAY);
} }
} }
if (!gradual) { if (!gradual) {
wrefresh(gamewin); _wr(gamewin);
usleep(DEF_ANIMDELAY); usleep(DEF_ANIMDELAY);
} }
// show cursor // show cursor
curs_set(1); cset(1);
needredraw = B_TRUE; needredraw = B_TRUE;
} }
@ -364,7 +364,7 @@ void animflashcells(cell_t **cell, int ncells, int ch,int colour, char *seetext)
drawlevelfor(player); drawlevelfor(player);
// hide cursor // hide cursor
curs_set(0); cset(0);
for (i = 0; i <= ncells; i++) { for (i = 0; i <= ncells; i++) {
if (haslos(player, cell[i])) { if (haslos(player, cell[i])) {
@ -375,7 +375,7 @@ void animflashcells(cell_t **cell, int ncells, int ch,int colour, char *seetext)
} }
if (nseen) { if (nseen) {
wrefresh(gamewin); _wr(gamewin);
usleep(DEF_ANIMDELAY); usleep(DEF_ANIMDELAY);
if (seetext) { if (seetext) {
@ -384,7 +384,7 @@ void animflashcells(cell_t **cell, int ncells, int ch,int colour, char *seetext)
} }
} }
// show cursor // show cursor
curs_set(1); cset(1);
needredraw = B_TRUE; needredraw = B_TRUE;
drawscreen(); drawscreen();
} }
@ -401,7 +401,7 @@ void animline(cell_t *src, cell_t *dst, int gradual, char ch, char ch2, int colo
gl.colour = colour; gl.colour = colour;
// hide cursor // hide cursor
curs_set(0); cset(0);
for (i = 0; i < ndst; i++) { for (i = 0; i < ndst; i++) {
int n; int n;
@ -428,17 +428,17 @@ void animline(cell_t *src, cell_t *dst, int gradual, char ch, char ch2, int colo
} }
if (gradual) { if (gradual) {
wrefresh(gamewin); _wr(gamewin);
usleep(DEF_ANIMDELAY); usleep(DEF_ANIMDELAY);
} }
} }
if (!gradual) { if (!gradual) {
wrefresh(gamewin); _wr(gamewin);
usleep(DEF_ANIMDELAY); usleep(DEF_ANIMDELAY);
} }
// show cursor // show cursor
curs_set(1); cset(1);
needredraw = B_TRUE; needredraw = B_TRUE;
} }
@ -458,7 +458,7 @@ void animradial(cell_t *src, int radius, int ch,int colour, int dirtype, char *s
drawlevelfor(player); drawlevelfor(player);
// hide cursor // hide cursor
curs_set(0); cset(0);
if (dirtype == DT_ORTH) { if (dirtype == DT_ORTH) {
for (i = 0; i <= radius; i++) { for (i = 0; i <= radius; i++) {
@ -478,7 +478,7 @@ void animradial(cell_t *src, int radius, int ch,int colour, int dirtype, char *s
} }
if (drawn) { if (drawn) {
wrefresh(gamewin); _wr(gamewin);
usleep(DEF_ANIMDELAY); usleep(DEF_ANIMDELAY);
} }
} }
@ -500,7 +500,7 @@ void animradial(cell_t *src, int radius, int ch,int colour, int dirtype, char *s
} }
if (drawn) { if (drawn) {
wrefresh(gamewin); _wr(gamewin);
usleep(DEF_ANIMDELAY); usleep(DEF_ANIMDELAY);
} }
} }
@ -515,7 +515,7 @@ void animradial(cell_t *src, int radius, int ch,int colour, int dirtype, char *s
} }
} }
// show cursor // show cursor
curs_set(1); cset(1);
needredraw = B_TRUE; needredraw = B_TRUE;
drawscreen(); drawscreen();
} }
@ -533,7 +533,7 @@ void animsky(cell_t *src, char ch, int colour) {
gl.ch = ch; gl.ch = ch;
gl.colour = colour; gl.colour = colour;
// hide cursor // hide cursor
curs_set(0); cset(0);
// update viewpoint // update viewpoint
updateviewfor(src); updateviewfor(src);
@ -545,11 +545,11 @@ void animsky(cell_t *src, char ch, int colour) {
if (colour == C_RANDOM) gl.colour = rnd(C_FIRST, C_LAST); if (colour == C_RANDOM) gl.colour = rnd(C_FIRST, C_LAST);
drawglyph(&gl, src->x - viewx, y); drawglyph(&gl, src->x - viewx, y);
} }
wrefresh(gamewin); _wr(gamewin);
usleep(DEF_ANIMDELAY); usleep(DEF_ANIMDELAY);
// show cursor // show cursor
curs_set(1); cset(1);
needredraw = B_TRUE; needredraw = B_TRUE;
} }
@ -587,9 +587,9 @@ char askchar(char *prompt, char *validchars, char *def, int showchars, int mayca
strcat(buf, "? "); strcat(buf, "? ");
mvwprintw(msgwin, 0, 0, buf); mvwprintw(msgwin, 0, 0, buf);
wrefresh(msgwin); _wr(msgwin);
curs_set(1); cset(1);
valid = B_FALSE; valid = B_FALSE;
while (!valid) { while (!valid) {
ch = getkey(B_FALSE); ch = getkey(B_FALSE);
@ -604,7 +604,7 @@ char askchar(char *prompt, char *validchars, char *def, int showchars, int mayca
valid = B_FALSE; valid = B_FALSE;
} }
} }
curs_set(0); cset(0);
// update messaage history // update messaage history
sprintf(msghistbuf, "%s%c", buf, (ch == '\0') ? '-' : ch); sprintf(msghistbuf, "%s%c", buf, (ch == '\0') ? '-' : ch);
@ -739,7 +739,7 @@ cell_t *real_askcoords(char *prompt, char *subprompt, int targettype, lifeform_t
if (c == player->cell) { if (c == player->cell) {
wclear(msgwin); wclear(msgwin);
mvwprintw(msgwin, 0, 0, "%s", prompt); mvwprintw(msgwin, 0, 0, "%s", prompt);
wrefresh(msgwin); _wr(msgwin);
} else { } else {
// force cell description to show // force cell description to show
moved = B_TRUE; moved = B_TRUE;
@ -1168,7 +1168,7 @@ cell_t *real_askcoords(char *prompt, char *subprompt, int targettype, lifeform_t
wmove(msgwin, 0, 0); wmove(msgwin, 0, 0);
textwithcol(msgwin, fullbuf); textwithcol(msgwin, fullbuf);
} }
wrefresh(msgwin); _wr(msgwin);
// show our line of fire // show our line of fire
if (wanttrail && inrange) { if (wanttrail && inrange) {
@ -1197,7 +1197,7 @@ cell_t *real_askcoords(char *prompt, char *subprompt, int targettype, lifeform_t
// move cursor selected position // move cursor selected position
wmove(gamewin, c->y - viewy, c->x - viewx); wmove(gamewin, c->y - viewy, c->x - viewx);
curs_set(1); cset(1);
redraw(); redraw();
// get input // get input
@ -1295,13 +1295,13 @@ char *askstring(char *prompt, char punc, char *retbuf, int retbuflen, char *def)
strcat(buf, "]"); strcat(buf, "]");
} }
curs_set(1); cset(1);
asprintf(&ending, "%c ",punc); asprintf(&ending, "%c ",punc);
strcat(buf, ending); strcat(buf, ending);
free(ending); free(ending);
mvwprintw(msgwin, 0, 0, buf); mvwprintw(msgwin, 0, 0, buf);
wrefresh(msgwin); _wr(msgwin);
echo(); echo();
wgetnstr(msgwin, retbuf, retbuflen); wgetnstr(msgwin, retbuf, retbuflen);
noecho(); noecho();
@ -3282,6 +3282,19 @@ int confirm_injury_action(enum BODYPART bp, enum DAMTYPE dt, char *actionname) {
return B_TRUE; return B_TRUE;
} }
void _wr(WINDOW *w) {
if (w == gamewin) dblog("_wr() gamewin\n");
if (w == mainwin) dblog("_wr() mainwin\n");
wrefresh(w);
}
void _cset(int val, const char *why) {
if (cursoron == val) return;
cursoron = val;
dblog("set cursor to %d (%s)\n", val, why ? why : "unspecified");
curs_set(val);
}
lifeform_t *askgod(char *prompttext, int onlyprayed, int forpray) { lifeform_t *askgod(char *prompttext, int onlyprayed, int forpray) {
lifeform_t *lf = NULL; lifeform_t *lf = NULL;
int i; int i;
@ -3645,7 +3658,7 @@ object_t *doaskobject(obpile_t *op, char *prompt, char *noobtext, int *count, in
fullnumstring); fullnumstring);
wclear(msgwin); wclear(msgwin);
wrefresh(msgwin); _wr(msgwin);
mvwprintw(mainwin, 0, 0, "%s", fullprompt); mvwprintw(mainwin, 0, 0, "%s", fullprompt);
if (defob) { if (defob) {
@ -3669,7 +3682,7 @@ object_t *doaskobject(obpile_t *op, char *prompt, char *noobtext, int *count, in
} }
} }
// update screen // update screen
wrefresh(mainwin); _wr(mainwin);
// wait for keypess // wait for keypess
ch = getch(); ch = getch();
if (ch == 27) { // escape if (ch == 27) { // escape
@ -3919,7 +3932,7 @@ int askobjectmulti(obpile_t *op, char *prompt, condset_t *cs, int includenothing
mvwprintw(mainwin, 0, 0, "%s", pbuf); mvwprintw(mainwin, 0, 0, "%s", pbuf);
// update screen // update screen
wrefresh(mainwin); _wr(mainwin);
// wait for keypess // wait for keypess
ch = getch(); ch = getch();
if (ch == 27) { // escape if (ch == 27) { // escape
@ -4179,18 +4192,18 @@ void real_clearmsg(int force) {
strcpy(msgbuf, ""); strcpy(msgbuf, "");
wclear(msgwin); wclear(msgwin);
wrefresh(msgwin); _wr(msgwin);
} }
} }
int cleanupgfx(void) { int cleanupgfx(void) {
curs_set(1); cset(1);
endwin(); endwin();
return B_FALSE; return B_FALSE;
} }
void updatestatus(void) { void updatestatus(void) {
wrefresh(statwin); _wr(statwin);
} }
@ -4201,6 +4214,8 @@ int updateviewfor(cell_t *cell) {
oldvx = viewx; oldvx = viewx;
oldvy = viewy; oldvy = viewy;
cset(0);
getmaxyx(gamewin, h, w); getmaxyx(gamewin, h, w);
// calculate viewport if required // calculate viewport if required
@ -4238,14 +4253,17 @@ void drawscreen(void) {
} }
if (statdirty) { if (statdirty) {
dblog("drawing status\n");
drawstatus(); drawstatus();
//wrefresh(statwin); //_wr(statwin);
wnoutrefresh(statwin); wnoutrefresh(statwin);
statdirty = B_FALSE; statdirty = B_FALSE;
didstatus = B_TRUE; didstatus = B_TRUE;
} }
if (needredraw) { if (needredraw) {
cset(0);
dblog("drawing screen\n");
updateviewfor(player->cell); updateviewfor(player->cell);
drawlevelfor(player); drawlevelfor(player);
//drawcursor(); // this will call redraw gamewin //drawcursor(); // this will call redraw gamewin
@ -4253,8 +4271,8 @@ void drawscreen(void) {
} }
if (didstatus && !didredraw) { if (didstatus && !didredraw) {
doupdate(); //rdp drawcursor();
drawcursor(); updatescreen();
} }
} }
@ -4277,7 +4295,8 @@ char cmdtochar(enum COMMAND cmd) {
// clears the screen // clears the screen
void cls(void) { void cls(void) {
wclear(mainwin); //wclear(mainwin);
werase(mainwin);
statdirty = B_TRUE; statdirty = B_TRUE;
} }
@ -4307,7 +4326,7 @@ void describegod(lifeform_t *god) {
textwithcol(mainwin, buf2); textwithcol(mainwin, buf2);
free(buf2); free(buf2);
wrefresh(mainwin); _wr(mainwin);
// wait for key // wait for key
getch(); getch();
@ -4335,7 +4354,7 @@ void describejob(enum JOB jid) {
textwithcol(mainwin, buf2); textwithcol(mainwin, buf2);
free(buf2); free(buf2);
wrefresh(mainwin); _wr(mainwin);
// wait for key // wait for key
getch(); getch();
@ -4369,7 +4388,7 @@ void describeob(object_t *o) {
wrapprint(mainwin, &y, &x, 0, "%s", buf2); wrapprint(mainwin, &y, &x, 0, "%s", buf2);
free(buf2); free(buf2);
wrefresh(mainwin); _wr(mainwin);
// wait for key // wait for key
getch(); getch();
@ -4407,7 +4426,7 @@ void describerace(enum RACE rid) {
ch = wrapprint(mainwin, &y, &x, 0, "%s", buf2); ch = wrapprint(mainwin, &y, &x, 0, "%s", buf2);
free(buf2); free(buf2);
wrefresh(mainwin); _wr(mainwin);
// wait for key, unless we quit from the 'more' prompt // wait for key, unless we quit from the 'more' prompt
if (ch != 27) { if (ch != 27) {
@ -4438,7 +4457,7 @@ void describeskill(enum SKILL skid, enum SKILLLEVEL levhilite) {
textwithcol(mainwin, buf2); textwithcol(mainwin, buf2);
free(buf2); free(buf2);
wrefresh(mainwin); _wr(mainwin);
// wait for key // wait for key
getch(); getch();
@ -4464,7 +4483,7 @@ void describespell(objecttype_t *ot) {
textwithcol(mainwin, buf2); textwithcol(mainwin, buf2);
free(buf2); free(buf2);
wrefresh(mainwin); _wr(mainwin);
// wait for key // wait for key
getch(); getch();
@ -5750,7 +5769,7 @@ void doknowledgelist(void) {
if (y >= (SCREENH-3)) { if (y >= (SCREENH-3)) {
mvwprintw(mainwin, (SCREENH-2), 0, MORESTRING); mvwprintw(mainwin, (SCREENH-2), 0, MORESTRING);
wrefresh(mainwin); _wr(mainwin);
getch(); getch();
cls(); cls();
mvwprintw(mainwin, 0, 0, "Current Knowledge"); mvwprintw(mainwin, 0, 0, "Current Knowledge");
@ -5764,7 +5783,7 @@ void doknowledgelist(void) {
if (numfound == 0) { if (numfound == 0) {
mvwprintw(mainwin, y, 0, "You don't know much."); mvwprintw(mainwin, y, 0, "You don't know much.");
} }
wrefresh(mainwin); _wr(mainwin);
getch(); getch();
restoregamewindows(); restoregamewindows();
@ -8880,7 +8899,7 @@ void domsghist(void) {
textwithcol(mainwin, msghist[i]); textwithcol(mainwin, msghist[i]);
y++; y++;
} }
wrefresh(mainwin); _wr(mainwin);
getch(); getch();
// restore screen // restore screen
restoregamewindows(); restoregamewindows();
@ -8920,7 +8939,7 @@ void dooptions(void) {
strcat(cmdchars, thislet); strcat(cmdchars, thislet);
} }
curs_set(0); cset(0);
while (!done) { while (!done) {
cls(); cls();
@ -8957,7 +8976,7 @@ void dooptions(void) {
} }
} }
curs_set(1); cset(1);
restoregamewindows(); restoregamewindows();
} }
@ -9879,14 +9898,16 @@ void drawglyph(glyph_t *g, int x, int y) {
unsetcol(gamewin, col); unsetcol(gamewin, col);
} }
void updatescreen(void) {
wnoutrefresh(gamewin);
doupdate();
}
void drawcursor(void) { void drawcursor(void) {
// move cursor to player position // move cursor to player position
wmove(gamewin, player->cell->y - viewy, player->cell->x - viewx); wmove(gamewin, player->cell->y - viewy, player->cell->x - viewx);
//wrefresh(gamewin); updatescreen();
// turn on cursor cset(1);
curs_set(1);
wnoutrefresh(gamewin);
doupdate();
} }
void drawlevelfor(lifeform_t *lf) { void drawlevelfor(lifeform_t *lf) {
@ -9915,7 +9936,7 @@ void drawlevelfor(lifeform_t *lf) {
numdraws++; numdraws++;
// turn off cursor // turn off cursor
curs_set(0); cset(0);
if (db) dblog("starting DRAWLEVEL"); if (db) dblog("starting DRAWLEVEL");
//wclear(gamewin); //wclear(gamewin);
@ -9938,31 +9959,25 @@ void drawlevelfor(lifeform_t *lf) {
} }
// only draw if screen char/colour is different // only draw if screen char/colour is different
if (!screenglyphmatches(x, y, &glyph)) { //if (!screenglyphmatches(x, y, &glyph)) {
drawglyph(&glyph, x, y); drawglyph(&glyph, x, y);
/* //if (db) { dblog(" drawing char '%lc'/%d at %d,%d (screenglyph was '%lc'/%d)\n\n", glyph.ch, glyph.ch, x,y, screenglyph.ch, screenglyph.ch); }
if (db) {
dblog(" drawing char '%lc'/%d at %d,%d (screenglyph was '%lc'/%d)\n\n",
glyph.ch, glyph.ch,
x,y,
screenglyph.ch, screenglyph.ch);
}
*/
ndrawn++; ndrawn++;
} //}
} }
} }
if (db) { if (db) {
dblog("last x,y checked was %d,%d",x+viewx,y+viewy); dblog("last x,y checked was %d,%d",x+viewx,y+viewy);
dblog("ending DRAWLEVEL");
} }
if (db) dblog("ending DRAWLEVEL");
snprintf(buf, BUFLEN, "end. ndrawn was %d",ndrawn); snprintf(buf, BUFLEN, "end. ndrawn was %d",ndrawn);
if (db) dblog("%s",buf); if (db) dblog("%s",buf);
//dbtimeend(buf); //dbtimeend(buf);
// move cursor to the player's position and blit // move cursor to the player's position and blit
if (ndrawn) { if (ndrawn) {
drawcursor(); //drawcursor();
updatescreen();
} }
} }
@ -10444,7 +10459,7 @@ char getchoice(prompt_t *prompt) {
} }
} }
curs_set(1); cset(1);
// loop until result is valid // loop until result is valid
sel = -1; sel = -1;
while (sel == -1) { while (sel == -1) {
@ -10500,7 +10515,7 @@ char getchoice(prompt_t *prompt) {
snprintf(fullprompt, BUFLEN, "%s %s", prompt->q[prompt->whichq], prompt->maycancel ? "[ESC to cancel] " : ""); snprintf(fullprompt, BUFLEN, "%s %s", prompt->q[prompt->whichq], prompt->maycancel ? "[ESC to cancel] " : "");
mvwprintw(mainwin, 0, 0, "%s", fullprompt); mvwprintw(mainwin, 0, 0, "%s", fullprompt);
wrefresh(mainwin); _wr(mainwin);
// ask for choice... // ask for choice...
ch = getch(); ch = getch();
@ -10541,9 +10556,9 @@ char getchoice(prompt_t *prompt) {
drawscreen(); drawscreen();
} else { } else {
cls(); cls();
wrefresh(mainwin); _wr(mainwin);
} }
curs_set(0); cset(0);
restoregamewindows(); restoregamewindows();
snprintf(msghistbuf, BUFLEN, "%s%s",fullprompt,prompt->choice[i].desc); snprintf(msghistbuf, BUFLEN, "%s%s",fullprompt,prompt->choice[i].desc);
@ -10598,7 +10613,7 @@ char getchoicestr(prompt_t *prompt, int useshortcuts, int showallatstart) {
doneheading = B_FALSE; doneheading = B_FALSE;
// loop until result is valid // loop until result is valid
curs_set(1); cset(1);
sel = -1; sel = -1;
while (sel == -1) { while (sel == -1) {
int foundfirstvalid = B_FALSE; int foundfirstvalid = B_FALSE;
@ -10795,7 +10810,7 @@ char getchoicestr(prompt_t *prompt, int useshortcuts, int showallatstart) {
// move cursor back // move cursor back
wmove(mainwin, cy, cx); wmove(mainwin, cy, cx);
} }
wrefresh(mainwin); _wr(mainwin);
// ask for choice... // ask for choice...
@ -10883,9 +10898,9 @@ char getchoicestr(prompt_t *prompt, int useshortcuts, int showallatstart) {
drawscreen(); drawscreen();
} else { } else {
cls(); cls();
wrefresh(mainwin); _wr(mainwin);
} }
curs_set(0); cset(0);
if (gamemode == GM_GAMESTARTED) { if (gamemode == GM_GAMESTARTED) {
restoregamewindows(); restoregamewindows();
} }
@ -11127,7 +11142,7 @@ void handleinput(void) {
} else { } else {
wclear(msgwin); wclear(msgwin);
} }
wrefresh(msgwin); _wr(msgwin);
gotcmd = B_FALSE; gotcmd = B_FALSE;
break; break;
case 127: case 127:
@ -11142,7 +11157,7 @@ void handleinput(void) {
} else { } else {
wclear(msgwin); wclear(msgwin);
} }
wrefresh(msgwin); _wr(msgwin);
} }
gotcmd = B_FALSE; gotcmd = B_FALSE;
break; break;
@ -11502,10 +11517,10 @@ void more(void) {
strcat(msgbuf, MSGMORESTRING); strcat(msgbuf, MSGMORESTRING);
//mvwprintw(msgwin, 0, 0, msgbuf); //mvwprintw(msgwin, 0, 0, msgbuf);
drawmsg(); drawmsg();
curs_set(1); cset(1);
// wait for space // wait for space
while (getch() != ' '); while (getch() != ' ');
curs_set(0); cset(0);
// clear msg // clear msg
clearmsg(); clearmsg();
} }
@ -11644,8 +11659,9 @@ void drawstatus(void) {
int xpleft; int xpleft;
int height; int height;
curs_set(0); cset(0);
wclear(statwin); //wclear(statwin);
werase(statwin);
// FIRST LINE // FIRST LINE
wmove(statwin, 0, 0); wmove(statwin, 0, 0);
@ -12110,7 +12126,7 @@ void drawmsg(void) {
//mvwprintw(msgwin, 0, 0, msgbuf); //mvwprintw(msgwin, 0, 0, msgbuf);
wrefresh(msgwin); _wr(msgwin);
strcpy(lastmsgbuf, msgbuf); strcpy(lastmsgbuf, msgbuf);
} }
@ -12119,9 +12135,9 @@ void drawmsg(void) {
void redraw(void) { void redraw(void) {
//dblog("redraw"); //dblog("redraw");
//wrefresh(msgwin); //_wr(msgwin);
wrefresh(statwin); _wr(statwin);
wrefresh(gamewin); _wr(gamewin);
} }
void redrawpause(void) { void redrawpause(void) {
@ -12141,10 +12157,11 @@ void redrawresume(void) {
} }
void restoregamewindows(void) { void restoregamewindows(void) {
dblog("restoregamewindows\n");
needredraw = B_TRUE; needredraw = B_TRUE;
statdirty = B_TRUE; statdirty = B_TRUE;
wclear(mainwin); wclear(mainwin);
wrefresh(mainwin); _wr(mainwin);
clearmsg(); clearmsg();
wclear(gamewin); wclear(gamewin);
drawscreen(); drawscreen();
@ -15201,11 +15218,11 @@ void showlfstats(lifeform_t *lf, int showall) {
statdirty = B_TRUE; statdirty = B_TRUE;
needredraw = B_TRUE; needredraw = B_TRUE;
cls(); wrefresh(mainwin); cls(); _wr(mainwin);
needredraw = B_TRUE; needredraw = B_TRUE;
drawscreen(); drawscreen();
wrefresh(gamewin); _wr(gamewin);
wrefresh(statwin); _wr(statwin);
real_clearmsg(B_TRUE); real_clearmsg(B_TRUE);
*/ */
@ -15352,7 +15369,7 @@ void tombstone(lifeform_t *lf) {
p = readuntil(buf, p, '\n'); p = readuntil(buf, p, '\n');
} }
wrefresh(mainwin); _wr(mainwin);
// write hiscores and calculate player's rank // write hiscores and calculate player's rank
writehiscore(player, &rank); writehiscore(player, &rank);
@ -15404,7 +15421,7 @@ void tombstone(lifeform_t *lf) {
// clear screen // clear screen
cls(); cls();
// close down curses // close down curses
curs_set(1); cset(1);
endwin(); endwin();
} }

3
io.h
View File

@ -23,6 +23,8 @@ void announcetime(int h, int m, int s, int showfull);
void cantdrink(enum ERROR reason); void cantdrink(enum ERROR reason);
int confirm_badfeeling(object_t *o); int confirm_badfeeling(object_t *o);
int confirm_injury_action(enum BODYPART bp, enum DAMTYPE dt, char *actionname); int confirm_injury_action(enum BODYPART bp, enum DAMTYPE dt, char *actionname);
void _wr(WINDOW *w);
void _cset(int val, const char *why);
lifeform_t *askgod(char *prompt, int onlyprayed, int forpray); lifeform_t *askgod(char *prompt, int onlyprayed, int forpray);
object_t *askobject(obpile_t *op, char *title, char *noobtext, int *count, char action, condset_t *cs, int includenothing); object_t *askobject(obpile_t *op, char *title, char *noobtext, int *count, char action, condset_t *cs, int includenothing);
object_t *doaskobject(obpile_t *op, char *prompt, char *noobtext, int *count, int showlong, int forpickup, int showpoints, char action, object_t *sellshop, enum SHOPACTION sellaction, condset_t *cs, int includenothing); object_t *doaskobject(obpile_t *op, char *prompt, char *noobtext, int *count, int showlong, int forpickup, int showpoints, char action, object_t *sellshop, enum SHOPACTION sellaction, condset_t *cs, int includenothing);
@ -162,6 +164,7 @@ void textwithcol_real(WINDOW *win, char *buf, int resetcolatend);
void tombstone(lifeform_t *lf); void tombstone(lifeform_t *lf);
void updatestatus(void); void updatestatus(void);
int updateviewfor(cell_t *cell); int updateviewfor(cell_t *cell);
void updatescreen(void);
int warnabout(char *what); int warnabout(char *what);
int real_warnabout(char *what, int lifetime, int doquestion); int real_warnabout(char *what, int lifetime, int doquestion);
void wingame(void); void wingame(void);

1
lf.c
View File

@ -21063,6 +21063,7 @@ int startresting(lifeform_t *lf, int willtrain) {
} }
} }
drawmsg(); drawmsg();
updatescreen();
drawcursor(); drawcursor();
} }

6
move.c
View File

@ -19,6 +19,8 @@
extern lifeform_t *player; extern lifeform_t *player;
extern int cursoron;
extern int statdirty; extern int statdirty;
extern int needredraw; extern int needredraw;
@ -3635,7 +3637,7 @@ int walkoffmap(lifeform_t *lf, int dir, int onpurpose) {
// announce // announce
if (isplayer(lf)) { if (isplayer(lf)) {
char dirname[BUFLEN]; char dirname[BUFLEN];
curs_set(1); cset(1);
strcpy(dirname, getdirname(dir)); strcpy(dirname, getdirname(dir));
dirname[0] = tolower(dirname[0]); dirname[0] = tolower(dirname[0]);
msg("You %s to the %s...", getmoveverb(lf), getdirname(dir)); msg("You %s to the %s...", getmoveverb(lf), getdirname(dir));
@ -3647,7 +3649,7 @@ int walkoffmap(lifeform_t *lf, int dir, int onpurpose) {
char mverb[BUFLEN]; char mverb[BUFLEN];
getmoveverbother(lf, mverb); getmoveverbother(lf, mverb);
getlfname(lf, lfname); getlfname(lf, lfname);
curs_set(1); cset(1);
strcpy(dirname, getdirname(dir)); strcpy(dirname, getdirname(dir));
dirname[0] = tolower(dirname[0]); dirname[0] = tolower(dirname[0]);
msg("%s %s to the %s...", lfname, mverb, getdirname(dir)); msg("%s %s to the %s...", lfname, mverb, getdirname(dir));

12
spell.c
View File

@ -4038,6 +4038,18 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
addflag(user->flags, F_FAILEDINSPECT, o->type->id, NA, NA, NULL); addflag(user->flags, F_FAILEDINSPECT, o->type->id, NA, NA, NULL);
} }
taketime(user, getactspeed(user)); taketime(user, getactspeed(user));
} else if (abilid == OT_A_KILLALL) {
lifeform_t *nextlf;
if (isplayer(user)) {
msg("^wDeath radiates around you!");
} else if (cansee(player, user)) {
msg("^wDeath radiates around %s!", username);
}
for (target = user->cell->map->lf ; target ; target = nextlf) {
nextlf = target->next;
if (target == user) continue;
killlf(target);
}
} else if (abilid == OT_A_IRONFIST) { } else if (abilid == OT_A_IRONFIST) {
char tname[BUFLEN]; char tname[BUFLEN];
int dam,dir = D_NONE; int dam,dir = D_NONE;