diff --git a/data.c b/data.c index bbd4866..f91090f 100755 --- a/data.c +++ b/data.c @@ -5606,7 +5606,7 @@ void initobjects(void) { 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); 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_MAXPOWER, 2, 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_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 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); diff --git a/defs.h b/defs.h index 60f9e6c..2852c25 100755 --- a/defs.h +++ b/defs.h @@ -12,6 +12,7 @@ #define ISINRANGE(a,min,max) ((a >= min) && (a <= max)) #define foreach_bucket(a) for (a=0; ax - viewx, cell->y - viewy); //mvwprintw(gamewin, cell->y - viewy, cell->x - viewx, "%c", gl.ch); wmove(gamewin, cell->y - viewy, cell->x - viewx); - wrefresh(gamewin); + _wr(gamewin); usleep(DEF_ANIMDELAY); } @@ -295,7 +295,7 @@ void anim(cell_t *src, cell_t *dst, char ch, int colour) { y += yinc; } // show cursor - curs_set(1); + cset(1); 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; // hide cursor - curs_set(0); + cset(0); for (i = 0; i < ndst; i++) { int n; @@ -334,17 +334,17 @@ void animcells(cell_t *src, cell_t **dst, int ndst, int gradual, char ch, char c } if (gradual) { - wrefresh(gamewin); + _wr(gamewin); usleep(DEF_ANIMDELAY); } } if (!gradual) { - wrefresh(gamewin); + _wr(gamewin); usleep(DEF_ANIMDELAY); } // show cursor - curs_set(1); + cset(1); needredraw = B_TRUE; } @@ -364,7 +364,7 @@ void animflashcells(cell_t **cell, int ncells, int ch,int colour, char *seetext) drawlevelfor(player); // hide cursor - curs_set(0); + cset(0); for (i = 0; i <= ncells; 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) { - wrefresh(gamewin); + _wr(gamewin); usleep(DEF_ANIMDELAY); if (seetext) { @@ -384,7 +384,7 @@ void animflashcells(cell_t **cell, int ncells, int ch,int colour, char *seetext) } } // show cursor - curs_set(1); + cset(1); needredraw = B_TRUE; drawscreen(); } @@ -401,7 +401,7 @@ void animline(cell_t *src, cell_t *dst, int gradual, char ch, char ch2, int colo gl.colour = colour; // hide cursor - curs_set(0); + cset(0); for (i = 0; i < ndst; i++) { int n; @@ -428,17 +428,17 @@ void animline(cell_t *src, cell_t *dst, int gradual, char ch, char ch2, int colo } if (gradual) { - wrefresh(gamewin); + _wr(gamewin); usleep(DEF_ANIMDELAY); } } if (!gradual) { - wrefresh(gamewin); + _wr(gamewin); usleep(DEF_ANIMDELAY); } // show cursor - curs_set(1); + cset(1); needredraw = B_TRUE; } @@ -458,7 +458,7 @@ void animradial(cell_t *src, int radius, int ch,int colour, int dirtype, char *s drawlevelfor(player); // hide cursor - curs_set(0); + cset(0); if (dirtype == DT_ORTH) { 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) { - wrefresh(gamewin); + _wr(gamewin); usleep(DEF_ANIMDELAY); } } @@ -500,7 +500,7 @@ void animradial(cell_t *src, int radius, int ch,int colour, int dirtype, char *s } if (drawn) { - wrefresh(gamewin); + _wr(gamewin); usleep(DEF_ANIMDELAY); } } @@ -515,7 +515,7 @@ void animradial(cell_t *src, int radius, int ch,int colour, int dirtype, char *s } } // show cursor - curs_set(1); + cset(1); needredraw = B_TRUE; drawscreen(); } @@ -533,7 +533,7 @@ void animsky(cell_t *src, char ch, int colour) { gl.ch = ch; gl.colour = colour; // hide cursor - curs_set(0); + cset(0); // update viewpoint 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); drawglyph(&gl, src->x - viewx, y); } - wrefresh(gamewin); + _wr(gamewin); usleep(DEF_ANIMDELAY); // show cursor - curs_set(1); + cset(1); needredraw = B_TRUE; } @@ -587,9 +587,9 @@ char askchar(char *prompt, char *validchars, char *def, int showchars, int mayca strcat(buf, "? "); mvwprintw(msgwin, 0, 0, buf); - wrefresh(msgwin); + _wr(msgwin); - curs_set(1); + cset(1); valid = B_FALSE; while (!valid) { ch = getkey(B_FALSE); @@ -604,7 +604,7 @@ char askchar(char *prompt, char *validchars, char *def, int showchars, int mayca valid = B_FALSE; } } - curs_set(0); + cset(0); // update messaage history 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) { wclear(msgwin); mvwprintw(msgwin, 0, 0, "%s", prompt); - wrefresh(msgwin); + _wr(msgwin); } else { // force cell description to show moved = B_TRUE; @@ -1168,7 +1168,7 @@ cell_t *real_askcoords(char *prompt, char *subprompt, int targettype, lifeform_t wmove(msgwin, 0, 0); textwithcol(msgwin, fullbuf); } - wrefresh(msgwin); + _wr(msgwin); // show our line of fire if (wanttrail && inrange) { @@ -1197,7 +1197,7 @@ cell_t *real_askcoords(char *prompt, char *subprompt, int targettype, lifeform_t // move cursor selected position wmove(gamewin, c->y - viewy, c->x - viewx); - curs_set(1); + cset(1); redraw(); // get input @@ -1295,13 +1295,13 @@ char *askstring(char *prompt, char punc, char *retbuf, int retbuflen, char *def) strcat(buf, "]"); } - curs_set(1); + cset(1); asprintf(&ending, "%c ",punc); strcat(buf, ending); free(ending); mvwprintw(msgwin, 0, 0, buf); - wrefresh(msgwin); + _wr(msgwin); echo(); wgetnstr(msgwin, retbuf, retbuflen); noecho(); @@ -3282,6 +3282,19 @@ int confirm_injury_action(enum BODYPART bp, enum DAMTYPE dt, char *actionname) { 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 *lf = NULL; int i; @@ -3645,7 +3658,7 @@ object_t *doaskobject(obpile_t *op, char *prompt, char *noobtext, int *count, in fullnumstring); wclear(msgwin); - wrefresh(msgwin); + _wr(msgwin); mvwprintw(mainwin, 0, 0, "%s", fullprompt); if (defob) { @@ -3669,7 +3682,7 @@ object_t *doaskobject(obpile_t *op, char *prompt, char *noobtext, int *count, in } } // update screen - wrefresh(mainwin); + _wr(mainwin); // wait for keypess ch = getch(); 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); // update screen - wrefresh(mainwin); + _wr(mainwin); // wait for keypess ch = getch(); if (ch == 27) { // escape @@ -4179,18 +4192,18 @@ void real_clearmsg(int force) { strcpy(msgbuf, ""); wclear(msgwin); - wrefresh(msgwin); + _wr(msgwin); } } int cleanupgfx(void) { - curs_set(1); + cset(1); endwin(); return B_FALSE; } void updatestatus(void) { - wrefresh(statwin); + _wr(statwin); } @@ -4201,6 +4214,8 @@ int updateviewfor(cell_t *cell) { oldvx = viewx; oldvy = viewy; + cset(0); + getmaxyx(gamewin, h, w); // calculate viewport if required @@ -4238,14 +4253,17 @@ void drawscreen(void) { } if (statdirty) { + dblog("drawing status\n"); drawstatus(); - //wrefresh(statwin); + //_wr(statwin); wnoutrefresh(statwin); statdirty = B_FALSE; didstatus = B_TRUE; } if (needredraw) { + cset(0); + dblog("drawing screen\n"); updateviewfor(player->cell); drawlevelfor(player); //drawcursor(); // this will call redraw gamewin @@ -4253,8 +4271,8 @@ void drawscreen(void) { } if (didstatus && !didredraw) { - doupdate(); - drawcursor(); + //rdp drawcursor(); + updatescreen(); } } @@ -4277,7 +4295,8 @@ char cmdtochar(enum COMMAND cmd) { // clears the screen void cls(void) { - wclear(mainwin); + //wclear(mainwin); + werase(mainwin); statdirty = B_TRUE; } @@ -4307,7 +4326,7 @@ void describegod(lifeform_t *god) { textwithcol(mainwin, buf2); free(buf2); - wrefresh(mainwin); + _wr(mainwin); // wait for key getch(); @@ -4335,7 +4354,7 @@ void describejob(enum JOB jid) { textwithcol(mainwin, buf2); free(buf2); - wrefresh(mainwin); + _wr(mainwin); // wait for key getch(); @@ -4369,7 +4388,7 @@ void describeob(object_t *o) { wrapprint(mainwin, &y, &x, 0, "%s", buf2); free(buf2); - wrefresh(mainwin); + _wr(mainwin); // wait for key getch(); @@ -4407,7 +4426,7 @@ void describerace(enum RACE rid) { ch = wrapprint(mainwin, &y, &x, 0, "%s", buf2); free(buf2); - wrefresh(mainwin); + _wr(mainwin); // wait for key, unless we quit from the 'more' prompt if (ch != 27) { @@ -4438,7 +4457,7 @@ void describeskill(enum SKILL skid, enum SKILLLEVEL levhilite) { textwithcol(mainwin, buf2); free(buf2); - wrefresh(mainwin); + _wr(mainwin); // wait for key getch(); @@ -4464,7 +4483,7 @@ void describespell(objecttype_t *ot) { textwithcol(mainwin, buf2); free(buf2); - wrefresh(mainwin); + _wr(mainwin); // wait for key getch(); @@ -5750,7 +5769,7 @@ void doknowledgelist(void) { if (y >= (SCREENH-3)) { mvwprintw(mainwin, (SCREENH-2), 0, MORESTRING); - wrefresh(mainwin); + _wr(mainwin); getch(); cls(); mvwprintw(mainwin, 0, 0, "Current Knowledge"); @@ -5764,7 +5783,7 @@ void doknowledgelist(void) { if (numfound == 0) { mvwprintw(mainwin, y, 0, "You don't know much."); } - wrefresh(mainwin); + _wr(mainwin); getch(); restoregamewindows(); @@ -8880,7 +8899,7 @@ void domsghist(void) { textwithcol(mainwin, msghist[i]); y++; } - wrefresh(mainwin); + _wr(mainwin); getch(); // restore screen restoregamewindows(); @@ -8920,7 +8939,7 @@ void dooptions(void) { strcat(cmdchars, thislet); } - curs_set(0); + cset(0); while (!done) { cls(); @@ -8957,7 +8976,7 @@ void dooptions(void) { } } - curs_set(1); + cset(1); restoregamewindows(); } @@ -9879,14 +9898,16 @@ void drawglyph(glyph_t *g, int x, int y) { unsetcol(gamewin, col); } +void updatescreen(void) { + wnoutrefresh(gamewin); + doupdate(); +} + void drawcursor(void) { // move cursor to player position wmove(gamewin, player->cell->y - viewy, player->cell->x - viewx); - //wrefresh(gamewin); - // turn on cursor - curs_set(1); - wnoutrefresh(gamewin); - doupdate(); + updatescreen(); + cset(1); } void drawlevelfor(lifeform_t *lf) { @@ -9915,7 +9936,7 @@ void drawlevelfor(lifeform_t *lf) { numdraws++; // turn off cursor - curs_set(0); + cset(0); if (db) dblog("starting DRAWLEVEL"); //wclear(gamewin); @@ -9938,31 +9959,25 @@ void drawlevelfor(lifeform_t *lf) { } // only draw if screen char/colour is different - if (!screenglyphmatches(x, y, &glyph)) { + //if (!screenglyphmatches(x, y, &glyph)) { 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++; - } + //} } } if (db) { 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); if (db) dblog("%s",buf); //dbtimeend(buf); // move cursor to the player's position and blit if (ndrawn) { - drawcursor(); + //drawcursor(); + updatescreen(); } } @@ -10444,7 +10459,7 @@ char getchoice(prompt_t *prompt) { } } - curs_set(1); + cset(1); // loop until result is valid 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] " : ""); mvwprintw(mainwin, 0, 0, "%s", fullprompt); - wrefresh(mainwin); + _wr(mainwin); // ask for choice... ch = getch(); @@ -10541,9 +10556,9 @@ char getchoice(prompt_t *prompt) { drawscreen(); } else { cls(); - wrefresh(mainwin); + _wr(mainwin); } - curs_set(0); + cset(0); restoregamewindows(); 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; // loop until result is valid - curs_set(1); + cset(1); sel = -1; while (sel == -1) { int foundfirstvalid = B_FALSE; @@ -10795,7 +10810,7 @@ char getchoicestr(prompt_t *prompt, int useshortcuts, int showallatstart) { // move cursor back wmove(mainwin, cy, cx); } - wrefresh(mainwin); + _wr(mainwin); // ask for choice... @@ -10883,9 +10898,9 @@ char getchoicestr(prompt_t *prompt, int useshortcuts, int showallatstart) { drawscreen(); } else { cls(); - wrefresh(mainwin); + _wr(mainwin); } - curs_set(0); + cset(0); if (gamemode == GM_GAMESTARTED) { restoregamewindows(); } @@ -11127,7 +11142,7 @@ void handleinput(void) { } else { wclear(msgwin); } - wrefresh(msgwin); + _wr(msgwin); gotcmd = B_FALSE; break; case 127: @@ -11142,7 +11157,7 @@ void handleinput(void) { } else { wclear(msgwin); } - wrefresh(msgwin); + _wr(msgwin); } gotcmd = B_FALSE; break; @@ -11502,10 +11517,10 @@ void more(void) { strcat(msgbuf, MSGMORESTRING); //mvwprintw(msgwin, 0, 0, msgbuf); drawmsg(); - curs_set(1); + cset(1); // wait for space while (getch() != ' '); - curs_set(0); + cset(0); // clear msg clearmsg(); } @@ -11644,8 +11659,9 @@ void drawstatus(void) { int xpleft; int height; - curs_set(0); - wclear(statwin); + cset(0); + //wclear(statwin); + werase(statwin); // FIRST LINE wmove(statwin, 0, 0); @@ -12110,7 +12126,7 @@ void drawmsg(void) { //mvwprintw(msgwin, 0, 0, msgbuf); - wrefresh(msgwin); + _wr(msgwin); strcpy(lastmsgbuf, msgbuf); } @@ -12119,9 +12135,9 @@ void drawmsg(void) { void redraw(void) { //dblog("redraw"); - //wrefresh(msgwin); - wrefresh(statwin); - wrefresh(gamewin); + //_wr(msgwin); + _wr(statwin); + _wr(gamewin); } void redrawpause(void) { @@ -12141,10 +12157,11 @@ void redrawresume(void) { } void restoregamewindows(void) { + dblog("restoregamewindows\n"); needredraw = B_TRUE; statdirty = B_TRUE; wclear(mainwin); - wrefresh(mainwin); + _wr(mainwin); clearmsg(); wclear(gamewin); drawscreen(); @@ -15201,11 +15218,11 @@ void showlfstats(lifeform_t *lf, int showall) { statdirty = B_TRUE; needredraw = B_TRUE; - cls(); wrefresh(mainwin); + cls(); _wr(mainwin); needredraw = B_TRUE; drawscreen(); - wrefresh(gamewin); - wrefresh(statwin); + _wr(gamewin); + _wr(statwin); real_clearmsg(B_TRUE); */ @@ -15352,7 +15369,7 @@ void tombstone(lifeform_t *lf) { p = readuntil(buf, p, '\n'); } - wrefresh(mainwin); + _wr(mainwin); // write hiscores and calculate player's rank writehiscore(player, &rank); @@ -15404,7 +15421,7 @@ void tombstone(lifeform_t *lf) { // clear screen cls(); // close down curses - curs_set(1); + cset(1); endwin(); } diff --git a/io.h b/io.h index e32bb2d..ce224f7 100755 --- a/io.h +++ b/io.h @@ -23,6 +23,8 @@ void announcetime(int h, int m, int s, int showfull); void cantdrink(enum ERROR reason); int confirm_badfeeling(object_t *o); 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); 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); @@ -162,6 +164,7 @@ void textwithcol_real(WINDOW *win, char *buf, int resetcolatend); void tombstone(lifeform_t *lf); void updatestatus(void); int updateviewfor(cell_t *cell); +void updatescreen(void); int warnabout(char *what); int real_warnabout(char *what, int lifetime, int doquestion); void wingame(void); diff --git a/lf.c b/lf.c index 11ce065..303a0d7 100755 --- a/lf.c +++ b/lf.c @@ -21063,6 +21063,7 @@ int startresting(lifeform_t *lf, int willtrain) { } } drawmsg(); + updatescreen(); drawcursor(); } diff --git a/move.c b/move.c index f20742a..f44e72f 100755 --- a/move.c +++ b/move.c @@ -19,6 +19,8 @@ extern lifeform_t *player; +extern int cursoron; + extern int statdirty; extern int needredraw; @@ -3635,7 +3637,7 @@ int walkoffmap(lifeform_t *lf, int dir, int onpurpose) { // announce if (isplayer(lf)) { char dirname[BUFLEN]; - curs_set(1); + cset(1); strcpy(dirname, getdirname(dir)); dirname[0] = tolower(dirname[0]); 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]; getmoveverbother(lf, mverb); getlfname(lf, lfname); - curs_set(1); + cset(1); strcpy(dirname, getdirname(dir)); dirname[0] = tolower(dirname[0]); msg("%s %s to the %s...", lfname, mverb, getdirname(dir)); diff --git a/spell.c b/spell.c index a7400f4..76c57ec 100755 --- a/spell.c +++ b/spell.c @@ -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); } 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) { char tname[BUFLEN]; int dam,dir = D_NONE;