spellcast-1.0/ 40755 2756 144 0 5731611512 11443 5ustar benusersspellcast-1.0/engine.c100644 2756 144 121625 5515617610 13225 0ustar benusers#include #include #include "handwave.h" #include "internal.h" static char bigbuf[2048], bigbuf2[2048]; static char smallbuf[512]; extern void find_castspells(); extern void execute_spells(), execute_monsters(); extern char *pro_him(), *pro_himself(), *pro_his(); static void restrict_gestures(), build_cast_list(), pass_time(); static int analyze_endgame(); static void setup_turnactive(); void erase_queries(self) struct realgame *self; { /* free any rocks or questions that require it. At present, none do. */ self->numqueries = 0; } void add_query(self, player, qtype, rock) struct realgame *self; int player; int qtype; char *rock; { int qnum = self->numqueries; self->numqueries++; if (self->numqueries >= self->querylist_size) { self->querylist_size *= 2; self->querylist = (struct query *)realloc(self->querylist, sizeof(struct query) * self->querylist_size); } self->querylist[qnum].player = player; self->querylist[qnum].qtype = qtype; self->querylist[qnum].rock = rock; } void clear_permstats(ps) struct permstats *ps; { ps->mind_spell = -1; ps->fl_haste = 0; ps->fl_prot_evil = 0; ps->fl_resist_heat = 0; ps->fl_resist_cold = 0; ps->fl_blindness = 0; ps->fl_invisibility = 0; } void clear_out_spells(fred, wizflag) union being *fred; int wizflag; { fred->both.mind_spell = (-1); if (!wizflag) { fred->cre.nowm_spell = (-1); } else { fred->wiz.delay_time = 0; fred->wiz.perm_time = 0; if (fred->wiz.delay_bank != (-1)) { fred->wiz.delay_bank = (-1); } } fred->both.resistant_heat = 0; fred->both.fl_resist_heat = 0; fred->both.resistant_cold = 0; fred->both.fl_resist_cold = 0; fred->both.fl_resist_icestorm = 0; fred->both.mind_spell = -1; fred->both.disease_time = (-1); fred->both.poison_time = (-1); fred->both.prot_from_evil = 0; fred->both.haste = 0; fred->both.timestop = 0; fred->both.invisibility = 0; fred->both.blindness = 0; clear_permstats(&(fred->both.perm)); } void InitBeing(fred) union being *fred; { fred->both.alive = 1; fred->both.gender = Gender_NONE; fred->both.name = NULL; fred->both.hitpoints = 777; fred->both.max_hitpoints = 888; fred->both.resistant_heat = 0; fred->both.resistant_cold = 0; fred->both.prot_from_evil = 0; fred->both.haste = 0; fred->both.timestop = 0; fred->both.invisibility = 0; fred->both.blindness = 0; fred->both.poison_time = -1; fred->both.disease_time = -1; fred->both.mind_spell = -1; clear_permstats(&(fred->both.perm)); clear_round(fred); } char *gesture_name(val) int val; { switch (val) { case Gesture_DIGIT: return "digit"; break; case Gesture_FINGERS: return "fingers"; break; case Gesture_PALM: return "palm"; break; case Gesture_WAVE: return "wave"; break; case Gesture_CLAPHALF: return "clap"; break; case Gesture_SNAP: return "snap"; break; case Gesture_KNIFE: return "stab"; break; case Gesture_NOTHING: return "nothing"; break; default: return "ERROR:UNKNOWN"; break; } } int write_gestures(self, wiz, vall, valr) struct realgame *self; struct wizard *wiz; int vall, valr; { int gnum; if (wiz->numgests+3 >= wiz->gests_size) { wiz->gests_size *= 2; wiz->gests = (struct wizgesture *)realloc(wiz->gests, wiz->gests_size * sizeof(struct wizgesture)); } gnum = wiz->numgests; wiz->numgests++; wiz->gests[gnum].turnnum = self->turn; wiz->gests[gnum].log_hp = wiz->hitpoints; wiz->gests[gnum].did[0] = vall; wiz->gests[gnum].did[1] = valr; wiz->gests[gnum].invisible = (wiz->invisibility || (self->turntype==Turn_TIMESTOP)); wiz->gests[gnum].blind = self->blind_array; return gnum; } int previous_gesture(wiz, gnum, hand) struct wizard *wiz; int gnum, hand; { while (1) { gnum--; if (gnum<0) return Gesture_NOTHING; if (wiz->gests[gnum].did[hand] != Gesture_ANTISPELL) return wiz->gests[gnum].did[hand]; } } game *BeginGame(numplayers, names, genders, callbacks, rock) int numplayers; char **names; /* do not free this */ int *genders; /* do not free this */ struct interface *callbacks; /* do not free this */ char *rock; { struct realgame *self = (struct realgame *)malloc(sizeof(struct realgame)); int ix; srandom(getpid() + rock + numplayers); if (!self) return NULL; self->rock = rock; self->callbacks = (*callbacks); /* copy structure */ self->numplayers = numplayers; self->turn = 0; self->turntype = Turn_NORMAL; init_transcript(self); if (numplayers > MAXPLAYERS) { PrintMsg("Too many players requested.\n"); return NULL; } for (ix=0; ixnumplayers; ix++) { self->wiz[ix] = (struct wizard *)malloc(sizeof(struct wizard)); InitBeing(self->wiz[ix]); self->wiz[ix]->hitpoints = 15; self->wiz[ix]->max_hitpoints = 15; self->wiz[ix]->name = names[ix]; self->wiz[ix]->gender = genders[ix]; self->wiz[ix]->numgests = 0; self->wiz[ix]->gests_size = 20; self->wiz[ix]->gests = (struct wizgesture *)malloc(self->wiz[ix]->gests_size * sizeof(struct wizgesture)); self->wiz[ix]->surrendered = 0; self->wiz[ix]->fl_cast_lightning = 0; self->wiz[ix]->hand_paralyzed = (-1); self->wiz[ix]->perm_time = 0; self->wiz[ix]->delay_time = 0; self->wiz[ix]->delay_bank = (-1); sprintf(bigbuf, "%s strides defiantly into the arena. The referee casts the formal Dispel Magic and Anti-Spell on %s....\n", self->wiz[ix]->name, pro_him(self->wiz[ix]->gender)); PrintMsg2(ix, "You advance confidently into the arena. The referee casts the formal Dispel Magic and Anti-Spell on you....\n", bigbuf); } self->cre_size = 4; self->cre = (struct creature *)malloc(sizeof(struct creature) * self->cre_size); self->numcres = 0; self->querylist_size = 8; self->querylist = (struct query *)malloc(sizeof(struct query) * self->querylist_size); self->targetlist_size[0] = 0; self->targetlist_size[1] = 0; self->targetlist_size[2] = 0; self->targetlist[0] = (struct target *)malloc(4); self->targetlist[1] = (struct target *)malloc(4); self->targetlist[2] = (struct target *)malloc(4); self->castlist = NULL; self->hastelist = NULL; #if 0 /* to test name-generation */ { ix = 1; while (1) { create_creature(self, ix, 0); printf("%s\n", self->cre[self->numcres-1].name); ix++; if (ix==7) ix=1; } } #endif setup_targetlist(self); setup_turnactive(self); return (game *)self; } /* returns -1 if game is still going; playernumber if someone won; MAXPLAYERS for a draw */ int RunTurn(pgame, moves) game *pgame; int *moves; /* moves contains two ints for each player (left, right). The encoding is with Gesture_*. */ { struct realgame *self = (struct realgame *)pgame; int ix, jx, kx, gnum; int val, vall, valr; int numdead, numsurr, numlive; int *foundlist; struct castspell **cpt; self->blind_array = 0; for (ix=0; ixnumplayers; ix++) { if (self->wiz[ix]->blindness) self->blind_array |= (1<numplayers; ix++) if (self->turnactive[ix]) { struct wizard *wiz = self->wiz[ix]; vall = moves[ix*2]; if (vall<0 || vall>=NUMGESTURES) vall = Gesture_NOTHING; valr = moves[ix*2+1]; if (valr<0 || valr>=NUMGESTURES) valr = Gesture_NOTHING; gnum = write_gestures(self, wiz, vall, valr); wiz->hand_paralyzed = (-1); switch (wiz->mind_spell) { case SP__AMNESIA: wiz->gests[gnum].did[0] = previous_gesture(wiz, gnum, 0); wiz->gests[gnum].did[1] = previous_gesture(wiz, gnum, 1); sprintf(bigbuf, "In a fit of absent-mindedness, %s repeats %s gestures from last turn: %s with the left hand, %s with the right.\n", wiz->name, pro_his(wiz->gender), gesture_name(wiz->gests[gnum].did[0]), gesture_name(wiz->gests[gnum].did[1])); PrintMsg(bigbuf); break; case SP__CONFUSION: if (wiz->mind_caster==1 && wiz->perm.mind_spell==SP__CONFUSION && wiz->perm.mind_detail!=(-1)) { jx = (wiz->perm.mind_detail & QuVal_Hand_Left) ? 0 : 1; wiz->gests[gnum].did[jx] = wiz->perm.mind_detail & (~QuVal_Hand_MASK); } else { jx = random() % 2; wiz->gests[gnum].did[jx] = (random() % 6)+1; } if (wiz->mind_caster==1 && wiz->perm.mind_spell==SP__CONFUSION) { wiz->perm.mind_detail = wiz->gests[gnum].did[jx] | (jx ? QuVal_Hand_Right : QuVal_Hand_Left); } sprintf(bigbuf, "%s accidentally makes a %s with %s %s hand.\n", wiz->name, gesture_name(wiz->gests[gnum].did[jx]), pro_his(wiz->gender), (jx?"right":"left")); PrintMsg(bigbuf); break; case SP__CHARM_PERSON: if ((wiz->mind_caster & 1024) && wiz->perm.mind_spell==SP__CHARM_PERSON && wiz->perm.mind_detail!=(-1)) { /* grab detail */ jx = (wiz->perm.mind_detail & QuVal_Hand_Left) ? 0 : 1; wiz->gests[gnum].did[jx] = wiz->perm.mind_detail & (~QuVal_Hand_MASK); } else { /* ask */ int tmpcast = wiz->mind_caster & (~1024); if (tmpcast >= 128) { jx = 1; kx = tmpcast - 128; } else { jx = 0; kx = tmpcast; }; erase_queries(self); val = (ix+jx*128); add_query(self, kx, Qu_CharmGesture, (char *)val); Queries(self->numqueries, self->querylist); wiz->gests[gnum].did[jx] = self->querylist[0].answer; } if ((wiz->mind_caster & 1024) && wiz->perm.mind_spell==SP__CHARM_PERSON) { wiz->perm.mind_detail = wiz->gests[gnum].did[jx] | (jx ? QuVal_Hand_Right : QuVal_Hand_Left); } sprintf(bigbuf, "%s mysteriously makes a %s with %s %s hand.\n", wiz->name, gesture_name(wiz->gests[gnum].did[jx]), pro_his(wiz->gender), (jx?"right":"left")); PrintMsg(bigbuf); break; case SP__FEAR: jx=0; val = wiz->gests[gnum].did[0]; if (val==Gesture_NOTHING || val==Gesture_DIGIT || val==Gesture_FINGERS || val==Gesture_SNAP || val==Gesture_CLAPHALF) { wiz->gests[gnum].did[0] = Gesture_NOTHING; jx += 1; } val = wiz->gests[gnum].did[1]; if (val==Gesture_NOTHING || val==Gesture_DIGIT || val==Gesture_FINGERS || val==Gesture_SNAP || val==Gesture_CLAPHALF) { wiz->gests[gnum].did[1] = Gesture_NOTHING; jx += 2; } switch (jx) { case 1: sprintf(bigbuf, "Terrified, %s does nothing with %s left hand.\n", wiz->name, pro_his(wiz->gender)); break; case 2: sprintf(bigbuf, "Terrified, %s does nothing with %s right hand.\n", wiz->name, pro_his(wiz->gender)); break; case 3: sprintf(bigbuf, "Terrified, %s does nothing with either hand.\n", wiz->name); break; case 0: sprintf(bigbuf, "%s is terrified, but manages %s gestures anyway.\n", wiz->name, pro_his(wiz->gender)); break; } PrintMsg(bigbuf); break; case SP__PARALYSIS: jx = wiz->mind_caster; switch (previous_gesture(wiz, gnum, jx)) { case Gesture_PALM: case Gesture_WAVE: val = Gesture_PALM; break; case Gesture_DIGIT: case Gesture_SNAP: val = Gesture_DIGIT; break; case Gesture_FINGERS: case Gesture_CLAPHALF: val = Gesture_FINGERS; break; case Gesture_KNIFE: val = Gesture_KNIFE; break; case Gesture_NOTHING: val = Gesture_NOTHING; break; default: PrintMsg("ERROR: paralysis previous_gesture returned bad value.\n"); val = Gesture_NOTHING; break; } wiz->gests[gnum].did[jx] = val; wiz->hand_paralyzed = jx; sprintf(bigbuf, "%s's %s hand is frozen in a %s.\n", wiz->name, (jx?"right":"left"), gesture_name(wiz->gests[gnum].did[jx])); PrintMsg(bigbuf); break; default: break; } if (self->turntype != Turn_HASTE) wiz->mind_spell = (-1); /* for wizards, it's over, man */ else { /* spell will affect him for the second half of his hasted turn, so don't wipe it. */ } /* move this down? */ if (wiz->gests[gnum].did[0] == Gesture_KNIFE && wiz->gests[gnum].did[1] == Gesture_KNIFE) { PrintMsg2(ix, "You cannot stab with both hands!\n", NULL); wiz->gests[gnum].did[1] = Gesture_NOTHING; } } /* end if self->turnactive[ix] */ log_round_header(self); erase_queries(self); /* CHECK FOR SPELLS */ for (ix=0; ixnumplayers; ix++) if (self->turnactive[ix]) { foundlist = self->wiz[ix]->foundlist; find_castspells(foundlist, self->wiz[ix]->numgests, self->wiz[ix]->gests); /* CHECK SURRENDER */ if (foundlist[SP__SURRENDER]) { foundlist[SP__SURRENDER] = 0; self->wiz[ix]->surrendered = 1; sprintf(bigbuf, "%s makes the gesture of surrender!\n", self->wiz[ix]->name); PrintMsg2(ix, "Oh, dear. You seem to have surrendered.\n", bigbuf); } restrict_gestures(self, ix); } /* end if self->turnactive[ix] */ Queries(self->numqueries, self->querylist); /* "what spell do you want ot cast with your * hand?" questions. */ build_cast_list(self); if (self->turntype == Turn_HASTE) { self->hastelist = self->castlist; self->castlist = NULL; /* self->turn is not incremented */ self->turntype = Turn_NORMAL; setup_targetlist(self); setup_turnactive(self); return (-1); } /* else self->turntype == Turn_NORMAL or Turn_TIMESTOP */ if (self->hastelist) { for (cpt = (&(self->castlist)); (*cpt); cpt = (&((*cpt)->next))); (*cpt) = self->hastelist; self->hastelist = NULL; } execute_spells(self); execute_monsters(self); pass_time(self); /* CHECK FOR END-OF-GAME */ numlive = 0; numdead = 0; numsurr = 0; for (ix=0; ixnumplayers; ix++) { if (!self->wiz[ix]->alive) numdead++; else if (self->wiz[ix]->surrendered) numsurr++; else numlive++; } if (numlive <= 1) { setup_targetlist(self); /* well, just because */ return analyze_endgame(self, numlive, numdead, numsurr); } /* SURRENDERED WIZARDS ARE NOW EFFECTIVELY DEAD */ for (ix=0; ixnumplayers; ix++) if (self->wiz[ix]->surrendered) self->wiz[ix]->alive = 0; /* FIGURE OUT WHAT KIND OF TURN IS NEXT */ if (self->turntype==Turn_NORMAL) self->turn++; self->turntype = Turn_NORMAL; jx = 0; for (ix=0; ixnumplayers; ix++) { if (self->wiz[ix]->alive && self->wiz[ix]->timestop) { self->wiz[ix]->timestop--; if (self->wiz[ix]->timestop) { jx++; sprintf(bigbuf, "%s accelerates into a flickering blur.\n", self->wiz[ix]->name); PrintMsg2(ix, "Everything around you stops dead. The world is silent and motionless.\n", bigbuf); } else { sprintf(bigbuf, "%s reappears, moving at normal speed.\n", self->wiz[ix]->name); PrintMsg2(ix, "Everything begins moving again.\n", bigbuf); } } } for (ix=0; ixnumcres; ix++) { if (self->cre[ix].alive && self->cre[ix].timestop) { self->cre[ix].timestop--; if (self->cre[ix].timestop) { jx++; sprintf(bigbuf, "%s accelerates into a flickering blur.\n", self->cre[ix].name); PrintMsg(bigbuf); } else { sprintf(bigbuf, "%s reappears, moving at normal speed.\n", self->cre[ix].name); PrintMsg(bigbuf); } } } if (jx) { self->turntype = Turn_TIMESTOP; } else { /* no timestop... */ jx = 0; for (ix=0; ixnumplayers; ix++) { if (self->wiz[ix]->alive && self->wiz[ix]->haste) { self->wiz[ix]->haste--; if (self->wiz[ix]->haste==4) { self->wiz[ix]->haste--; jx++; sprintf(bigbuf, "%s begins moving very quickly.\n", self->wiz[ix]->name); PrintMsg2(ix, "Everyone else begins moving very slowly.\n", bigbuf); } else if (self->wiz[ix]->haste) { jx++; sprintf(bigbuf, "%s is still moving quickly.\n", self->wiz[ix]->name); PrintMsg2(ix, "Everyone else is still moving slowly.\n", bigbuf); } else { sprintf(bigbuf, "%s slows down to normal speed.\n", self->wiz[ix]->name); PrintMsg2(ix, "Everyone comes back up to normal speed.\n", bigbuf); } } } for (ix=0; ixnumcres; ix++) { if (self->cre[ix].alive && self->cre[ix].haste) { self->cre[ix].haste--; if (self->cre[ix].haste==4) { self->cre[ix].haste--; jx++; sprintf(bigbuf, "%s begins moving very quickly.\n", self->cre[ix].name); PrintMsg(bigbuf); } else if (self->cre[ix].haste) { jx++; sprintf(bigbuf, "%s is still moving quickly.\n", self->cre[ix].name); PrintMsg(bigbuf); } else { sprintf(bigbuf, "%s slows down to normal speed.\n", self->cre[ix].name); PrintMsg(bigbuf); } } } if (jx) { self->turntype = Turn_HASTE; } } setup_targetlist(self); setup_turnactive(self); return (-1); } void SeeGesture(pgame, player, asker, buf, size) game *pgame; int player, asker; int *buf; int size; { struct realgame *self = (struct realgame *)pgame; struct wizard *wiz = self->wiz[player]; int ix, gnum; for (ix=0, gnum=wiz->numgests-1; ixgests[gnum].invisible || (wiz->gests[gnum].blind & (1<gests[gnum].did[0]) | ((wiz->gests[gnum].did[1]) << 5); } } } void FreeGame(pgame) game *pgame; { struct realgame *self = (struct realgame *)pgame; int ix; for (ix=0; ixnumplayers; ix++) { free((char *)self->wiz[ix]); } for (ix=0; ixnumcres; ix++) { free(self->cre[ix].name); } free((char *)self->cre); free((char *)self->querylist); free((char *)self); } void setup_targetlist(self) struct realgame *self; { int ix, res; if (self->numplayers >= self->targetlist_size[0]) { self->targetlist_size[0] = self->numplayers*2; self->targetlist[0] = (struct target *)realloc(self->targetlist[0], sizeof(struct target) * self->targetlist_size[0]); } if (self->numcres >= self->targetlist_size[1]) { self->targetlist_size[1] = (self->numcres+1)*2; self->targetlist[1] = (struct target *)realloc(self->targetlist[1], sizeof(struct target) * self->targetlist_size[1]); } if ((self->numplayers+self->numcres) >= self->targetlist_size[2]) { self->targetlist_size[2] = (self->numplayers+self->numcres)*2; self->targetlist[2] = (struct target *)realloc(self->targetlist[2], sizeof(struct target) * self->targetlist_size[2]); } res = 0; for (ix=0; ixnumplayers; ix++) if (self->wiz[ix]->alive) { self->targetlist[0][res].index = ix | QuVal_Target_Wizard; self->targetlist[0][res].name = self->wiz[ix]->name; self->targetlist[0][res].stuff = StuffAboutBeing((game *)self, QuVal_Target_Wizard, ix); res++; } self->numtargets[0] = res; res = 0; for (ix=0; ixnumcres; ix++) if (self->cre[ix].alive) { self->targetlist[1][res].index = ix | QuVal_Target_Creature; self->targetlist[1][res].name = self->cre[ix].name; self->targetlist[1][res].stuff = StuffAboutBeing((game *)self, QuVal_Target_Creature, ix); res++; } self->numtargets[1] = res; res = 0; for (ix=0; ixnumplayers; ix++) if (!self->wiz[ix]->alive && !self->wiz[ix]->surrendered) { self->targetlist[2][res].index = ix | QuVal_Target_Wizard; self->targetlist[2][res].name = self->wiz[ix]->name; self->targetlist[2][res].stuff = 0; res++; } for (ix=0; ixnumcres; ix++) if (!self->cre[ix].alive && !self->cre[ix].nocorpse) { self->targetlist[2][res].index = ix | QuVal_Target_Creature; self->targetlist[2][res].name = self->cre[ix].name; self->targetlist[2][res].stuff = 0; res++; } self->numtargets[2] = res; } int NumberOfTargets(pgame, targettype) game *pgame; int targettype; { struct realgame *self = (struct realgame *)pgame; if (targettype==QuVal_Target_Wizard) { return self->numtargets[0]; } else if (targettype==QuVal_Target_Creature) { return self->numtargets[1]; } else if (targettype==QuVal_Target_Corpse) { return self->numtargets[2]; } else return 0; } int NumberOfBeings(pgame, targettype) game *pgame; int targettype; { struct realgame *self = (struct realgame *)pgame; if (targettype==QuVal_Target_Wizard) { return self->numplayers; } else if (targettype==QuVal_Target_Creature) { return self->numcres; } else return 0; } char *NameOfTarget(pgame, targettype, targetnum) game *pgame; int targettype, targetnum; { struct realgame *self = (struct realgame *)pgame; if (targettype==QuVal_Target_Wizard) { if (targetnum >= 0 && targetnum < self->numtargets[0]) return self->targetlist[0][targetnum].name; return "ERROR:NOBODY-wiz"; } else if (targettype==QuVal_Target_Creature) { if (targetnum >= 0 && targetnum < self->numtargets[1]) return self->targetlist[1][targetnum].name; return "ERROR:NOBODY-cre"; } else if (targettype==QuVal_Target_Corpse) { if (targetnum >= 0 && targetnum < self->numtargets[2]) return self->targetlist[2][targetnum].name; return "ERROR:NOBODY-corpse"; } else return "ERROR:NOBODY-atall"; } int IndexOfTarget(pgame, targettype, targetnum) game *pgame; int targettype, targetnum; { struct realgame *self = (struct realgame *)pgame; if (targettype==QuVal_Target_Wizard) { if (targetnum >= 0 && targetnum < self->numtargets[0]) return self->targetlist[0][targetnum].index; return (-1); } else if (targettype==QuVal_Target_Creature) { if (targetnum >= 0 && targetnum < self->numtargets[1]) return self->targetlist[1][targetnum].index; return (-1); } else if (targettype==QuVal_Target_Corpse) { if (targetnum >= 0 && targetnum < self->numtargets[2]) return self->targetlist[2][targetnum].index; return (-1); } else return (-1); } int StuffAboutTarget(pgame, targettype, targetnum) game *pgame; int targettype, targetnum; { struct realgame *self = (struct realgame *)pgame; if (targettype==QuVal_Target_Wizard) { if (targetnum >= 0 && targetnum < self->numtargets[0]) return self->targetlist[0][targetnum].stuff; return 0; } else if (targettype==QuVal_Target_Creature) { if (targetnum >= 0 && targetnum < self->numtargets[1]) return self->targetlist[1][targetnum].stuff; return 0; } else if (targettype==QuVal_Target_Corpse) { if (targetnum >= 0 && targetnum < self->numtargets[2]) return self->targetlist[2][targetnum].stuff; return 0; } else return 0; } /* -1 if dead, -2 if no corpse, surrendered, or out of bounds */ int HitPointsOfBeing(pgame, targettype, indexnum) game *pgame; int targettype, indexnum; { struct realgame *self = (struct realgame *)pgame; int ix; if (targettype==QuVal_Target_Wizard) { if (indexnum < self->numplayers) { ix = self->wiz[indexnum]->hitpoints; if (ix<0) ix=0; if (self->wiz[indexnum]->alive) return ix; if (self->wiz[indexnum]->surrendered) return (-2); else return (-1); } else return -2; } else if (targettype==QuVal_Target_Creature) { if (indexnum < self->numcres) { ix = self->cre[indexnum].hitpoints; if (ix<0) ix=0; if (self->cre[indexnum].alive) return ix; if (self->cre[indexnum].nocorpse) return (-2); else return (-1); } else return -2; } else return -2; } int StuffAboutBeing(pgame, targettype, indexnum) game *pgame; int targettype, indexnum; { struct realgame *self = (struct realgame *)pgame; union being *fred; int res; if (targettype==QuVal_Target_Wizard) { if (indexnum < self->numplayers) { fred = (union being *)self->wiz[indexnum]; } else return 0; } else if (targettype==QuVal_Target_Creature) { if (indexnum < self->numcres) { fred = (union being *)&(self->cre[indexnum]); } else return 0; } else return 0; res=0; if (fred->both.resistant_heat) res |= Stuff_RESIST_HEAT; if (fred->both.resistant_cold) res |= Stuff_RESIST_COLD; if (fred->both.prot_from_evil) res |= Stuff_PROTECT_EVIL; if (fred->both.invisibility) res |= Stuff_INVISIBLE; if (fred->both.blindness) res |= Stuff_BLIND; if (fred->both.poison_time != (-1)) res |= Stuff_POISON; if (fred->both.disease_time != (-1)) res |= Stuff_DISEASE; return res; } int OwnerOfCreature(pgame, indexnum) game *pgame; int indexnum; { struct realgame *self = (struct realgame *)pgame; int res = self->cre[indexnum].owner; if (res<0 || !self->wiz[res]->alive) return (-1); else return res; } char *NameOfBeing(pgame, targettype, indexnum) game *pgame; int targettype, indexnum; { struct realgame *self = (struct realgame *)pgame; int ix; if (targettype==QuVal_Target_Wizard) { if (indexnum < self->numplayers) { return self->wiz[indexnum]->name; } else return NULL; } else if (targettype==QuVal_Target_Creature) { if (indexnum < self->numcres) { return self->cre[indexnum].name; } else return NULL; } else return NULL; } int TurnType(pgame) game *pgame; { struct realgame *self = (struct realgame *)pgame; return self->turntype; } /* this is called after surrenders are killed */ static void setup_turnactive(self) struct realgame *self; { int ix; for (ix=0; ixturnactive[ix] = 0; switch (self->turntype) { case Turn_NORMAL: for (ix=0; ixnumplayers; ix++) { self->turnactive[ix] = self->wiz[ix]->alive; } break; case Turn_HASTE: for (ix=0; ixnumplayers; ix++) { self->turnactive[ix] = (self->wiz[ix]->alive && self->wiz[ix]->haste); } break; case Turn_TIMESTOP: for (ix=0; ixnumplayers; ix++) { self->turnactive[ix] = (self->wiz[ix]->alive && self->wiz[ix]->timestop); } break; default: PrintMsg("ERROR: Unknown turn type\n"); break; } } int TurnPlayerActive(pgame, player) game *pgame; int player; { struct realgame *self = (struct realgame *)pgame; return self->turnactive[player]; } /* go over wiz->foundlist and generate queries as to which spell is desired */ static void restrict_gestures(self, wiznum) struct realgame *self; int wiznum; { int jx; int lcount=0, rcount=0; int *llist = self->wiz[wiznum]->llist; int *rlist = self->wiz[wiznum]->rlist; int *foundlist = self->wiz[wiznum]->foundlist; for (jx=0; jx1) { add_query(self, wiznum, Qu_LeftHand, (char *)llist); } if (rcount>1) { add_query(self, wiznum, Qu_RightHand, (char *)rlist); } if (self->wiz[wiznum]->delay_bank != (-1)) add_query(self, wiznum, Qu_SetOffDelay, (char *)self->wiz[wiznum]->delay_bank); } static int spelltargetlist[NUMSPELLS] = { Qu_TargetWizard, Qu_TargetWizard, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetWizardNone, Qu_TargetRaiseDead, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetWizardNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_NoQuery, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetWizardNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetWizardNone, Qu_TargetWizardNone, Qu_TargetWizardNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_NoQuery, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetWizardNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_NoQuery, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetBeingNone, Qu_TargetBeingNone }; /* use llist and rlist together with self->querylist answers (including time delay) to create a spell list. Then create new querylist about targets, and ask it. */ static void build_cast_list(self) struct realgame *self; { struct castspell *res, *tmp; int wiznum, jx, kx; struct query *qtmp; /* free last turn's castlist */ while (self->castlist) { tmp = self->castlist->next; free((char *)self->castlist); self->castlist = tmp; } for (wiznum=0; wiznumnumplayers; wiznum++) if (self->turnactive[wiznum]) { int *llist = self->wiz[wiznum]->llist; int *rlist = self->wiz[wiznum]->rlist; int lspel, rspel; if (llist[0]==0) lspel = (-1); else if (llist[0]==1) lspel = llist[1]; else { for (jx=0; jxnumqueries; jx++) if (self->querylist[jx].player == wiznum && self->querylist[jx].qtype == Qu_LeftHand) break; lspel = llist[1 + self->querylist[jx].answer]; } if (rlist[0]==0) rspel = (-1); else if (rlist[0]==1) rspel = rlist[1]; else { for (jx=0; jxnumqueries; jx++) if (self->querylist[jx].player == wiznum && self->querylist[jx].qtype == Qu_RightHand) break; rspel = rlist[1 + self->querylist[jx].answer]; } if (lspel>=0 && (lspel & QuVal_Hand_Both)) { if (lspel==rspel) { res = (struct castspell *)malloc(sizeof(struct castspell)); res->caster = wiznum; res->handage = MASK_TWOHAND; res->spellnum = lspel & (~QuVal_Hand_Both); res->permanent = 0; res->next = self->castlist; self->castlist = res; lspel = (-1); rspel = (-1); } else lspel = (-1); } if (rspel>=0 && (rspel & QuVal_Hand_Both)) { rspel = (-1); } /* only one-handed spells remain */ if (lspel>=0) { res = (struct castspell *)malloc(sizeof(struct castspell)); res->caster = wiznum; res->handage = MASK_LEFT; res->spellnum = lspel; res->permanent = 0; res->next = self->castlist; self->castlist = res; } if (rspel>=0) { res = (struct castspell *)malloc(sizeof(struct castspell)); res->caster = wiznum; res->handage = MASK_RIGHT; res->spellnum = rspel; res->permanent = 0; res->next = self->castlist; self->castlist = res; } if (self->wiz[wiznum]->delay_bank != (-1)) { for (jx=0; jxnumqueries; jx++) if (self->querylist[jx].player == wiznum && self->querylist[jx].qtype == Qu_SetOffDelay) break; if (self->querylist[jx].answer) { res = (struct castspell *)malloc(sizeof(struct castspell)); res->caster = wiznum; res->handage = 0; res->spellnum = self->wiz[wiznum]->delay_bank; res->permanent = 0; res->next = self->castlist; self->castlist = res; self->wiz[wiznum]->delay_bank = (-1); } } } /* end if self->turnactive[ix] */ erase_queries(self); for (wiznum=0; wiznumnumplayers; wiznum++) if (self->turnactive[wiznum]) { struct wizard *wiz = self->wiz[wiznum]; /* DELAYED EFFECT */ if (wiz->delay_time) { struct castspell *dellist[10]; /* that had better be enough */ int delnum[11]; int numdel = 0; for (tmp=self->castlist; tmp; tmp=tmp->next) { if (tmp->caster == wiznum && tmp->handage != 0 /* can't bank a banked spell */ && tmp->spellnum != SP__STAB) { dellist[numdel] = tmp; delnum[numdel] = tmp->spellnum; numdel++; } } delnum[numdel] = (-1); if (numdel==0) res = NULL; else if (numdel==1) res = dellist[0]; else { /* gack -- have to pick from the list. */ erase_queries(self); add_query(self, wiznum, Qu_WhichToDelay, delnum); Queries(self->numqueries, self->querylist); res = dellist[self->querylist[0].answer]; } if (res) { struct castspell **ppt; for (ppt = (&(self->castlist)); (*ppt) && (*ppt)!=res; ppt = (&((*ppt)->next))); if (!(*ppt)) { PrintMsg("ERROR: Unable to find Delayed spell.\n"); } else { *ppt = res->next; res->next = NULL; sprintf(bigbuf, "You cast %s; the spell is caught in the web of your Delayed Effect. It rises to hover by your head.\n", spelllist[res->spellnum].name); sprintf(bigbuf2, "%s casts %s; the spell is caught in the web of %s Delayed Effect.\n", wiz->name, spelllist[res->spellnum].name, pro_his(wiz->gender)); PrintMsg2(wiznum, bigbuf, bigbuf2); if (wiz->delay_bank != (-1)) { sprintf(bigbuf, "The %s spell that you had caught previously is lost.\n", spelllist[wiz->delay_bank].name); sprintf(bigbuf2, "The %s spell that %s had caught previously is lost.\n", spelllist[wiz->delay_bank].name, wiz->name); PrintMsg2(wiznum, bigbuf, bigbuf2); wiz->delay_bank = (-1); } wiz->delay_time = 0; wiz->delay_bank = res->spellnum; free((char *)res); } } } /* PERMANENCY */ if (wiz->perm_time) { struct castspell *dellist[10]; /* that had better be enough */ int delnum[11]; int numdel = 0; for (tmp=self->castlist; tmp; tmp=tmp->next) { if (tmp->caster == wiznum && tmp->handage != 0 /* can't perm a banked spell */ && spelllist[tmp->spellnum].extendable) { dellist[numdel] = tmp; delnum[numdel] = tmp->spellnum; numdel++; } } delnum[numdel] = (-1); if (numdel==0) res = NULL; else if (numdel==1) res = dellist[0]; else { /* gack -- have to pick from the list. */ erase_queries(self); add_query(self, wiznum, Qu_WhichToPerm, delnum); Queries(self->numqueries, self->querylist); res = dellist[self->querylist[0].answer]; } if (res) { res->permanent = 1; sprintf(bigbuf, "Your Permanency spell wraps itself around your %s spell.\n", spelllist[res->spellnum].name); PrintMsg2(wiznum, bigbuf, NULL); wiz->perm_time = 0; } } } erase_queries(self); /* add target queries for spells, in order */ for (tmp=self->castlist; tmp; tmp=tmp->next) { int orval; if (tmp->handage==MASK_LEFT) orval = QuVal_Hand_Left; else if (tmp->handage==MASK_RIGHT) orval = QuVal_Hand_Right; else if (tmp->handage==0) orval = 0; else orval = QuVal_Hand_Both; add_query(self, tmp->caster, spelltargetlist[tmp->spellnum], tmp->spellnum | orval); } Queries(self->numqueries, self->querylist); /* "who do you want to cast X on?" queries */ for (tmp=self->castlist, jx=0; tmp; tmp=tmp->next, jx++) { if (spelltargetlist[tmp->spellnum]==Qu_NoQuery) { tmp->targettype = (-1); } else { int ival; int tart = self->querylist[jx].answer & QuVal_Target_MASK; if (tart==0) { tmp->targettype = 0; } else { kx = self->querylist[jx].answer & (~QuVal_Target_MASK); ival = IndexOfTarget((game *)self, tart, kx); tmp->target = ival & (~QuVal_Target_MASK); tmp->targettype = ival & QuVal_Target_MASK; } } } } static void exec_unhealth(self, fred, cnum, wizflag) /* no deaders */ struct realgame *self; union being *fred; int cnum; int wizflag; { if (self->turntype==Turn_TIMESTOP && fred->both.timestop!=1) return; /* the illnesses are timestopped and have no effect. */ if (fred->both.disease_time != (-1)) { fred->both.disease_time--; switch (fred->both.disease_time) { case 5: /* message already printed */ break; case 4: sprintf(bigbuf, "%s starts to look hot and flushed.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "You begin to feel somewhat feverish.\n", bigbuf); else PrintMsg(bigbuf); break; case 3: sprintf(bigbuf, "%s looks even more flushed.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "Your fever is growing worse.\n", bigbuf); else PrintMsg(bigbuf); break; case 2: sprintf(bigbuf, "%s is flushed and sweating, and seems to be somewhat unsteady on %s feet.\n", fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "You are very hot and somewhat dizzy, and your bones are starting to ache.\n", bigbuf); else PrintMsg(bigbuf); break; case 1: sprintf(bigbuf, "%s is both flushed and shivering violently.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "You are feverish and shivering at the same time, and you ache all over.\n", bigbuf); else PrintMsg(bigbuf); break; case 0: sprintf(bigbuf, "%s crumples to the ground, agony on %s sweating features.\n", fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "Your knees give way and you fall to the ground. Your head pounds unmercifully as consciousness slips away....\n", bigbuf); else PrintMsg(bigbuf); fred->both.alive = 0; break; } } if (fred->both.poison_time != (-1)) { fred->both.poison_time--; switch (fred->both.poison_time) { case 5: /* message already printed */ break; case 4: sprintf(bigbuf, "%s is looking pale.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "Your toes suddenly feel slightly numb.\n", bigbuf); else PrintMsg(bigbuf); break; case 3: sprintf(bigbuf, "%s is looking very pale and weak.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "Your hands and feet are getting numb.\n", bigbuf); else PrintMsg(bigbuf); break; case 2: sprintf(bigbuf, "%s is white as a sheet, and seems a little unsteady.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "Your limbs are heavy, and your fingers are getting clumsy.\n", bigbuf); else PrintMsg(bigbuf); break; case 1: sprintf(bigbuf, "%s is having difficulty staying on %s feet.\n", fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "You cannot feel your hands and feet, and your vision is becoming clouded.\n", bigbuf); else PrintMsg(bigbuf); break; case 0: sprintf(bigbuf, "%s collapses in a heap, twitching slightly.\n", fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "You stumble and fall to your knees, vision dimming. Numbness creeps through your bones, and you cannot tell if you are still breathing....\n", bigbuf); else PrintMsg(bigbuf); fred->both.alive = 0; break; } } } /* let critters die, let poison/disease advance, etc */ static void pass_time(self) struct realgame *self; { int ix; for (ix=0; ixnumplayers; ix++) { if (self->wiz[ix]->alive && self->wiz[ix]->hitpoints <= 0) { sprintf(bigbuf, "%s has died!\n", self->wiz[ix]->name); PrintMsg2(ix, "You have died!\n", bigbuf); self->wiz[ix]->alive = 0; clear_out_spells(self->wiz[ix], 1); write_gestures(self, self->wiz[ix], Gesture_NOTHING, Gesture_NOTHING); /* ### other stuff? */ } if (self->wiz[ix]->alive) { exec_unhealth(self, self->wiz[ix], ix, 1); } if (self->wiz[ix]->alive && self->turnactive[ix]) { if (self->wiz[ix]->delay_time) { self->wiz[ix]->delay_time--; if (self->wiz[ix]->delay_time==0) { sprintf(bigbuf, "The Delayed Effect spell hovering around %s dies away.\n", self->wiz[ix]->name); PrintMsg2(ix, "The Delayed Effect spell hovering around you dies away.\n", bigbuf); } } } if (self->wiz[ix]->alive && self->turnactive[ix]) { if (self->wiz[ix]->perm_time) { self->wiz[ix]->perm_time--; if (self->wiz[ix]->perm_time==0) { sprintf(bigbuf, "The Permanency spell hovering around %s dies away.\n", self->wiz[ix]->name); PrintMsg2(ix, "The Permanency spell hovering around you dies away.\n", bigbuf); } } } } for (ix=0; ixnumcres; ix++) { if (self->cre[ix].alive && self->cre[ix].hitpoints <= 0) { sprintf(bigbuf, "%s has died.\n", self->cre[ix].name); PrintMsg(bigbuf); self->cre[ix].alive = 0; clear_out_spells(&(self->cre[ix]), 0); /* ### other stuff? */ } if (self->cre[ix].alive) exec_unhealth(self, &self->cre[ix], ix, 0); } } static int analyze_endgame(self, numlive, numdead, numsurr) struct realgame *self; int numlive, numdead, numsurr; /* these add up to self->numplayers, and numlive <= 1 */ { int ix, jx; if (numlive==1) { for (ix=0; ixnumplayers; ix++) if (self->wiz[ix]->alive && !self->wiz[ix]->surrendered) break; if (numsurr==0) { sprintf(bigbuf, "%s is the sole survivor!\n", self->wiz[ix]->name); PrintMsg(bigbuf); } else if (numsurr==1) { for (jx=0; jxnumplayers; jx++) if (self->wiz[jx]->alive && self->wiz[jx]->surrendered) break; sprintf(bigbuf, "%s has surrendered to %s!\n", self->wiz[jx]->name, self->wiz[ix]->name); PrintMsg(bigbuf); } else { sprintf(bigbuf, "All of %s's opponents have surrendered!\n", self->wiz[ix]->name); PrintMsg(bigbuf); } return ix; } else { /* nobody left alive (and unsurrendered) */ if (numsurr==0) { PrintMsg("Everyone is dead!\n"); return MAXPLAYERS; } if (numsurr==1) { for (jx=0; jxnumplayers; jx++) if (self->wiz[jx]->alive && self->wiz[jx]->surrendered) break; sprintf(bigbuf, "%s finds that there is nobody left to surrender to!\n", self->wiz[jx]->name); PrintMsg(bigbuf); return jx; } if (numdead) PrintMsg("The survivors have all surrendered to each other!\n"); else PrintMsg("Everyone has surrendered to each other!\n"); return MAXPLAYERS; } } spellcast-1.0/execute.c100644 2756 144 105622 5515621443 13420 0ustar benusers#include #include #include "handwave.h" #include "internal.h" char exbuf[2048], exbuf2[2048], exbuf3[2048]; static char smallbuf[512]; static int summonelq; static void exec_counters(), exec_summons(), check_elements(), exec_cancels(), exec_protects(); extern void exec_enchants(), exec_attacks(), exec_heals(); void clear_round(fred) union being *fred; { int ix; fred->both.enchant_caster = (-1); fred->both.enchant_ppend = 0; fred->both.raisedead_caster = (-1); fred->both.fl_resist_heat = 0; fred->both.fl_resist_cold = 0; fred->both.fl_resist_icestorm = 0; for (ix=0; ixboth.zaplist[ix] = 0; } /* add a zaplist entry. If the spell is a control spell, set the enchant_caster also; this can only store one value, but that's ok, since if there's more than one control spell they all fail. If the spell is raise dead, set raisedead_caster (only used when raising dead monsters) */ static void set_zap_flag(self, spel, spelnum) struct realgame *self; struct castspell *spel; int spelnum; { int set_enchanter=0, set_ppend=0; struct permstats *perm = NULL; int *ppend = NULL; if (spelnum==(-1)) spelnum = spel->spellnum; if (spelnum==SP__PARALYSIS || spelnum==SP__CHARM_PERSON || spelnum==SP__CHARM_MONSTER) { set_enchanter=1; } if (spelnum==SP__PARALYSIS || spelnum==SP__CHARM_PERSON || spelnum==SP__CHARM_MONSTER || spelnum==SP__FEAR || spelnum==SP__AMNESIA || spelnum==SP__CONFUSION) { set_ppend=1; } switch (spel->targettype) { case QuVal_Target_Wizard: perm = &(self->wiz[spel->target]->perm); ppend = &(self->wiz[spel->target]->enchant_ppend); self->wiz[spel->target]->zaplist[spelnum]++; if (set_enchanter) self->wiz[spel->target]->enchant_caster = spel->caster; if (set_ppend) *ppend = spel->permanent; if (spelnum==SP__RAISE_DEAD) self->wiz[spel->target]->raisedead_caster = spel->caster; break; case QuVal_Target_Creature: perm = &(self->cre[spel->target].perm); ppend = &(self->cre[spel->target].enchant_ppend); self->cre[spel->target].zaplist[spelnum]++; if (set_enchanter) self->cre[spel->target].enchant_caster = spel->caster; if (set_ppend) *ppend = spel->permanent; if (spelnum==SP__RAISE_DEAD) self->cre[spel->target].raisedead_caster = spel->caster; break; default: /* up-in-air or area-effect */ break; } if (spel->permanent && perm) { struct wizard *wiz = self->wiz[spel->target]; switch (spelnum) { case SP__AMNESIA: case SP__FEAR: case SP__CHARM_PERSON: case SP__CHARM_MONSTER: case SP__PARALYSIS: case SP__CONFUSION: break; case SP__HASTE: perm->fl_haste = 1; break; case SP__PROTECTION_FROM_EVIL: perm->fl_prot_evil = 1; break; case SP__RESIST_HEAT: perm->fl_resist_heat = 1; break; case SP__RESIST_COLD: perm->fl_resist_cold = 1; break; case SP__INVISIBILITY: perm->fl_invisibility = 1; break; case SP__BLINDNESS: perm->fl_blindness = 1; break; default: printf("ERROR: do not know how to permanent %d.\n", spelnum); break; } } } char *pro_himself(gender) int gender; { switch (gender) { case Gender_NONE: return "itself"; case Gender_MALE: return "himself"; case Gender_FEMALE: return "herself"; case Gender_NEUTER: return "hirself"; default: return "ERROR-himself"; } } char *pro_him(gender) int gender; { switch (gender) { case Gender_NONE: return "it"; case Gender_MALE: return "him"; case Gender_FEMALE: return "her"; case Gender_NEUTER: return "hir"; default: return "ERROR-him"; } } char *pro_he(gender) int gender; { switch (gender) { case Gender_NONE: return "it"; case Gender_MALE: return "he"; case Gender_FEMALE: return "she"; case Gender_NEUTER: return "ke"; default: return "ERROR-he"; } } char *pro_his(gender) /* his head, not the head of his */ int gender; { switch (gender) { case Gender_NONE: return "its"; case Gender_MALE: return "his"; case Gender_FEMALE: return "her"; case Gender_NEUTER: return "hir"; default: return "ERROR-his"; } } char *number_name(num) int num; { static char buf[16]; switch (num) { case 0: return "zero"; case 1: return "one"; case 2: return "two"; case 3: return "three"; case 4: return "four"; case 5: return "five"; case 6: return "six"; case 7: return "seven"; case 8: return "eight"; case 9: return "nine"; case 10: return "ten"; default: sprintf(buf, "%d", num); return buf; } } static void list_mind_spells(buf, zapl) char *buf; int *zapl; { int any = 0; int ix, spel; static int spelist[6] = {SP__AMNESIA, SP__CONFUSION, SP__CHARM_PERSON, SP__CHARM_MONSTER, SP__PARALYSIS, SP__FEAR}; strcpy(buf, ""); for (ix=0; ix<6; ix++) { spel = spelist[ix]; if (zapl[spel]) { if (any) strcat(buf, ", "); any = 1; if (zapl[spel]==1) { strcat(buf, spelllist[spel].name); } else { sprintf(smallbuf, "%s %s", number_name(zapl[spel]), spelllist[spel].name); strcat(buf, smallbuf); } } } } static int check_visibility(self, mcaster, mtarget, ctmp) struct realgame *self; struct wizard *mcaster; union being *mtarget; struct castspell *ctmp; { if (!mtarget) return 1; /* you can always see up-in-the-air */ if ((union being *)mcaster != mtarget && (mtarget->both.invisibility || mcaster->blindness)) { sprintf(exbuf, "You are unable to see %s; your %s goes wild.\n", mtarget->both.name, spelllist[ctmp->spellnum].name); sprintf(exbuf2, "%s is unable to see you; %s %s goes wild.\n", mcaster->name, pro_his(mcaster->gender), spelllist[ctmp->spellnum].name); sprintf(exbuf3, "%s is unable to see %s; %s %s goes wild.\n", mcaster->name, mtarget->both.name, pro_his(mcaster->gender), spelllist[ctmp->spellnum].name); if (ctmp->targettype==QuVal_Target_Wizard) PrintMsg3(ctmp->caster, ctmp->target, exbuf, exbuf2, exbuf3); else PrintMsg2(ctmp->caster, exbuf, exbuf3); return 0; } return 1; } void execute_spells(self) struct realgame *self; { struct castspell *ctmp, **pt; int ix, jx, wiznum; int *zapl; union being *mtarget; struct wizard *mcaster; for (ctmp = self->castlist; ctmp; ctmp = ctmp->next) { char *handage; switch (ctmp->handage) { case MASK_LEFT: handage = "with the left hand"; break; case MASK_RIGHT: handage = "with the right hand"; break; case MASK_TWOHAND: handage = "with both hands"; break; case 0: handage = "from a Delayed Effect"; break; case MASK_LEFT|MASK_RIGHT: handage = "ERROR:BOTH??? hands"; break; default: handage = "ERROR:NEITHER??? hand"; break; } switch (ctmp->targettype) { case -1: strcpy(smallbuf, "over the arena"); break; case 0: strcpy(smallbuf, "up into the air"); break; default: if (ctmp->targettype==QuVal_Target_Wizard && ctmp->target==ctmp->caster) { strcpy(smallbuf, "at "); strcat(smallbuf, pro_himself(self->wiz[ctmp->caster]->gender)); } else { switch (ctmp->targettype) { case QuVal_Target_Wizard: mtarget = (union being *)self->wiz[ctmp->target]; break; case QuVal_Target_Creature: mtarget = (union being *)&(self->cre[ctmp->target]); break; default: mtarget = NULL; break; } sprintf(smallbuf, "at %s", mtarget->both.name); } break; } if (ctmp->spellnum == SP__STAB) sprintf(exbuf, "%s stabs (%s) %s.\n", self->wiz[ctmp->caster]->name, handage, smallbuf); else sprintf(exbuf, "%s casts %s%s (%s) %s.\n", self->wiz[ctmp->caster]->name, ((ctmp->permanent)?"Permanent ":""), spelllist[ctmp->spellnum].name, handage, smallbuf); PrintMsg(exbuf); } /* CLEAR ROUND DATA */ self->fl_icestorm = 0; self->fl_firestorm = 0; self->fl_dispelmagic = 0; for (ix=0; ixnumplayers; ix++) clear_round(self->wiz[ix]); for (ix=0; ixnumcres; ix++) clear_round(&self->cre[ix]); /* check DISPEL MAGIC, MAGIC MIRROR, COUNTER_SPELL */ for (ctmp = self->castlist; ctmp; ctmp = ctmp->next) { switch (ctmp->targettype) { case QuVal_Target_Wizard: mtarget = (union being *)self->wiz[ctmp->target]; break; case QuVal_Target_Creature: mtarget = (union being *)&(self->cre[ctmp->target]); break; default: mtarget = NULL; break; } mcaster = self->wiz[ctmp->caster]; /* convert counter_spell2 to counter_spell */ if (ctmp->spellnum==SP__COUNTER_SPELL2) ctmp->spellnum = SP__COUNTER_SPELL; if (ctmp->spellnum==SP__DISPEL_MAGIC) { if (check_visibility(self, mcaster, mtarget, ctmp)) { self->fl_dispelmagic = 1; set_zap_flag(self, ctmp, SP__SHIELD); /* auto-shield */ } } else if (ctmp->spellnum==SP__COUNTER_SPELL) { if (check_visibility(self, mcaster, mtarget, ctmp)) { set_zap_flag(self, ctmp, SP__COUNTER_SPELL); } } else if (ctmp->spellnum==SP__MAGIC_MIRROR) { if (check_visibility(self, mcaster, mtarget, ctmp)) { set_zap_flag(self, ctmp, SP__MAGIC_MIRROR); } } } if (self->fl_dispelmagic) PrintMsg("The magical energies in the arena fade away.\n"); /* EXECUTE DISPEL MAGIC, MAGIC MIRROR, COUNTER_SPELL : all beings and corpses. This sets the zapl[] for those spells. */ for (ix=0; ixnumplayers; ix++) { exec_counters(self, self->wiz[ix], ix, 1); } for (ix=0; ixnumcres; ix++) { exec_counters(self, &self->cre[ix], ix, 0); } /* set up spell tables */ for (ctmp = self->castlist; ctmp; ctmp = ctmp->next) { switch (ctmp->targettype) { case QuVal_Target_Wizard: mtarget = (union being *)self->wiz[ctmp->target]; break; case QuVal_Target_Creature: mtarget = (union being *)&(self->cre[ctmp->target]); break; default: mtarget = NULL; break; } mcaster = self->wiz[ctmp->caster]; switch (ctmp->spellnum) { case SP__SHIELD: case SP__REMOVE_ENCHANTMENT: case SP__RAISE_DEAD: case SP__CURE_LIGHT_WOUNDS: case SP__CURE_HEAVY_WOUNDS: case SP__SUMMON_GOBLIN: case SP__SUMMON_OGRE: case SP__SUMMON_TROLL: case SP__SUMMON_GIANT: case SP__SUMMON_ELEMENTAL: case SP__PROTECTION_FROM_EVIL: case SP__RESIST_HEAT: case SP__RESIST_COLD: case SP__INVISIBILITY: case SP__HASTE: case SP__TIME_STOP: case SP__DELAYED_EFFECT: case SP__PERMANENCY: /* spells not affected by magic mirror */ /* check for dispel magic */ if (self->fl_dispelmagic) { sprintf(exbuf, "The %s is dispelled.\n", spelllist[ctmp->spellnum].name); PrintMsg(exbuf); break; } if (!mtarget) { /* up in air, or (shouldn't happen) area-effect */ break; } /* sight check */ if (!check_visibility(self, mcaster, mtarget, ctmp)) { break; } /* check for counterspell */ if (mtarget->both.zaplist[SP__COUNTER_SPELL]) { sprintf(exbuf, "The %s is destroyed by your Counter-Spell.\n", spelllist[ctmp->spellnum].name); sprintf(exbuf2, "The %s is destroyed by the Counter-Spell around %s.\n", spelllist[ctmp->spellnum].name, mtarget->both.name); if (ctmp->targettype==QuVal_Target_Wizard) PrintMsg2(ctmp->target, exbuf, exbuf2); else PrintMsg(exbuf2); break; } set_zap_flag(self, ctmp, -1); break; case SP__STAB: /* not affected by magic mirror or dispel magic */ if (!mtarget) { /* up in air, or (shouldn't happen) area-effect */ break; } /* sight check */ if (!check_visibility(self, mcaster, mtarget, ctmp)) { break; } set_zap_flag(self, ctmp, -1); break; case SP__MISSILE: case SP__FINGER_OF_DEATH: case SP__LIGHTNING_BOLT: case SP__LIGHTNING_BOLT2: case SP__CAUSE_LIGHT_WOUNDS: case SP__CAUSE_HEAVY_WOUNDS: case SP__FIREBALL: case SP__AMNESIA: case SP__CONFUSION: case SP__CHARM_PERSON: case SP__CHARM_MONSTER: case SP__PARALYSIS: case SP__FEAR: case SP__ANTI_SPELL: case SP__DISEASE: case SP__POISON: case SP__BLINDNESS: /* spells affected by magic mirror */ /* check for repeat of short lightning bolt */ if (ctmp->spellnum==SP__LIGHTNING_BOLT2) { if (!mcaster->fl_cast_lightning) { mcaster->fl_cast_lightning = 1; ctmp->spellnum = SP__LIGHTNING_BOLT; } else { sprintf(exbuf2, "%s's Lightning Bolt fizzles.\n", mcaster->name); PrintMsg2(ctmp->caster, "Since you have already cast Lightning Bolt with that formulation, the spell fizzles.\n", exbuf2); break; } } /* check for dispel magic */ if (self->fl_dispelmagic) { sprintf(exbuf, "The %s is dispelled.\n", spelllist[ctmp->spellnum].name); PrintMsg(exbuf); break; } if (!mtarget) { /* up in air, or (shouldn't happen) area-effect */ break; } /* sight check */ if (!check_visibility(self, mcaster, mtarget, ctmp)) { break; } /* check for counterspell */ if (ctmp->spellnum != SP__FINGER_OF_DEATH) { if (mtarget->both.zaplist[SP__COUNTER_SPELL]) { sprintf(exbuf, "The %s is destroyed by your Counter-Spell.\n", spelllist[ctmp->spellnum].name); sprintf(exbuf2, "The %s is destroyed by the Counter-Spell around %s.\n", spelllist[ctmp->spellnum].name, mtarget->both.name); if (ctmp->targettype==QuVal_Target_Wizard) PrintMsg2(ctmp->target, exbuf, exbuf2); else PrintMsg(exbuf2); break; } } ix = mtarget->both.zaplist[SP__MAGIC_MIRROR]; /* if the caster is the target, ignore magic mirror. */ if (ix && ((union being *)mcaster!=mtarget)) { /* magic mirror -- terrific */ /* we assume that the caster is a wizard. */ /* check to see if caster has mirror too */ if (mcaster->zaplist[SP__MAGIC_MIRROR]) { sprintf(exbuf, "Your %s is reflected back and forth between %s's Magic Mirror and your own! It rapidly decays and dissipates.\n", spelllist[ctmp->spellnum].name, mtarget->both.name); sprintf(exbuf2, "%s's %s is reflected back and forth between your Magic Mirror and %s own! It rapidly decays and dissipates.\n", mcaster->name, spelllist[ctmp->spellnum].name, pro_his(mcaster->gender)); sprintf(exbuf3, "%s's %s is reflected back and forth between %s's Magic Mirror and %s own! It rapidly decays and dissipates.\n", mcaster->name, spelllist[ctmp->spellnum].name, mtarget->both.name, pro_his(mcaster->gender)); if (ctmp->targettype==QuVal_Target_Wizard) PrintMsg3(ctmp->caster, ctmp->target, exbuf, exbuf2, exbuf3); else PrintMsg2(ctmp->caster, exbuf, exbuf3); break; /* spell is lost */ } sprintf(exbuf, "Your %s is reflected from %s's Magic Mirror back at you.\n", spelllist[ctmp->spellnum].name, mtarget->both.name); sprintf(exbuf2, "%s's %s reflects from your Magic Mirror back at %s.\n", mcaster->name, spelllist[ctmp->spellnum].name, pro_him(mcaster->gender)); sprintf(exbuf3, "%s's %s reflects from %s's Magic Mirror back at %s.\n", mcaster->name, spelllist[ctmp->spellnum].name, mtarget->both.name, pro_him(mcaster->gender)); if (ctmp->targettype==QuVal_Target_Wizard) PrintMsg3(ctmp->caster, ctmp->target, exbuf, exbuf2, exbuf3); else PrintMsg2(ctmp->caster, exbuf, exbuf3); /* reverse spell */ ix = ctmp->caster; if (ctmp->targettype==QuVal_Target_Wizard) ctmp->caster = ctmp->target; else ctmp->caster = (-1); ctmp->targettype = QuVal_Target_Wizard; ctmp->target = ix; /* now, check AGAIN for counterspell */ if (ctmp->spellnum != SP__FINGER_OF_DEATH) { if (mcaster->zaplist[SP__COUNTER_SPELL]) { sprintf(exbuf, "The reflected %s is destroyed by your Counter-Spell.\n", spelllist[ctmp->spellnum].name); sprintf(exbuf2, "The reflected %s is destroyed by the Counter-Spell around %s.\n", spelllist[ctmp->spellnum].name, mcaster->name); if (ctmp->targettype==QuVal_Target_Wizard) PrintMsg2(ctmp->target, exbuf, exbuf2); else PrintMsg(exbuf2); break; } } set_zap_flag(self, ctmp, -1); } else { set_zap_flag(self, ctmp, -1); } break; case SP__ICE_STORM: /* area-effect spell; mtarget is NULL */ /* check for dispel magic */ if (self->fl_dispelmagic) { sprintf(exbuf, "The %s is dispelled.\n", spelllist[ctmp->spellnum].name); PrintMsg(exbuf); break; } self->fl_icestorm++; break; case SP__FIRE_STORM: /* area-effect spell; mtarget is NULL */ /* check for dispel magic */ if (self->fl_dispelmagic) { sprintf(exbuf, "The %s is dispelled.\n", spelllist[ctmp->spellnum].name); PrintMsg(exbuf); break; } self->fl_firestorm++; break; case SP__SURRENDER: PrintMsg("ERROR: Surrender got through to spell table setup\n"); break; case SP__COUNTER_SPELL: case SP__COUNTER_SPELL2: case SP__DISPEL_MAGIC: case SP__MAGIC_MIRROR: /* already taken care of */ break; default: PrintMsg("ERROR: Unknown spell in spell table setup\n"); break; } } /* before summoning, do any queries for elemental type. */ erase_queries(self); for (ix=0; ixnumplayers; ix++) if (self->wiz[ix]->alive) { for (jx=0; jxwiz[ix]->zaplist[SP__SUMMON_ELEMENTAL]; jx++) { add_query(self, ix, Qu_ElementalType, 0); } } if (self->numqueries) Queries(self->numqueries, self->querylist); /* SUMMON SPELLS : live wizards */ summonelq = 0; /* counter for queries */ for (ix=0; ixnumplayers; ix++) { if (self->wiz[ix]->alive) exec_summons(self, self->wiz[ix], ix, 1); } /* CHECK FOR ELEMENTAL / STORM CANCELS */ check_elements(self); /* CHECK FOR CANCELS : live beings */ for (ix=0; ixnumplayers; ix++) { if (self->wiz[ix]->alive) exec_cancels(self, self->wiz[ix], ix, 1); } for (ix=0; ixnumcres; ix++) { if (self->cre[ix].alive) exec_cancels(self, &self->cre[ix], ix, 0); } /* CHECK FOR PROTECTS : live beings */ for (ix=0; ixnumplayers; ix++) { if (self->wiz[ix]->alive) exec_protects(self, self->wiz[ix], ix, 1); } for (ix=0; ixnumcres; ix++) { if (self->cre[ix].alive) exec_protects(self, &self->cre[ix], ix, 0); } /* CHECK FOR ENCHANTMENTS : live beings */ for (ix=0; ixnumplayers; ix++) { if (self->wiz[ix]->alive) exec_enchants(self, self->wiz[ix], ix, 1); } for (ix=0; ixnumcres; ix++) { if (self->cre[ix].alive) exec_enchants(self, &self->cre[ix], ix, 0); } /* DAMAGE SPELLS : live beings */ for (ix=0; ixnumplayers; ix++) { if (self->wiz[ix]->alive) exec_attacks(self, self->wiz[ix], ix, 1); } for (ix=0; ixnumcres; ix++) { if (self->cre[ix].alive) exec_attacks(self, &self->cre[ix], ix, 0); } /* HEALING SPELLS : all beings */ for (ix=0; ixnumplayers; ix++) { exec_heals(self, self->wiz[ix], ix, 1); } for (ix=0; ixnumcres; ix++) { exec_heals(self, &self->cre[ix], ix, 0); } } static void exec_counters(self, fred, cnum, wizflag) /* dead allowed */ struct realgame *self; union being *fred; int cnum; int wizflag; { struct castspell *ctmp, **pt; int ix, jx, wiznum; int *zapl; zapl = fred->both.zaplist; /*{ for (jx=0; jxboth.name); }*/ if (self->fl_dispelmagic) { /* dispel magic in effect: neutralize counter_spells and magic mirrors */ if (zapl[SP__COUNTER_SPELL]) { zapl[SP__COUNTER_SPELL] = 0; sprintf(exbuf, "The Counter-Spell on %s is dispelled.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Counter-Spell on you is dispelled.\n", exbuf); else PrintMsg(exbuf); } if (zapl[SP__MAGIC_MIRROR]) { zapl[SP__MAGIC_MIRROR] = 0; sprintf(exbuf, "The Magic Mirror on %s is dispelled.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Magic Mirror on you is dispelled.\n", exbuf); else PrintMsg(exbuf); } if (!wizflag) { struct creature *cre = (struct creature *)fred; if (cre->alive) { sprintf(exbuf, "The Dispel Magic starts to tear %s apart.\n", cre->name); PrintMsg(exbuf); cre->hitpoints = (-100); cre->nocorpse = 1; } else if (!cre->nocorpse) { sprintf(exbuf, "The corpse of %s disintegrates, destroyed by the Dispel Magic.\n", cre->name); PrintMsg(exbuf); cre->nocorpse = 1; } } } else { /* no dispel magic */ if (zapl[SP__COUNTER_SPELL]) { zapl[SP__SHIELD]++; /* auto-shield */ sprintf(exbuf, "A Counter-Spell flares around %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "Your magical senses go numb as a Counter-Spell surrounds you.\n", exbuf); else PrintMsg(exbuf); if (zapl[SP__MAGIC_MIRROR]) { /* counterspell beats mirror */ zapl[SP__MAGIC_MIRROR] = 0; sprintf(exbuf, "The Magic Mirror on %s is destroyed by the Counter-Spell.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Magic Mirror on you is destroyed by the Counter-Spell.\n", exbuf); else PrintMsg(exbuf); } } if (zapl[SP__MAGIC_MIRROR]) { sprintf(exbuf, "A Magic Mirror swirls around %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The bright haze of a Magic Mirror surrounds you.\n", exbuf); else PrintMsg(exbuf); } } } static void exec_summons(self, fred, cnum, wizflag) /* no deaders or monsters */ struct realgame *self; union being *fred; int cnum; int wizflag; { int ix, jx, spelnum; int *zapl = fred->both.zaplist; char *elm; /* counterspell, dispel magic, magic mirror have already been taken care of. */ static int summonspells[4] = {SP__SUMMON_GOBLIN, SP__SUMMON_OGRE, SP__SUMMON_TROLL, SP__SUMMON_GIANT}; static char *summonnames[4] = {"Goblin", "Ogre", "Troll", "Giant"}; for (ix=0; ix<4; ix++) { spelnum = summonspells[ix]; if (zapl[spelnum]) { if (zapl[spelnum]==1) { sprintf(exbuf, "Your %s materializes by your side.\n", summonnames[ix]); sprintf(exbuf2, "%s's %s appears by %s side.\n", fred->both.name, summonnames[ix], pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } else { sprintf(exbuf, "Your %s %ss materialize by your side.\n", number_name(zapl[spelnum]), summonnames[ix]); sprintf(exbuf2, "%s's %s %ss appear by %s side.\n", fred->both.name, number_name(zapl[spelnum]), summonnames[ix], pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } for (jx=0; jxwiz[cnum]->zaplist[SP__SUMMON_ELEMENTAL]; jx++) { ix = self->querylist[summonelq].answer; /* 0 fire, 1 ice */ summonelq++; if (!ix) { sprintf(exbuf, "A blazing Fire Elemental materializes above you.\n"); sprintf(exbuf2, "A blazing Fire Elemental materializes above %s.\n", fred->both.name); } else { sprintf(exbuf, "A glittering Ice Elemental materializes above you.\n"); sprintf(exbuf2, "A glittering Ice Elemental materializes above %s.\n", fred->both.name); } if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); create_creature(self, 6-ix, cnum); } } /* actually, check for cancellation of creatures for any cause. */ static void check_elements(self) struct realgame *self; { int num_fire, num_ice, firel, icel; int ix, nukit; int *zapl; num_fire = 0; num_ice = 0; for (ix=0; ixnumcres; ix++) if (self->cre[ix].alive) { if (self->cre[ix].type==Creature_FIREL) { num_fire++; if (num_fire == 1) { firel = ix; } else { self->cre[firel].hitpoints = 3; /* max strength */ self->cre[ix].nocorpse = 1; self->cre[ix].alive = 0; } } if (self->cre[ix].type==Creature_ICEL) { num_ice++; if (num_ice == 1) { icel = ix; } else { self->cre[icel].hitpoints = 3; /* max strength */ self->cre[ix].nocorpse = 1; self->cre[ix].alive = 0; } } } if (num_fire>1) { sprintf(exbuf, "The %s Fire Elementals merge into single raging form.\n", number_name(num_fire)); PrintMsg(exbuf); } if (num_ice>1) { sprintf(exbuf, "The %s Ice Elementals merge into single whirling form.\n", number_name(num_ice)); PrintMsg(exbuf); } ix = (num_fire ? 1 : 0) | (num_ice ? 2 : 0) | (self->fl_firestorm ? 4 : 0) | (self->fl_icestorm ? 8 : 0); switch (ix) { case 5: /* 0101 */ PrintMsg("The Fire Elemental is dispersed into the Fire Storm.\n"); self->cre[firel].nocorpse = 1; self->cre[firel].alive = 0; break; case 10: /* 1010 */ PrintMsg("The Ice Elemental is dispersed into the Ice Storm.\n"); self->cre[icel].nocorpse = 1; self->cre[icel].alive = 0; break; case 12: /* 1100 */ PrintMsg("The Fire and Ice Storms tear each other into shreds of vapor.\n"); self->fl_firestorm = 0; self->fl_icestorm = 0; break; case 3: /* 0011 */ PrintMsg("The Fire and Ice Elementals tear into each other, and whirl into a column of steam that dissipates in moments.\n"); self->cre[firel].nocorpse = 1; self->cre[firel].alive = 0; self->cre[icel].nocorpse = 1; self->cre[icel].alive = 0; break; case 6: /* 0110 */ PrintMsg("The Ice Elemental is dispersed into the Fire Storm, destroying both.\n"); self->cre[icel].nocorpse = 1; self->cre[icel].alive = 0; self->fl_firestorm = 0; break; case 9: /* 1001 */ PrintMsg("The Fire Elemental is dispersed into the Ice Storm, destroying both.\n"); self->cre[firel].nocorpse = 1; self->cre[firel].alive = 0; self->fl_icestorm = 0; break; case 13: /* 1101 */ PrintMsg("The Fire and Ice Storms tear each other into shreds of vapor, destroying the Fire Elemental as well.\n"); self->cre[firel].nocorpse = 1; self->cre[firel].alive = 0; self->fl_firestorm = 0; self->fl_icestorm = 0; break; case 14: /* 1110 */ PrintMsg("The Fire and Ice Storms tear each other into shreds of vapor, destroying the Ice Elemental as well.\n"); self->cre[icel].nocorpse = 1; self->cre[icel].alive = 0; self->fl_firestorm = 0; self->fl_icestorm = 0; break; case 11: /* 1011 */ PrintMsg("The Fire and Ice Elementals tear into each other, and whirl into a column of steam that dissipates in moments. The Ice Storm is absorbed as well.\n"); self->cre[firel].nocorpse = 1; self->cre[firel].alive = 0; self->cre[icel].nocorpse = 1; self->cre[icel].alive = 0; self->fl_icestorm = 0; break; case 7: /* 0111 */ PrintMsg("The Fire and Ice Elementals tear into each other, and whirl into a column of steam that dissipates in moments. The Fire Storm is absorbed as well.\n"); self->cre[firel].nocorpse = 1; self->cre[firel].alive = 0; self->cre[icel].nocorpse = 1; self->cre[icel].alive = 0; self->fl_firestorm = 0; break; case 15: /* 1111 */ PrintMsg("The Fire and Ice Elementals whirl into each other, screaming in fury, and the Fire and Ice storms shriek in response. The column of Elemental energy rises to meet the cloud of vapor that descends over the arena. You are buffeted by the conflicting energies; but within moments, nothing remains.\n"); self->cre[firel].nocorpse = 1; self->cre[firel].alive = 0; self->cre[icel].nocorpse = 1; self->cre[icel].alive = 0; self->fl_icestorm = 0; self->fl_firestorm = 0; break; } for (ix=0; ixnumcres; ix++) if (self->cre[ix].alive) { zapl = self->cre[ix].zaplist; nukit = 0; if (self->cre[ix].type==Creature_FIREL) { if (!nukit && zapl[SP__RESIST_HEAT]) { sprintf(exbuf, "%s gutters and flickers out under the influence of the Resist Heat.\n", self->cre[ix].name); PrintMsg(exbuf); nukit = 1; } } if (self->cre[ix].type==Creature_ICEL) { if (!nukit && zapl[SP__RESIST_COLD]) { sprintf(exbuf, "%s melts away under the influence of the Resist Cold.\n", self->cre[ix].name); PrintMsg(exbuf); nukit = 1; } if (!nukit && zapl[SP__FIREBALL]) { sprintf(exbuf, "%s is vaporized by the Fireball.\n", self->cre[ix].name); PrintMsg(exbuf); nukit = 1; } } if (!nukit && zapl[SP__BLINDNESS]) { sprintf(exbuf, "Under the stress of the Blindness, %s shivers and disintegrates into random energies.\n", self->cre[ix].name); PrintMsg(exbuf); nukit = 1; } if (!nukit && zapl[SP__INVISIBILITY]) { sprintf(exbuf, "Under the stress of the Invisibility, %s shivers and disintegrates into random energies.\n", self->cre[ix].name); PrintMsg(exbuf); nukit = 1; } if (nukit) { self->cre[ix].alive = 0; self->cre[ix].nocorpse = 1; } /* dispel magic was taken care of earlier */ if (self->cre[ix].alive && zapl[SP__REMOVE_ENCHANTMENT]) { sprintf(exbuf, "The Remove Enchantment starts to tear %s apart.\n", self->cre[ix].name); PrintMsg(exbuf); self->cre[ix].hitpoints = (-100); self->cre[ix].nocorpse = 1; } } } static void exec_cancels(self, fred, cnum, wizflag) /* no deaders */ struct realgame *self; union being *fred; int cnum; int wizflag; { int ix; int *zapl = fred->both.zaplist; struct permstats *perm = &(fred->both.perm); /* counterspell, dispel magic, magic mirror have already been taken care of. */ if (zapl[SP__RAISE_DEAD] && zapl[SP__FINGER_OF_DEATH]) { sprintf(exbuf2, "The Finger of Death and Raise Dead spells aimed at %s cancel each other.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "For a moment, you feel a sudden pressure in your chest, as if an iron band was squeezing your heart. Then it fades, as the Raise Dead spell burns through you.\n", exbuf2); else PrintMsg(exbuf2); zapl[SP__RAISE_DEAD]=0; zapl[SP__FINGER_OF_DEATH]=0; } if (zapl[SP__FIREBALL] && self->fl_icestorm) { sprintf(exbuf2, "The Fireball hurtling towards %s is snuffed by the Ice Storm, leaving %s enveloped in a cloud of steam.\n", fred->both.name, pro_him(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "The Fireball hurtling towards you is snuffed by the Ice Storm, leaving you enveloped in warm steam.\n", exbuf2); else PrintMsg(exbuf2); zapl[SP__FIREBALL]=0; fred->both.fl_resist_icestorm = 1; } ix = (zapl[SP__AMNESIA] ? 1 : 0) + (zapl[SP__CONFUSION] ? 1 : 0) + (zapl[SP__CHARM_PERSON] ? 1 : 0) + (zapl[SP__CHARM_MONSTER] ? 1 : 0) + (zapl[SP__PARALYSIS] ? 1 : 0) + (zapl[SP__FEAR] ? 1 : 0); if (ix>1 || (zapl[SP__PARALYSIS]>1 && (wizflag && fred->wiz.hand_paralyzed==(-1))) || zapl[SP__CHARM_PERSON]>1 || zapl[SP__CHARM_MONSTER]>1) { /* all mind spells cancel. */ list_mind_spells(exbuf3, zapl); sprintf(exbuf, "The mind-control spells (%s) aimed at you interfere with each other and fizzle, leaving you with a pounding headache.\n", exbuf3); sprintf(exbuf2, "The mind-control spells (%s) aimed at %s interfere with each other and fizzle.\n", exbuf3, fred->both.name); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); zapl[SP__AMNESIA] = 0; zapl[SP__CONFUSION] = 0; zapl[SP__CHARM_PERSON] = 0; zapl[SP__CHARM_MONSTER] = 0; zapl[SP__PARALYSIS] = 0; zapl[SP__FEAR] = 0; fred->both.enchant_ppend = 0; } /* now only a legal set of mind spells remain, and at most one control spell, whose caster is in enchant_caster. (Which may be -1, if the spell mirrored off a creature.) */ } static void exec_protects(self, fred, cnum, wizflag) /* no deaders */ struct realgame *self; union being *fred; int cnum; int wizflag; { int *zapl = fred->both.zaplist; struct permstats *perm = &(fred->both.perm); /* counterspell, dispel magic, magic mirror have already been taken care of. */ /* don't bother checking permanency -- it doesn't change anything */ if (zapl[SP__RESIST_HEAT]) { if (!fred->both.resistant_heat) { sprintf(exbuf2, "The Resist Heat shrouds %s in a cool blue veil.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Resist Heat wraps you in a pleasant blue coolness.\n", exbuf2); else PrintMsg(exbuf2); fred->both.resistant_heat = 1; } else { sprintf(exbuf2, "%s's veil of Resist Heat continues to glow coolly.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "Your veil of Resist Heat continues to glow coolly.\n", exbuf2); else PrintMsg(exbuf2); } } /* don't bother checking permanency -- it doesn't change anything */ if (zapl[SP__RESIST_COLD]) { if (!fred->both.resistant_cold) { sprintf(exbuf2, "The Resist Cold shrouds %s in a warm pink veil.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Resist Cold wraps you in a pleasant pink warmth.\n", exbuf2); else PrintMsg(exbuf2); fred->both.resistant_cold = 1; } else { sprintf(exbuf2, "%s's veil of Resist Cold continues to glow warmly.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "Your veil of Resist Cold continues to glow warmly.\n", exbuf2); else PrintMsg(exbuf2); } } if (zapl[SP__PROTECTION_FROM_EVIL] || perm->fl_prot_evil) { if (!fred->both.prot_from_evil) { sprintf(exbuf, "A white circle of Protection from Evil springs up around you. You feel the Shield aura cloaking your skin.\n"); sprintf(exbuf2, "A white circle of Protection from Evil springs up around %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } else { sprintf(exbuf, "Your circle of Protection from Evil flares back to full strength.\n"); sprintf(exbuf2, "%s's circle of Protection from Evil flares back to full strength.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } fred->both.prot_from_evil = 4; } if (!(self->turntype==Turn_TIMESTOP && fred->both.timestop!=1)) { fred->both.fl_resist_heat = (fred->both.resistant_heat); fred->both.fl_resist_cold = (fred->both.resistant_cold); if (fred->both.prot_from_evil>0) { int doit = 1; switch (fred->both.prot_from_evil) { case 4: default: doit = 0; /*sprintf(exbuf, "Your circle of Protection from Evil is still glowing strongly.\n"); sprintf(exbuf2, "%s's circle of Protection from Evil is still glowing strongly.\n", fred->both.name);*/ break; case 3: sprintf(exbuf, "Your circle of Protection from Evil is beginning to fade.\n"); sprintf(exbuf2, "%s's circle of Protection from Evil is beginning to fade.\n", fred->both.name); break; case 2: sprintf(exbuf, "Your circle of Protection from Evil is dimmer now.\n"); sprintf(exbuf2, "%s's circle of Protection from Evil is dimmer now.\n", fred->both.name); break; case 1: sprintf(exbuf, "Your circle of Protection from Evil is nearly gone.\n"); sprintf(exbuf2, "%s's circle of Protection from Evil is nearly gone.\n", fred->both.name); break; } if (doit) if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); fred->both.prot_from_evil--; zapl[SP__SHIELD] += 64; /* auto-shield, special mark */ } } else { /* the protections are timestopped and have no effect. */ } } spellcast-1.0/execute2.c100644 2756 144 75555 5515617557 13510 0ustar benusers#include #include #include "handwave.h" #include "internal.h" extern char exbuf[2048], exbuf2[2048]; extern char *number_name(); void exec_enchants(self, fred, cnum, wizflag) /* no deaders */ struct realgame *self; union being *fred; int cnum; int wizflag; { int handnum; int *zapl = fred->both.zaplist; struct permstats *perm = &(fred->both.perm); /* counterspell, dispel magic, magic mirror have already been taken care of. */ if (zapl[SP__AMNESIA]) { fred->both.mind_spell = SP__AMNESIA; /* fred->both.mind_caster = unused */ if (fred->both.enchant_ppend) perm->mind_spell = SP__AMNESIA; sprintf(exbuf2, "The Amnesia spell curls around %s's mind.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Amnesia spell curls around your mind.\n", exbuf2); else PrintMsg(exbuf2); } if (zapl[SP__CONFUSION]) { fred->both.mind_spell = SP__CONFUSION; fred->both.mind_caster = 0; if (fred->both.enchant_ppend) { perm->mind_spell = SP__CONFUSION; perm->mind_detail = (-1); fred->both.mind_caster = 1; } sprintf(exbuf2, "The Confusion spell curls around %s's mind.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Confusion spell curls around your mind.\n", exbuf2); else PrintMsg(exbuf2); } if (zapl[SP__FEAR]) { fred->both.mind_spell = SP__FEAR; /* fred->both.mind_caster = unused */ if (fred->both.enchant_ppend) perm->mind_spell = SP__FEAR; sprintf(exbuf2, "The Fear spell curls around %s's mind.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Fear spell curls around your mind.\n", exbuf2); else PrintMsg(exbuf2); } if (zapl[SP__PARALYSIS]) { if (wizflag) { /* cast on a wizard */ if (fred->both.enchant_caster == (-1)) { sprintf(exbuf2, "Not knowing which of %s's hands to strike, the Paralysis spell fizzles.\n", fred->both.name); PrintMsg2(cnum, "Not knowing which of your hands to strike, the Paralysis spell fizzles.\n", exbuf2); } else { fred->both.mind_spell = SP__PARALYSIS; if (fred->wiz.hand_paralyzed==(-1)) { erase_queries(self); add_query(self, fred->both.enchant_caster, Qu_ParalysisHand, cnum); Queries(self->numqueries, self->querylist); handnum = self->querylist[0].answer; } else handnum = fred->wiz.hand_paralyzed; fred->both.mind_caster = handnum; if (fred->both.enchant_ppend) { perm->mind_spell = SP__PARALYSIS; perm->mind_detail = handnum; } sprintf(exbuf, "The Paralysis spell curls around your %s hand.\n", (handnum?"right":"left")); sprintf(exbuf2, "The Paralysis spell curls around %s's %s hand.\n", fred->both.name, (handnum?"right":"left")); PrintMsg2(cnum, exbuf, exbuf2); } } else { /* cast on a monster */ fred->both.mind_spell = SP__PARALYSIS; /* fred->both.mind_caster = unused */ if (fred->both.enchant_ppend) perm->mind_spell = SP__PARALYSIS; sprintf(exbuf2, "The Paralysis spell curls around %s's mind.\n", fred->both.name); PrintMsg(exbuf2); } } if (zapl[SP__CHARM_MONSTER]) { if (wizflag) { /* cast on a wizard */ sprintf(exbuf2, "The Charm Monster spell swirls around %s's mind, but cannot sink in.\n", fred->both.name); PrintMsg2(cnum, "The Charm Monster spell swirls around your mind, but cannot sink in.\n", exbuf2); } else { /* cast on a monster */ if (fred->both.enchant_caster == (-1)) { sprintf(exbuf, "The Charm Monster spell strikes %s, and then seems to freeze. Referees stomp into the arena and glare at the spell. Then they glare at each other. Then they glare at the spell again. They huddle together, muttering and glowering. Eventually they pick the spell up bodily and carry it off the field.\n", fred->both.name); PrintMsg(exbuf); } else { fred->both.mind_spell = SP__CHARM_MONSTER; fred->both.mind_caster = fred->both.enchant_caster; if (fred->both.enchant_ppend) { perm->mind_spell = SP__CHARM_MONSTER; perm->mind_detail = fred->both.enchant_caster; } fred->cre.owner = fred->both.enchant_caster; sprintf(exbuf2, "The Charm Monster spell curls around %s, and %s smiles dopily at %s.\n", fred->both.name, pro_he(fred->both.gender), self->wiz[fred->cre.owner]->name); PrintMsg(exbuf2); } } } if (zapl[SP__CHARM_PERSON]) { if (wizflag) { /* cast on a wizard */ if (fred->both.enchant_caster == (-1)) { sprintf(exbuf2, "Not knowing which of %s's hands to strike, the Charm Person spell fizzles.\n", fred->both.name); PrintMsg2(cnum, "Not knowing which of your hands to strike, the Charm Person spell fizzles.\n", exbuf2); } else { fred->both.mind_spell = SP__CHARM_PERSON; erase_queries(self); add_query(self, fred->both.enchant_caster, Qu_CharmHand, cnum); Queries(self->numqueries, self->querylist); handnum = self->querylist[0].answer; fred->both.mind_caster = fred->both.enchant_caster + 128*handnum; if (fred->both.enchant_ppend) { perm->mind_spell = SP__CHARM_PERSON; perm->mind_detail = (-1); fred->both.mind_caster |= 1024; } sprintf(exbuf, "The Charm Person spell curls around your %s hand.\n", (handnum?"right":"left")); sprintf(exbuf2, "The Charm Person spell curls around %s's %s hand.\n", fred->both.name, (handnum?"right":"left")); PrintMsg2(cnum, exbuf, exbuf2); } } else { /* cast on a monster */ sprintf(exbuf2, "The Charm Person spell swirls around %s's mind, but cannot sink in.\n", fred->both.name); PrintMsg(exbuf2); } } /* do PERMANENT spells */ if (fred->both.mind_spell == (-1)) { switch (perm->mind_spell) { case SP__AMNESIA: fred->both.mind_spell = SP__AMNESIA; sprintf(exbuf2, "%s is still afflicted with Amnesia.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "You are still afflicted with Amnesia.\n", exbuf2); else PrintMsg(exbuf2); break; case SP__FEAR: fred->both.mind_spell = SP__FEAR; sprintf(exbuf2, "%s is still afflicted with Fear.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "You are still afflicted with Fear.\n", exbuf2); else PrintMsg(exbuf2); break; case SP__CHARM_MONSTER: if (!wizflag) { fred->both.mind_spell = SP__CHARM_MONSTER; fred->both.mind_caster = perm->mind_detail; fred->cre.owner = perm->mind_detail; sprintf(exbuf2, "%s is still enamoured of %s.\n", fred->both.name, self->wiz[fred->cre.owner]->name); PrintMsg(exbuf2); } break; case SP__CONFUSION: fred->both.mind_spell = SP__CONFUSION; fred->both.mind_caster = 1; sprintf(exbuf2, "%s is still afflicted with Confusion.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "You are still afflicted with Confusion.\n", exbuf2); else PrintMsg(exbuf2); break; case SP__CHARM_PERSON: if (wizflag) { fred->both.mind_spell = SP__CHARM_PERSON; fred->both.mind_caster = 1024; sprintf(exbuf2, "%s is still Charmed.\n", fred->both.name); PrintMsg2(cnum, "You are still Charmed.\n", exbuf2); } break; case SP__PARALYSIS: fred->both.mind_spell = SP__PARALYSIS; fred->both.mind_caster = perm->mind_detail; if (wizflag) { sprintf(exbuf2, "%s's %s hand is still Paralyzed.\n", fred->both.name, ((perm->mind_detail)?"right":"left")); sprintf(exbuf, "Your %s hand is still Paralyzed.\n", ((perm->mind_detail)?"right":"left")); PrintMsg2(cnum, exbuf, exbuf2); } else { sprintf(exbuf2, "%s is still afflicted with Paralysis.\n", fred->both.name); PrintMsg(exbuf2); } break; case (-1): /* no permanent mind spell */ break; default: printf("ERROR: unknown perm->mind_spell %d\n", perm->mind_spell); break; } } if (zapl[SP__DISEASE]) { if (fred->both.disease_time == (-1)) { /* not yet diseased */ fred->both.disease_time = 6; sprintf(exbuf2, "%s sneezes loudly.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "You sneeze loudly.\n", exbuf2); else PrintMsg(exbuf2); } } if (zapl[SP__POISON]) { if (fred->both.poison_time == (-1)) { /* not yet poisoned */ fred->both.poison_time = 6; sprintf(exbuf2, "%s suddenly looks somewhat pale.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "A flash of pain lances along your bones, and then fades away.\n", exbuf2); else PrintMsg(exbuf2); } } if (zapl[SP__ANTI_SPELL]) { if (zapl[SP__REMOVE_ENCHANTMENT]) { /* cancelled */ sprintf(exbuf2, "The Anti-Spell fizzes away into nothing as it approaches %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Anti-Spell fizzes away into nothing as it approaches you.\n", exbuf2); else PrintMsg(exbuf2); } else { if (!wizflag) { sprintf(exbuf, "The Anti-Spell whizzes through %s without any effect.\n", fred->both.name); PrintMsg(exbuf); } else { struct wizard *wiz = &(fred->wiz); sprintf(exbuf2, "The Anti-Spell jolts %s, causing the magical energies around %s hands to flicker.\n", wiz->name, pro_his(wiz->gender)); PrintMsg2(cnum, "The Anti-Spell jolts you, interrupting the flow of magical energy in your hands.\n", exbuf2); write_gestures(self, wiz, Gesture_ANTISPELL, Gesture_ANTISPELL); } } } if (zapl[SP__DELAYED_EFFECT]) { if (zapl[SP__REMOVE_ENCHANTMENT]) { /* cancelled */ sprintf(exbuf2, "The Delayed Effect fizzes away into nothing as it approaches %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Delayed Effect fizzes away into nothing as it approaches you.\n", exbuf2); else PrintMsg(exbuf2); } else { if (!wizflag) { sprintf(exbuf, "The Delayed Effect whizzes through %s without any effect.\n", fred->both.name); PrintMsg(exbuf); } else { struct wizard *wiz = &(fred->wiz); sprintf(exbuf2, "The Delayed Effect spreads out around %s.\n", wiz->name); PrintMsg2(cnum, "The Delayed Effect spreads out in a cloud around you, waiting for you to complete a spell.\n", exbuf2); wiz->delay_time = 4; } } } if (zapl[SP__PERMANENCY]) { if (zapl[SP__REMOVE_ENCHANTMENT]) { /* cancelled */ sprintf(exbuf2, "The Permanency fizzes away into nothing as it approaches %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Permanency fizzes away into nothing as it approaches you.\n", exbuf2); else PrintMsg(exbuf2); } else { if (!wizflag) { sprintf(exbuf, "The Permanency whizzes through %s without any effect.\n", fred->both.name); PrintMsg(exbuf); } else { struct wizard *wiz = &(fred->wiz); sprintf(exbuf2, "The Permanency spreads out around %s.\n", wiz->name); PrintMsg2(cnum, "The Permanency spreads out in a cloud around you, waiting for you to complete a spell.\n", exbuf2); wiz->perm_time = 4; } } } if (zapl[SP__BLINDNESS] || perm->fl_blindness) { if (fred->both.blindness == 0) { /* not yet blind */ sprintf(exbuf2, "%s blinks, then stumbles slightly as %s eyes turn milky.\n", fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "A haze suddenly appears before your eyes. The world dims rapidly, and you are shortly enveloped in total darkness.\n", exbuf2); else PrintMsg(exbuf2); fred->both.blindness = 4; } else { sprintf(exbuf2, "%s is still blind.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "You are still blind.\n", exbuf2); else PrintMsg(exbuf2); fred->both.blindness = 4; } } if (fred->both.blindness) { fred->both.blindness--; if (fred->both.blindness==0) { sprintf(exbuf2, "The milky cast fades from %s's eyes.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The dark veil falls away from your eyes.\n", exbuf2); else PrintMsg(exbuf2); } } if (zapl[SP__INVISIBILITY] || perm->fl_invisibility) { if (fred->both.invisibility == 0) { /* not yet invisible */ sprintf(exbuf2, "%s turns quietly translucent, and fades from view.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The world becomes strangely misted in front of your eyes. Looking down, you see that your hands are no longer visible.\n", exbuf2); else PrintMsg(exbuf2); fred->both.invisibility = 4; } else { sprintf(exbuf2, "%s is still invisible.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "You are still invisible.\n", exbuf2); else PrintMsg(exbuf2); fred->both.invisibility = 4; } } if (fred->both.invisibility) { fred->both.invisibility--; if (fred->both.invisibility==0) { sprintf(exbuf2, "A %s-shaped shadow appears, and %s rapidly becomes fully visible.\n", fred->both.name, pro_he(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "Your limbs have become visible again.\n", exbuf2); else PrintMsg(exbuf2); } } if (zapl[SP__HASTE] || perm->fl_haste) { if (fred->both.haste == 0) { /* not yet hasted */ fred->both.haste = 5; } else { fred->both.haste = 4; } } if (zapl[SP__TIME_STOP]) { fred->both.timestop = 2; /* no message -- that's done later */ } if (zapl[SP__REMOVE_ENCHANTMENT] || self->fl_dispelmagic) { /* remove enchantments is obviously last. takes out mind_* also, and nowm_* for monsters. */ if (zapl[SP__REMOVE_ENCHANTMENT]) { sprintf(exbuf2, "The Remove Enchantment whirls its dissipative energies around %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Remove Enchantment whirls its dissipative energies around you.\n", exbuf2); else PrintMsg(exbuf2); } if (fred->both.mind_spell != (-1)) { sprintf(exbuf, "You are freed of the %s.\n", spelllist[fred->both.mind_spell].name); sprintf(exbuf2, "%s is freed of the %s.\n", fred->both.name, spelllist[fred->both.mind_spell].name); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); fred->both.mind_spell = (-1); } if (!wizflag) { struct creature *thud = &(fred->cre); if (thud->nowm_spell != (-1)) { sprintf(exbuf2, "%s is freed of the %s.\n", thud->name, spelllist[thud->nowm_spell].name); PrintMsg(exbuf2); thud->nowm_spell = (-1); } } if (fred->both.resistant_heat) { sprintf(exbuf, "Your blue aura of Resist Heat fades away.\n"); sprintf(exbuf2, "%s's blue aura of Resist Heat fades away.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } fred->both.resistant_heat = 0; fred->both.fl_resist_heat = 0; if (fred->both.resistant_cold) { sprintf(exbuf, "Your pink aura of Resist Cold fades away.\n"); sprintf(exbuf2, "%s's pink aura of Resist Cold fades away.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } fred->both.resistant_cold = 0; fred->both.fl_resist_cold = 0; if (fred->both.disease_time != (-1)) { sprintf(exbuf2, "%s seems to have stopped shivering, and %s skin is no longer flushed and damp.\n", fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "Your fever suddenly abates. You feel much better.\n", exbuf2); else PrintMsg(exbuf2); fred->both.disease_time = (-1); } if (fred->both.poison_time != (-1)) { sprintf(exbuf2, "%s's color improves dramatically.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The numbness and heaviness falls from your limbs. You feel much better.\n", exbuf2); else PrintMsg(exbuf2); fred->both.poison_time = (-1); } if (wizflag) { if (fred->wiz.delay_time != 0) { sprintf(exbuf2, "The Delayed Effect spell hovering around %s disintegrates.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Delayed Effect spell hovering around you disintegrates.\n", exbuf2); else PrintMsg(exbuf2); fred->wiz.delay_time = 0; } /* and kill any banked spell */ if (fred->wiz.delay_bank != (-1)) { sprintf(exbuf, "The %s spell that you had caught in a Delayed Effect is lost.\n", spelllist[fred->wiz.delay_bank].name); sprintf(exbuf2, "The %s spell that %s had caught in a Delayed Effect is lost.\n", spelllist[fred->wiz.delay_bank].name, fred->wiz.name); PrintMsg2(cnum, exbuf, exbuf2); fred->wiz.delay_bank = (-1); } } if (wizflag) { if (fred->wiz.perm_time != 0) { sprintf(exbuf2, "The Permanency spell hovering around %s disintegrates.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Permanency spell hovering around you disintegrates.\n", exbuf2); else PrintMsg(exbuf2); fred->wiz.perm_time = 0; } } if (fred->both.prot_from_evil) { sprintf(exbuf2, "%s's circle of Protection flickers out.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "Your circle of Protection flickers out.\n", exbuf2); else PrintMsg(exbuf2); fred->both.prot_from_evil = 0; } if (fred->both.zaplist[SP__SHIELD] >= 64) { fred->both.zaplist[SP__SHIELD] -= 64; } if (fred->both.haste) { if (fred->both.haste!=5) { sprintf(exbuf, "%s slows down to normal speed.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "Everyone comes back up to normal speed.\n", exbuf); else PrintMsg(exbuf); } else { sprintf(exbuf, "The Haste on %s is nulled.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Haste on you is nulled.\n", exbuf); else PrintMsg(exbuf); } fred->both.haste = 0; } if (fred->both.timestop) { sprintf(exbuf, "The Time Stop on %s is nulled.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Time Stop on you is nulled.\n", exbuf); else PrintMsg(exbuf); fred->both.timestop = 0; } if (fred->both.invisibility) { sprintf(exbuf2, "%s becomes visible again, rather suddenly.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "Your body tingles and becomes visible again.\n", exbuf2); else PrintMsg(exbuf2); fred->both.invisibility = 0; } if (fred->both.blindness) { sprintf(exbuf2, "%s's eyes abruptly clear.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "Sight bursts in upon you again.\n", exbuf2); else PrintMsg(exbuf2); fred->both.blindness = 0; } clear_permstats(&(fred->both.perm)); } } void exec_attacks(self, fred, cnum, wizflag) /* no deaders */ struct realgame *self; union being *fred; int cnum; int wizflag; { int *zapl = fred->both.zaplist; /* counterspell, dispel magic, magic mirror have already been taken care of. */ if (zapl[SP__STAB]) { if (zapl[SP__SHIELD]) { /* shield protects */ if (zapl[SP__STAB]==1) { sprintf(exbuf2, "The knife slides off of %s's Shield.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The knife slides off of your Shield.\n", exbuf2); else PrintMsg(exbuf2); } else { sprintf(exbuf2, "The knives slide off of %s's Shield.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The knives slide off of your Shield.\n", exbuf2); else PrintMsg(exbuf2); } } else { /* hit */ if (zapl[SP__STAB]==1) { sprintf(exbuf2, "The knife strikes %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The knife strikes you.\n", exbuf2); else PrintMsg(exbuf2); } else { sprintf(exbuf, "The %s knives strike you.\n", number_name(zapl[SP__STAB])); sprintf(exbuf2, "The %s knives strike %s.\n", number_name(zapl[SP__STAB]), fred->both.name); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } fred->both.hitpoints -= 1*zapl[SP__STAB]; } } if (zapl[SP__MISSILE]) { if (zapl[SP__SHIELD]) { /* shield protects */ if (zapl[SP__MISSILE]==1) { sprintf(exbuf2, "The Missile shatters on %s's Shield.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Missile shatters on your Shield.\n", exbuf2); else PrintMsg(exbuf2); } else { sprintf(exbuf2, "The Missiles shatter on %s's Shield.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Missiles shatter on your Shield.\n", exbuf2); else PrintMsg(exbuf2); } } else { /* hit */ if (zapl[SP__MISSILE]==1) { sprintf(exbuf2, "The Missile strikes %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Missile strikes you.\n", exbuf2); else PrintMsg(exbuf2); } else { sprintf(exbuf, "The %s Missiles strike you.\n", number_name(zapl[SP__MISSILE])); sprintf(exbuf2, "The %s Missiles strike %s.\n", number_name(zapl[SP__MISSILE]), fred->both.name); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } fred->both.hitpoints -= 1*zapl[SP__MISSILE]; } } if (zapl[SP__CAUSE_LIGHT_WOUNDS]) { /* hit */ if (zapl[SP__CAUSE_LIGHT_WOUNDS]==1) { sprintf(exbuf2, "The Cause Light Wounds spell tears into %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Cause Light Wounds spell tears into you.\n", exbuf2); else PrintMsg(exbuf2); } else { sprintf(exbuf, "The %s Cause Light Wounds spells tear into you.\n", number_name(zapl[SP__CAUSE_LIGHT_WOUNDS])); sprintf(exbuf2, "The %s Cause Light Wounds spells tear into %s.\n", number_name(zapl[SP__CAUSE_LIGHT_WOUNDS]), fred->both.name); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } fred->both.hitpoints -= 2*zapl[SP__CAUSE_LIGHT_WOUNDS]; } if (zapl[SP__CAUSE_HEAVY_WOUNDS]) { /* hit */ if (zapl[SP__CAUSE_HEAVY_WOUNDS]==1) { sprintf(exbuf2, "The Cause Heavy Wounds spell tears into %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Cause Heavy Wounds spell tears painfully into you.\n", exbuf2); else PrintMsg(exbuf2); } else { sprintf(exbuf, "The %s Cause Heavy Wounds spells tear painfully into you.\n", number_name(zapl[SP__CAUSE_HEAVY_WOUNDS])); sprintf(exbuf2, "The %s Cause Heavy Wounds spells tear into %s.\n", number_name(zapl[SP__CAUSE_HEAVY_WOUNDS]), fred->both.name); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } fred->both.hitpoints -= 3*zapl[SP__CAUSE_HEAVY_WOUNDS]; } if (zapl[SP__LIGHTNING_BOLT]) { /* hit */ if (zapl[SP__LIGHTNING_BOLT]==1) { sprintf(exbuf2, "The Lightning Bolt staggers %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Lightning Bolt strikes you, staggering and nearly deafening you.\n", exbuf2); else PrintMsg(exbuf2); } else { sprintf(exbuf, "The %s Lightning Bolts crash into you; the concussions nearly knock you off your feet.\n", number_name(zapl[SP__LIGHTNING_BOLT])); sprintf(exbuf2, "The %s Lightning Bolts strike %s, staggering %s.\n", number_name(zapl[SP__LIGHTNING_BOLT]), fred->both.name, pro_him(fred->both.gender)); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } fred->both.hitpoints -= 5*zapl[SP__LIGHTNING_BOLT]; } if (zapl[SP__FIREBALL]) { if (fred->both.fl_resist_heat) { /* heat-resistant */ if (zapl[SP__FIREBALL]==1) { sprintf(exbuf2, "The Fireball strikes %s, but the flames slide off %s Resist Heat aura.\n", fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "The Fireball strikes you, but you feel only a slight warmth.\n", exbuf2); else PrintMsg(exbuf2); } else { sprintf(exbuf2, "The Fireballs strike %s, but the flames slide off %s Resist Heat aura.\n", fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "The Fireballs strike you, but you feel only a slight warmth.\n", exbuf2); else PrintMsg(exbuf2); } } else { /* hit */ if (zapl[SP__FIREBALL]==1) { sprintf(exbuf2, "The Fireball strikes %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Fireball strikes you with a roar of flame.\n", exbuf2); else PrintMsg(exbuf2); } else { sprintf(exbuf, "The %s Fireballs blast into you, surrounding you with blinding flame.\n", number_name(zapl[SP__FIREBALL])); sprintf(exbuf2, "The %s Fireballs strike %s.\n", number_name(zapl[SP__FIREBALL]), fred->both.name); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } fred->both.hitpoints -= 5*zapl[SP__FIREBALL]; } } if (self->fl_firestorm) { if (zapl[SP__COUNTER_SPELL]) { /* counterspelled */ sprintf(exbuf2, "The Counter-Spell around %s cancels the Fire Storm near %s.\n", fred->both.name, pro_him(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "The Counter-Spell cancels the Fire Storm in your vicinity.\n", exbuf2); else PrintMsg(exbuf2); } else if (fred->both.fl_resist_heat) { /* heat-resistant */ sprintf(exbuf2, "The Fire Storm washes over %s, who remains unharmed inside %s blue aura.\n", fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "The Fire Storm washes over you, but you feel only a gentle warmth.\n", exbuf2); else PrintMsg(exbuf2); } else { /* hit */ sprintf(exbuf2, "The Fire Storm washes over %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Fire Storm washes over you.\n", exbuf2); else PrintMsg(exbuf2); fred->both.hitpoints -= 5; } } if (self->fl_icestorm) { if (zapl[SP__COUNTER_SPELL]) { /* counterspelled */ sprintf(exbuf2, "The Counter-Spell around %s cancels the Ice Storm near %s.\n", fred->both.name, pro_him(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "The Counter-Spell cancels the Ice Storm in your vicinity.\n", exbuf2); else PrintMsg(exbuf2); } else if (fred->both.fl_resist_icestorm) { /* resistant due to fireball hit -- message already printed */ } else if (fred->both.fl_resist_cold) { /* cold-resistant */ sprintf(exbuf2, "The Ice Storm washes over %s, who remains unharmed inside %s pink aura.\n", fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "The Ice Storm washes over you, but you feel only a gentle coolness.\n", exbuf2); else PrintMsg(exbuf2); } else { /* hit */ sprintf(exbuf2, "The Ice Storm lashes at %s.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "The Ice Storm lashes at you.\n", exbuf2); else PrintMsg(exbuf2); fred->both.hitpoints -= 5; } } if (zapl[SP__FINGER_OF_DEATH]) { /* hit */ sprintf(exbuf2, "%s turns very pale and drops to %s knees, clutching at %s chest....\n", fred->both.name, pro_his(fred->both.gender), pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "You feel a sudden pressure in your chest, as if an iron band was squeezing your heart. You fall to your knees as the world dims....\n", exbuf2); else PrintMsg(exbuf2); fred->both.hitpoints = (-100); } } void exec_heals(self, fred, cnum, wizflag) /* deaders ARE allowed */ struct realgame *self; union being *fred; int cnum; int wizflag; { int *zapl = fred->both.zaplist; int orighp; /* counterspell, dispel magic, magic mirror have already been taken care of. */ if (fred->both.alive) { orighp = fred->both.hitpoints; if (zapl[SP__CURE_LIGHT_WOUNDS]) { if (zapl[SP__CURE_LIGHT_WOUNDS]==1) { sprintf(exbuf2, "The Cure Light Wounds spell weaves around %s, and %s wounds fade.\n", fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "The Cure Light Wounds spell weaves around you, and the pain of your wounds lessens.\n", exbuf2); else PrintMsg(exbuf2); } else { sprintf(exbuf, "The %s Cure Light Wounds spells weave around you, and the pain of your wounds lessens.\n", number_name(zapl[SP__CURE_LIGHT_WOUNDS])); sprintf(exbuf2, "The %s Cure Light Wounds spells weave around %s, and %s wounds fade.\n", number_name(zapl[SP__CURE_LIGHT_WOUNDS]), fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } fred->both.hitpoints += 1*zapl[SP__CURE_LIGHT_WOUNDS]; } if (zapl[SP__CURE_HEAVY_WOUNDS]) { if (zapl[SP__CURE_HEAVY_WOUNDS]==1) { sprintf(exbuf2, "The Cure Heavy Wounds spell weaves around %s, and %s wounds heal.\n", fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "The Cure Heavy Wounds spell weaves around you, and your wounds heal considerably.\n", exbuf2); else PrintMsg(exbuf2); } else { sprintf(exbuf, "The %s Cure Heavy Wounds spells weave around you, and your wounds heal considerably.\n", number_name(zapl[SP__CURE_HEAVY_WOUNDS])); sprintf(exbuf2, "The %s Cure Heavy Wounds spells weave around %s, and %s wounds heal.\n", number_name(zapl[SP__CURE_HEAVY_WOUNDS]), fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } fred->both.hitpoints += 2*zapl[SP__CURE_HEAVY_WOUNDS]; /* cure disease (not poison) */ if (fred->both.disease_time != (-1)) { sprintf(exbuf2, "%s seems to have stopped shivering, and %s skin is no longer flushed and damp.\n", fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "Your fever suddenly abates. You feel much better.\n", exbuf2); else PrintMsg(exbuf2); fred->both.disease_time = (-1); } } if (zapl[SP__RAISE_DEAD]) { if (zapl[SP__RAISE_DEAD]==1) { sprintf(exbuf2, "The Raise Dead spell burns through %s. Although %s is not dead, the spell has a powerful healing effect.\n", fred->both.name, pro_he(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "The Raise Dead spell burns through you. Although you aren't dead, the spell has a powerful healing influence.\n", exbuf2); else PrintMsg(exbuf2); } else { sprintf(exbuf, "The %s Raise Dead spells burn through you. Although you aren't dead, the spells have a powerful healing influence.\n", number_name(zapl[SP__RAISE_DEAD])); sprintf(exbuf2, "The %s Raise Dead spells burn through %s. Although %s is not dead, the spells have a powerful healing effect.\n", number_name(zapl[SP__RAISE_DEAD]), fred->both.name, pro_he(fred->both.gender)); if (wizflag) PrintMsg2(cnum, exbuf, exbuf2); else PrintMsg(exbuf2); } fred->both.hitpoints += 5*zapl[SP__RAISE_DEAD]; } if ((fred->both.hitpoints > fred->both.max_hitpoints) || (fred->both.hitpoints == fred->both.max_hitpoints && fred->both.hitpoints != orighp)) { fred->both.hitpoints = fred->both.max_hitpoints; sprintf(exbuf2, "%s is in perfect health again.\n", fred->both.name); if (wizflag) PrintMsg2(cnum, "You are in perfect health again.\n", exbuf2); else PrintMsg(exbuf2); } } else { /* not alive */ if (zapl[SP__RAISE_DEAD]) { sprintf(exbuf2, "%s twitches, glows, and then jumps to %s feet! Except for a bit of incipient mold, %s is in perfect health again.\n", fred->both.name, pro_his(fred->both.gender), pro_he(fred->both.gender)); if (wizflag) PrintMsg2(cnum, "You are suddenly aware of a blast of energy running down every nerve! This is something of a shock, since you had just gotten used to being dead. Oh, well -- you'll be back eventually.\n", exbuf2); else PrintMsg(exbuf2); fred->both.alive = 1; fred->both.hitpoints = fred->both.max_hitpoints; clear_out_spells(fred, wizflag); if (!wizflag) { fred->cre.nocorpse = 0; fred->cre.owner = fred->both.raisedead_caster; } else { } } } } spellcast-1.0/Makefile100644 2756 144 5446 5515617606 13223 0ustar benusers# These three lines define the fonts that spellcast tries to use by default; # it looks for FONT1 first, then FONT2, then FONT3. (If a user sets # his spellcast*font resource, that is tried first, instead of FONT1.) # You can change these to suit your environment. FONT1 = \"-*-times-medium-r-*--14-*\" FONT2 = \"-*-helvetica-medium-r-*--12-*\" FONT3 = \"fixed\" # The next line defines the directory in which game transcripts are # stored. It should be a fully-qualified pathname, beginning (but # not ending) with a slash. LOGDIR = \"/tmp\" # The next lines define the directories where the executable, man page, and # spell list postscript file are installed. Change them to whatever is appropriate. DESTDIR=/afs/andrew.cmu.edu/usr0/games DESTBIN=$(DESTDIR)/bin/.unpriv/@sys DESTMAN=$(DESTDIR)/man/man6 DESTLIB=$(DESTDIR)/lib/spellcast # If you are compiling on a Sun and you find the game crashes # all the time, try uncommenting the next line. #OTHERLIBS = -lbsdmalloc CFLAGS = -g -I/usr/local/include -I./bitmaps -DBODYFONT=$(FONT1) \ -DBODYFONT_ALT=$(FONT2) -DBODYFONT_ALT2=$(FONT3) -DTRANSCRIPTDIR=$(LOGDIR) LFLAGS = -g XLIB = -L/usr/local/lib -lX11 OBJS = engine.o espells.o execute.o execute2.o emonster.o etran.o XOBJS = main.o xtext.o xquery.o xloop.o xgest.o xbutton.o xtalk.o all: spellcast # spellcast: the X executable spellcast: $(OBJS) $(XOBJS) $(CC) $(LFLAGS) -o spellcast $(OBJS) $(XOBJS) $(XLIB) $(OTHERLIBS) # stupid: the stupid stdin/stdout version of the game stupid: stupid.o $(OBJS) $(CC) $(LFLAGS) -o spellcast stupid.o $(OBJS) # makelist: a small program used to create spelllist.ps, which you # shouldn't have to use, because spelllist.ps is already there. makelist: makelist.o espells.o $(CC) $(LFLAGS) -o makelist makelist.o espells.o install: spellcast install -c -s spellcast $(DESTBIN) install -c spellcast.6 $(DESTMAN) -mkdir $(DESTLIB) install -c spelllist.ps $(DESTLIB) main.o: handwave.h spelllist.h xspell.h patchlevel.h xtext.o: handwave.h spelllist.h xspell.h xquery.o: handwave.h spelllist.h xspell.h xloop.o: handwave.h spelllist.h xspell.h xgest.o: handwave.h spelllist.h xspell.h xbutton.o: handwave.h spelllist.h xspell.h xtalk.o: handwave.h spelllist.h xspell.h internal.h: spelllist.h engine.o: handwave.h spelllist.h internal.h espells.o: handwave.h spelllist.h internal.h execute.o: handwave.h spelllist.h internal.h execute2.o: handwave.h spelllist.h internal.h emonster.o: handwave.h spelllist.h internal.h etran.o: handwave.h spelllist.h internal.h stupid.o: stupid.c handwave.h spelllist.h # The following rule creates the spelllist.ps document, # but you shouldn't have to use it, because it's already # there. spelllist.ps: makelist bitmaps/base.ps ./makelist > tmp.ps cat bitmaps/base.ps tmp.ps > spelllist.ps clean: rm -f *~ *.o spellcast stupid makelist tmp.ps core spellcast-1.0/README100644 2756 144 3622 5731611467 12434 0ustar benusersSpellcast is a strange little strategy game, which I found on the Net and have implemented for X. Basically, two or more players try to vaporize each other with a wide assortment of wizardly spells. For the complete rules, see the man page (spellcast.6), which goes into exhaustive detail. Compiling should be straightforward; spellcast uses only Xlib, with no widget sets or other libraries. NOTE: Some (all?) versions of SunOS have a buggy realloc(), which causes spellcast to crash early and often. If you're on a Sparc and you have this problem, the fix is to compile with -lbsdmalloc. Uncomment the OTHERLIBS line in the Makefile. The Makefile begins with a few definitions which you can change: the directories where everything gets installed; the default fonts that the program tries to load (usually times 14, helvetica 12, and fixed, in that order); the directory in which game transcripts are stored (usually /tmp.) Type "make" or "make spellcast" to create the executable. "make stupid" will create a version of the game with a terribly stupid, text-only interface -- this is not very playable, and is really only good for testing. You enter all the players' moves in a single string at the prompt, and answer questions as they appear. The file spelllist.ps is a PostScript document showing all the available spells, in two columns: one sorted by gesture, and one sorted by name. By default, it will be installed as DESTDIR/lib/spellcast/spelllist.ps. The original paper-and-pencil version of this game was created by Richard Bartle (76703.3042@compuserve.com). This implementation is by Andrew Plotkin (ap1i+@andrew.cmu.edu). It is copyright 1993 by Andrew Plotkin. The source code may be freely copied, distributed, and modified, as long as this copyright notice is retained. The source code and any derivative works may not be sold for profit without the permission of Andrew Plotkin and Richard Bartle. spellcast-1.0/xloop.c100644 2756 144 26755 5515617611 13112 0ustar benusers#include #include #include #include #include #include "handwave.h" #include "spelllist.h" #include "xspell.h" extern void redraw(), redraw_stats(), redraw_queries(), redraw_buttons(), redraw_text(), redraw_column(); extern int gesture_hit(); void redraw_stats_only(), update_statlist(); void redraw_done_markers(); int blinklevel; /* in tenths of a second */ void mainloop() { int pnum; XEvent event; int gotit, gotround; struct player *py; fd_set readbits; int numsocks, sock; int doneloop = 0; char c; struct timeval startround, now, pausetime; blinklevel = 0; for (pnum=0; pnumgotexpose = 1; redraw(py); break; case KeyPress: if (1 == XLookupString(&event, &c, 1, NULL, NULL)) { switch (c) { case '\014': /* Ctrl-L */ XClearArea(py->dpy, py->win, 0, 0, 0, 0, 1); break; default: talk_handle_char(py, c); } } break; case ButtonPress: if (py->mousestate != ms_None) { break; } if (in_gesture_box(py, event.xbutton.x, event.xbutton.y)) { py->mousestate = gesture_hit(py, event.xbutton.x, event.xbutton.y, event.xbutton.button); py->mousebutton = event.xbutton.button; } else if (in_bbox_box(py, event.xbutton.x, event.xbutton.y)) { py->mousestate = button_hit(py, event.xbutton.x, event.xbutton.y, event.xbutton.button); py->mousebutton = event.xbutton.button; } else if (in_scrollbar_box(&(py->sitext), event.xbutton.x, event.xbutton.y)) { py->mousestate = scrollbar_hit(&(py->sitext), event.xbutton.x, event.xbutton.y, event.xbutton.button); py->mousebutton = event.xbutton.button; } else if (in_scrollbar_box(&(py->siquery), event.xbutton.x, event.xbutton.y)) { py->mousestate = scrollbar_hit(&(py->siquery), event.xbutton.x, event.xbutton.y, event.xbutton.button); py->mousebutton = event.xbutton.button; } else if (in_scrollbar_box(&(py->sistats), event.xbutton.x, event.xbutton.y)) { py->mousestate = scrollbar_hit(&(py->sistats), event.xbutton.x, event.xbutton.y, event.xbutton.button); py->mousebutton = event.xbutton.button; } else if (in_query_box(py, event.xbutton.x, event.xbutton.y)) { py->mousestate = query_hit(py, event.xbutton.x, event.xbutton.y, event.xbutton.button); py->mousebutton = event.xbutton.button; } else { py->mousestate = ms_None; } break; case MotionNotify: switch (py->mousestate) { case ms_Gesture: gesture_motion(py, event.xbutton.x, event.xbutton.y, event.xbutton.button); break; case ms_Scroll: scrollbar_motion(py->scroll_active, event.xbutton.x, event.xbutton.y, event.xbutton.button); break; case ms_Query: query_motion(py, event.xbutton.x, event.xbutton.y, event.xbutton.button); break; case ms_DoneBtn: case ms_SpellBtn: button_motion(py, event.xbutton.x, event.xbutton.y, event.xbutton.button); break; default: break; } break; case ButtonRelease: if (py->mousebutton == event.xbutton.button) { switch (py->mousestate) { case ms_Gesture: gesture_release(py, event.xbutton.x, event.xbutton.y, event.xbutton.button); break; case ms_Scroll: scrollbar_release(py->scroll_active, event.xbutton.x, event.xbutton.y, event.xbutton.button); break; case ms_Query: query_release(py, event.xbutton.x, event.xbutton.y, event.xbutton.button); break; case ms_DoneBtn: case ms_SpellBtn: button_release(py, event.xbutton.x, event.xbutton.y, event.xbutton.button); break; default: break; } py->mousestate = ms_None; } break; default: break; } } } doneloop = 1; for (pnum=0; pnum blinklevel) { blinklevel = sofar; for (pnum=0; pnum players[pnum].turn_blinklimit) { players[pnum].turn_blinked = 1; redraw_done_markers(&(players[pnum])); } } } if (!gotround && !doneloop) { /* no events -- wait a while */ FD_ZERO(&readbits); numsocks = 0; for (pnum=0; pnum numsocks) numsocks = sock+1; FD_SET(sock, &readbits); XFlush(players[pnum].dpy); } pausetime.tv_sec = 0; pausetime.tv_usec = 200000; /* 1/5th of a second */ (void)select(numsocks, &readbits, 0, 0, &pausetime); } } } void redraw(py) struct player *py; { redraw_text(py); redraw_column(py); redraw_buttons(py); redraw_queries(py); redraw_stats(py); redraw_talk(py); if (py->backstore) switch (py->mousestate) { case ms_Gesture: draw_gesture_menu(py); break; case ms_SpellBtn: draw_spelllist(py); break; case ms_Query: draw_query_menu(py); break; default: break; } } #define STATS_X (476) #define STATS_Y (449) #define STATS_W (324) #define STATS_H (104) #define STATS_HP (244) void init_stats(py) struct player *py; { py->statlist_size = 4; py->statlist = (struct statthing *)malloc(sizeof(struct statthing) * py->statlist_size); py->sistats.nlines = 0; py->sistats.visible = (STATS_H-2) / py->lineheight; py->sistats.py = py; py->sistats.top = 0; py->sistats.lineheight = py->lineheight; py->sistats.x = STATS_X; py->sistats.y = STATS_Y; py->sistats.h = STATS_H; py->sistats.redraw = redraw_stats_only; } void clear_stats(py) struct player *py; { py->sistats.nlines = 0; py->sistats.top = 0; } void add_statthing(py, index, type, hp, stuff) struct player *py; int index, type; int hp; long stuff; { int num; if (py->sistats.nlines >= py->statlist_size) { while (py->sistats.nlines >= py->statlist_size) py->statlist_size *= 2; py->statlist = (struct statthing *)realloc(py->statlist, sizeof(struct statthing) * py->statlist_size); } num = py->sistats.nlines; py->sistats.nlines++; py->statlist[num].index = index; py->statlist[num].type = type; py->statlist[num].hp = hp; py->statlist[num].stuff = stuff; } #define DRAWSTAR(py) ((py)->turn_active ? (py)->turn_done : (py)->turn_blinked) void redraw_done_markers(pdone) struct player *pdone; { int pnum, pdonenum; int ix, qline; int ypos; struct player *py; pdonenum = (pdone-players); for (pnum=0; pnumsistats.visible; ix++) { qline = py->sistats.top + ix; if (qline >= py->sistats.nlines) break; if (py->statlist[qline].type == QuVal_Target_Wizard && py->statlist[qline].index == pdonenum) break; } if (ixsistats.visible && !(qline >= py->sistats.nlines)) { ypos = STATS_Y+ix*py->lineheight+py->lineheight; py->gotexpose = 1; if (!py->backstore) { if (DRAWSTAR(pdone)) { DrawStringField(py, "*", STATS_X+4, ypos, 12); } else { DrawStringField(py, " ", STATS_X+4, ypos, 12); } } } } } void redraw_stats_only(py, baronly) struct player *py; int baronly; { int ix, qline; int ypos; struct statthing *st; char sbuf[32]; struct player *other; if (!baronly) { for (ix=0; ixsistats.visible; ix++) { qline = py->sistats.top + ix; if (qline<0) continue; ypos = STATS_Y+ix*py->lineheight+py->lineheight; if (qline >= py->sistats.nlines) { DrawStringField(py, "", STATS_X+4, ypos, STATS_W-4); } else { st = &(py->statlist[qline]); if (st->type==QuVal_Target_Wizard) { other = &(players[st->index]); if (DRAWSTAR(other)) { DrawStringField(py, "*", STATS_X+4, ypos, 12); } else { DrawStringField(py, " ", STATS_X+4, ypos, 12); } DrawStringField(py, NameOfBeing(gameval, st->type, st->index), STATS_X+16, ypos, STATS_W-16); } else { DrawStringField(py, "", STATS_X+4, ypos, 20); DrawStringField(py, NameOfBeing(gameval, st->type, st->index), STATS_X+24, ypos, STATS_W-24); } sprintf(sbuf, "%d %s%s%s%s%s%s%s", st->hp, (st->stuff & Stuff_INVISIBLE) ? "I" : "", (st->stuff & Stuff_RESIST_HEAT) ? "H" : "", (st->stuff & Stuff_RESIST_COLD) ? "C" : "", (st->stuff & Stuff_PROTECT_EVIL) ? "P" : "", (st->stuff & Stuff_BLIND) ? "b" : "", (st->stuff & Stuff_DISEASE) ? "d" : "", (st->stuff & Stuff_POISON) ? "p" : ""); DrawStringField(py, sbuf, STATS_X+STATS_HP, ypos, STATS_W-STATS_HP); } } } redraw_scrollbar(&(py->sistats)); } void redraw_stats(py) struct player *py; { int ix; XDrawRectangle(py->dpy, py->win, py->blackgc, STATS_X-3, STATS_Y-2, STATS_W+4, STATS_H+3); XDrawRectangle(py->dpy, py->win, py->blackgc, STATS_X-SCROLL_W, STATS_Y-2, SCROLL_W-3, STATS_H+3); redraw_stats_only(py, 0); } static int statthing_pnum; int statthing_compare(st1, st2) struct statthing *st1, *st2; { int own1, own2; if (st1->type==QuVal_Target_Wizard) own1 = st1->index; else own1 = OwnerOfCreature(gameval, st1->index); if (st2->type==QuVal_Target_Wizard) own2 = st2->index; else own2 = OwnerOfCreature(gameval, st2->index); if (own1 != own2) { if (own1==(-1)) own1 = (-300); else if (own1 == statthing_pnum) own1 = (-200); if (own2==(-1)) own2 = (-300); else if (own2 == statthing_pnum) own2 = (-200); return (own1 - own2); } if (st1->type==QuVal_Target_Wizard && st2->type==QuVal_Target_Wizard) return (0); if (st1->type==QuVal_Target_Wizard) return (-100); if (st2->type==QuVal_Target_Wizard) return (100); return (st1->index - st2->index); } void update_statlist(py) struct player *py; { int ix, max, hp; long stuff; clear_stats(py); max = NumberOfBeings(gameval, QuVal_Target_Wizard); for (ix=0; ix=0) add_statthing(py, ix, QuVal_Target_Wizard, hp, stuff); } max = NumberOfBeings(gameval, QuVal_Target_Creature); for (ix=0; ix=0) add_statthing(py, ix, QuVal_Target_Creature, hp, stuff); } statthing_pnum = py-players; qsort(py->statlist, py->sistats.nlines, sizeof(struct statthing), statthing_compare); redraw_stats_only(py, 0); } spellcast-1.0/bitmaps/ 40755 2756 144 0 5731610647 13112 5ustar benusersspellcast-1.0/bitmaps/sw2.bm100644 2756 144 424 5515617377 14231 0ustar benusers#define sw2_width 16 #define sw2_height 16 #define sw2_x_hot -1 #define sw2_y_hot -1 static char sw2_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x06,0x30,0x0c,0x3c,0x3c, 0x1e,0x78,0x0f,0xf0,0x07,0xe0,0x07,0xe0,0x1f,0xf8,0x3e,0x7c, 0x7c,0x3e,0x78,0x1e,0xf8,0x1f,0xfc,0x3f}; spellcast-1.0/bitmaps/sdot.bm100644 2756 144 477 5515617404 14466 0ustar benusers#define sdot_width 16 #define sdot_height 16 #define sdot_x_hot -1 #define sdot_y_hot -1 static char sdot_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; spellcast-1.0/bitmaps/bvp.bm100644 2756 144 3051 5515617413 14313 0ustar benusers#define bvp_width 48 #define bvp_height 48 #define bvp_x_hot -1 #define bvp_y_hot -1 static char bvp_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0xf0, 0x03,0x00,0x80,0x01,0x00,0xc0,0x03,0x00,0xc0,0x01,0x00,0xc0, 0x01,0x00,0xc6,0x03,0x00,0x80,0x01,0x00,0xc7,0x03,0x00,0x80, 0x01,0x00,0xcf,0x03,0x00,0x80,0x01,0x00,0xcf,0x63,0x00,0x80, 0x01,0x00,0xcf,0xe3,0x00,0x80,0x01,0x00,0xcf,0xf3,0x00,0x80, 0x01,0x00,0xcf,0xf3,0x00,0x80,0x01,0x00,0xcf,0xf3,0x00,0x80, 0x01,0x00,0xcf,0xf3,0x00,0x80,0x01,0x00,0xcf,0xf3,0x00,0x80, 0x01,0x00,0xcf,0xf3,0x00,0x80,0x01,0x00,0xcf,0xf3,0x00,0x80, 0x01,0x00,0xcf,0xf3,0x08,0x80,0x01,0x00,0xcf,0xf3,0x1c,0x80, 0x01,0x00,0xcf,0xf3,0x1c,0x80,0x01,0x00,0xcf,0xf3,0x1c,0x80, 0x01,0x00,0xcf,0xf3,0x1c,0x80,0xc1,0x00,0xef,0xf3,0x3c,0x80, 0xc1,0x01,0xff,0xf7,0x3d,0x80,0xc1,0x01,0xff,0xff,0x3d,0x80, 0xc1,0x03,0xff,0xff,0x3d,0x80,0xc1,0x03,0xff,0xff,0x3d,0x80, 0xc1,0x87,0xff,0xff,0x3f,0x80,0xc1,0x87,0xff,0xff,0x3f,0x80, 0x81,0x8f,0xff,0xff,0x3f,0x80,0x81,0x9f,0xff,0xff,0x3f,0x80, 0x81,0xbf,0xff,0xff,0x3f,0x80,0x81,0xff,0xff,0xff,0x3f,0x80, 0x01,0xff,0xff,0xff,0x3f,0x80,0x01,0xff,0xff,0xff,0x3f,0x80, 0x01,0xfe,0xff,0xff,0x3f,0x80,0x01,0xfc,0xff,0xff,0x3f,0x80, 0x01,0xfc,0xff,0xff,0x1f,0x80,0x01,0xf8,0xff,0xff,0x1f,0x80, 0x01,0xf0,0xff,0xff,0x1f,0x80,0x01,0xf0,0xff,0xff,0x1f,0x80, 0x01,0xe0,0xff,0xff,0x0f,0x80,0x01,0xe0,0xff,0xff,0x0f,0x80, 0x01,0xc0,0xff,0xff,0x0f,0x80,0x01,0x80,0xff,0xff,0x07,0x80, 0x03,0x80,0xff,0xff,0x07,0xc0,0x03,0x00,0xfe,0xff,0x03,0xc0, 0x0f,0x00,0xfe,0xff,0x01,0xf0,0xff,0xff,0xff,0xff,0xff,0xff}; spellcast-1.0/bitmaps/base.ps100644 2756 144 13216 5515617420 14504 0ustar benusers%! /centershow {gsave dup stringwidth pop 2 div neg 0 rmoveto show grestore} def /clapstr 288 string def /snapstr 288 string def /wavestr 288 string def /digitstr 288 string def /palmstr 288 string def /fingerstr 288 string def currentfile clapstr readhexstring ffffffffffffffffffffffffffffffffffffffffffff3fffffffffff1fff fffffffe1ffffffffffe1ffffffffffe1ffffffffffc3ffffffffff83fff fffffff83ffffffffff87ffffffffff07ffffffffff07fffffffffe07fff ffffffe0ffffffffffe0ffffffffffc0ffffffffffc0ffffffffffc0ffff ffffffc0ffffffffffc0ffffffffffc0ffffffffff80ffffffffff80ffff ffffff80ffffffffff80ffffffffffc07fffffffffc07fffffffffc07fff ffffffc07fffffffffc07fffffffffc03fffffffffc03fffffffffc01fff ffffffc01fffffffffc01fffffffffc00fffffffff800fffffffff800fff ffffff801fffffffff001ffffffffe001ffffffffe003ffffffffc003fff fffff0007fffffffe000ffffffffffffffff pop pop currentfile snapstr readhexstring fffffffffffffffffffffffffffff7ffbffffffffbffbffffffffdffbfff fffffdff7ffffffffeff7fffffffffffffffffffffffff3ffffffffff8ff ffffffc7f7ffffffff03fffffffff803fffffffff000ffffffffc0007fff ffff00007ffffffe00007e03fffc00007ffffff800607ffffff000e07fff ffe001e0ffffffc003c0ffffff8007c0fbffff000f80fdffff001f01feff fe001e01ff7ffe003c01fffffc002001fffffc000000fffffc0000007fff fc0000003ffffc0000001ffffe0000001fffff0000001fffff0000000fff ffc000000fffffe000000ffffff000000ffffff800000ffffffe00000fff ffff00000fffffff80000fffffffc0001fffffffe0001fffffffe0003fff fffff8003ffffffff8007fffffffffffffff pop pop currentfile wavestr readhexstring ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fffffffffffffffffffffffffffffffffffffffffffffffffffffff0ffff ffffffe07fffffffff807fffffffff01fffffffffc03fffffffff007ffff ffffc01fffffffff803fffffffff007fffffffff00fffffffffe01ffffff fffc03fffffffff803fffffffff007ffffffffe007ffffffffc00fffffff ffc00fffffffff8007ffffffff8007ffffffff8003ffffffffc001ffffff ffe000fffffffff0003ffffffff8001ffffffffc000ffffffffe0007ffff ffff0003ffffffff8000ffffffffc0007fffffffe0003ffffffff0001fff fffff0001ffffffff0000ffffffff0000ffffffff0000fffffffe0000fff ffffc0001fffffffc0003fffffffffffffff pop pop currentfile digitstr readhexstring fffffffffffffffffffffffffffffffffffffffffffcfffffffffffc7fff fffffff87ffffffffff87ffffffffff07ffffffffff07fffffffffe0ffff ffffffe0ffffffffffe0ffffffffffc1ffffffffffc1ffffffffff81ffff ffffff81ffffffffff03ffffffffff03fffffffffe03fffffffffc03ffff ffffc003ffffffffc003fffffffe0003fffffffc00021ffffffc00001fff ffe000003fffffe000003fffffc000003fffff8000007fffff8000007fff ff8000007fffff8000007fffff8000007fffff8000007fffff800000ffff ff800000ffffff800001ffffff800001ffffff800003ffffffc00003ffff ffc00007ffffffe0000ffffffff0001ffffffff0001ffffffff0007fffff ffe000ffffffffc000ffffffffffffffffff pop pop currentfile palmstr readhexstring fffffffffffffffffffffffffffffe7ffffffffffe3ffffffffffc39ffff fffffc38fffffffffc30ffffffff9c30ffffffff1c30ffffffff0c30ffff ffff0c30ffffffff0c30ffffffff0c30ffffffff0c30ffffffff0c30ffff ffff0c30fffffff70c30ffffffe30c30ffffffe30c30ffffffe30c30ffff ffe30c30ffffffc30c10ff3fffc20800fe3fffc20000fe3fffc20000fc3f ffc20000fc3fffc00000783fffc00000783fffc00000707fffc00000607f ffc00000407fffc00000007fffc0000000ffffc0000000ffffc0000001ff ffc0000003ffffe0000003ffffe0000007ffffe000000fffffe000000fff fff000001ffffff000001ffffff000003ffffff800007ffffff800007fff fffc0001fffffffe0001ffffffffffffffff pop pop currentfile fingerstr readhexstring ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fffffffffffffffffffffffffffffffffffffffffffffffffffffcf87fff fffff8707ffffffff0e0ffffffffc1c1fc3fffff8383f03fffff0707e07f ffe70e0fc0ffffc60c1f83ffff861c1f03ffff0c183e07ffff18183e0fff fe18383c0ffffe30303c1ffffc3030381ffffc2060103ffffc2000003fff fc0000003ffffc0000003ffffc0000007e3ffc0000007e3ffc0000007c3f fc000000783ffc000000703ffc000000607ffe000000007ffe00000000ff fe00000001fffe00000003fffe00000007ffff0000000fffff8000003fff ff8000007fffff000000fffffe000003fffffc00000ffffff800001fffff f000007ffffff000007fffffffffffffffff pop pop /showfinger { gsave translate 12 12 scale 48 48 false [ 48 0 0 -48 0 48 ] { fingerstr } imagemask grestore } def /showpalm { gsave translate 12 12 scale 48 48 false [ 48 0 0 -48 0 48 ] { palmstr } imagemask grestore } def /showdigit { gsave translate 12 12 scale 48 48 false [ 48 0 0 -48 0 48 ] { digitstr } imagemask grestore } def /showsnap { gsave translate 12 12 scale 48 48 false [ 48 0 0 -48 0 48 ] { snapstr } imagemask grestore } def /showwave { gsave translate 12 12 scale 48 48 false [ 48 0 0 -48 0 48 ] { wavestr } imagemask grestore } def /showclap { gsave translate 12 12 scale 48 48 false [ 48 0 0 -48 0 48 ] { clapstr } imagemask grestore } def /showclap2 { gsave translate 12 12 scale -0.3 0 translate 48 48 false [ 48 0 0 -48 0 48 ] { clapstr } imagemask 1.6 0 translate -1 1 scale 48 48 false [ 48 0 0 -48 0 48 ] { clapstr } imagemask grestore } def /showdigit2 { gsave translate 12 12 scale -0.0 0 translate 48 48 false [ 48 0 0 -48 0 48 ] { digitstr } imagemask 1.5 0 translate -1 1 scale 48 48 false [ 48 0 0 -48 0 48 ] { digitstr } imagemask grestore } def /showwave2 { gsave translate 12 12 scale -0.0 0 translate 48 48 false [ 48 0 0 -48 0 48 ] { wavestr } imagemask 1.55 0 translate -1 1 scale 48 48 false [ 48 0 0 -48 0 48 ] { wavestr } imagemask grestore } def /showsnap2 { gsave translate 12 12 scale -0.0 0 translate 48 48 false [ 48 0 0 -48 0 48 ] { snapstr } imagemask 1.55 0 translate -1 1 scale 48 48 false [ 48 0 0 -48 0 48 ] { snapstr } imagemask grestore } def /showpalm2 { gsave translate 12 12 scale -0.2 0 translate 48 48 false [ 48 0 0 -48 0 48 ] { palmstr } imagemask 1.6 0 translate -1 1 scale 48 48 false [ 48 0 0 -48 0 48 ] { palmstr } imagemask grestore } def /nullact { pop pop } def spellcast-1.0/bitmaps/sd2.bm100644 2756 144 424 5515617420 14173 0ustar benusers#define sd2_width 16 #define sd2_height 16 #define sd2_x_hot -1 #define sd2_y_hot -1 static char sd2_bits[] = { 0x00,0x00,0x80,0x04,0xc0,0x0c,0xc0,0x0c,0x60,0x0c,0x60,0x0c, 0x70,0x1c,0x7c,0x7c,0xfe,0xfe,0xff,0xfe,0xff,0xfe,0xff,0xfe, 0x7f,0xfc,0x7f,0xfc,0x3e,0xf8,0x1f,0xf8}; spellcast-1.0/bitmaps/ba.bm100644 2756 144 3564 5515617430 14116 0ustar benusers#define ba_width 48 #define ba_height 48 #define ba_x_hot -1 #define ba_y_hot -1 static char ba_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x18, 0x00, 0x81, 0x01, 0x00, 0x00, 0x0c, 0xe0, 0x80, 0x81, 0x01, 0x00, 0x07, 0x1e, 0x80, 0xf1, 0x00, 0xe0, 0xcf, 0x03, 0x80, 0x4d, 0x00, 0x3c, 0xfe, 0x00, 0x80, 0x21, 0x00, 0x0f, 0x1f, 0x00, 0x9e, 0x11, 0xe0, 0x81, 0x03, 0xe0, 0x81, 0x11, 0x38, 0x00, 0x20, 0x1c, 0x80, 0xc9, 0x00, 0x00, 0x30, 0x00, 0x80, 0x3d, 0x00, 0x00, 0x1c, 0x00, 0x80, 0x05, 0x00, 0x00, 0x1e, 0x00, 0x80, 0x01, 0x00, 0x80, 0x0f, 0xe0, 0x8f, 0x01, 0x00, 0xe0, 0x07, 0xff, 0x81, 0x01, 0x00, 0xf8, 0xe7, 0x3f, 0x80, 0x01, 0x00, 0xff, 0xfb, 0x03, 0x80, 0x01, 0xe0, 0xff, 0x7f, 0x00, 0x80, 0x01, 0xfc, 0xff, 0x1f, 0x00, 0x80, 0x01, 0xff, 0xfc, 0x03, 0x00, 0x80, 0xe1, 0x1f, 0x7e, 0x00, 0x00, 0x80, 0xfd, 0x00, 0x1f, 0x00, 0x00, 0xa0, 0x01, 0x80, 0x07, 0x00, 0x00, 0x9f, 0x01, 0xc0, 0x01, 0x00, 0xf0, 0x87, 0x01, 0x64, 0x00, 0x00, 0x3f, 0x80, 0x01, 0x27, 0xc0, 0x01, 0x00, 0x80, 0x81, 0x07, 0x38, 0x00, 0x00, 0x80, 0x61, 0x02, 0x06, 0x00, 0x00, 0x80, 0x31, 0x82, 0x01, 0x00, 0x00, 0x80, 0x09, 0x42, 0x00, 0x00, 0x00, 0x80, 0x01, 0x33, 0x00, 0x00, 0x00, 0x80, 0x01, 0x09, 0x00, 0x00, 0x00, 0x80, 0x01, 0x05, 0x00, 0x00, 0x00, 0x80, 0x01, 0x03, 0x00, 0x00, 0x00, 0x80, 0x81, 0x01, 0x00, 0x00, 0x00, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; spellcast-1.0/bitmaps/bc.bm100644 2756 144 3044 5515617431 14112 0ustar benusers#define bc_width 48 #define bc_height 48 #define bc_x_hot -1 #define bc_y_hot -1 static char bc_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0xf0, 0x03,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x00,0x03,0xc0, 0x01,0x00,0x00,0x00,0x07,0x80,0x01,0x00,0x00,0x80,0x07,0x80, 0x01,0x00,0x00,0x80,0x07,0x80,0x01,0x00,0x00,0x80,0x07,0x80, 0x01,0x00,0x00,0xc0,0x03,0x80,0x01,0x00,0x00,0xe0,0x03,0x80, 0x01,0x00,0x00,0xe0,0x03,0x80,0x01,0x00,0x00,0xe0,0x01,0x80, 0x01,0x00,0x00,0xf0,0x01,0x80,0x01,0x00,0x00,0xf0,0x01,0x80, 0x01,0x00,0x00,0xf8,0x01,0x80,0x01,0x00,0x00,0xf8,0x00,0x80, 0x01,0x00,0x00,0xf8,0x00,0x80,0x01,0x00,0x00,0xfc,0x00,0x80, 0x01,0x00,0x00,0xfc,0x00,0x80,0x01,0x00,0x00,0xfc,0x00,0x80, 0x01,0x00,0x00,0xfc,0x00,0x80,0x01,0x00,0x00,0xfc,0x00,0x80, 0x01,0x00,0x00,0xfc,0x00,0x80,0x01,0x00,0x00,0xfe,0x00,0x80, 0x01,0x00,0x00,0xfe,0x00,0x80,0x01,0x00,0x00,0xfe,0x00,0x80, 0x01,0x00,0x00,0xfe,0x00,0x80,0x01,0x00,0x00,0xfc,0x01,0x80, 0x01,0x00,0x00,0xfc,0x01,0x80,0x01,0x00,0x00,0xfc,0x01,0x80, 0x01,0x00,0x00,0xfc,0x01,0x80,0x01,0x00,0x00,0xfc,0x01,0x80, 0x01,0x00,0x00,0xfc,0x03,0x80,0x01,0x00,0x00,0xfc,0x03,0x80, 0x01,0x00,0x00,0xfc,0x07,0x80,0x01,0x00,0x00,0xfc,0x07,0x80, 0x01,0x00,0x00,0xfc,0x07,0x80,0x01,0x00,0x00,0xfc,0x0f,0x80, 0x01,0x00,0x00,0xfe,0x0f,0x80,0x01,0x00,0x00,0xfe,0x0f,0x80, 0x01,0x00,0x00,0xfe,0x07,0x80,0x01,0x00,0x00,0xff,0x07,0x80, 0x01,0x00,0x80,0xff,0x07,0x80,0x01,0x00,0x80,0xff,0x03,0x80, 0x03,0x00,0xc0,0xff,0x03,0xc0,0x03,0x00,0xf0,0xff,0x01,0xc0, 0x0f,0x00,0xf8,0xff,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff}; spellcast-1.0/bitmaps/bd.bm100644 2756 144 3044 5515617431 14113 0ustar benusers#define bd_width 48 #define bd_height 48 #define bd_x_hot -1 #define bd_y_hot -1 static char bd_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0xf0, 0x03,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0xc0,0x00,0xc0, 0x01,0x00,0x00,0xc0,0x01,0x80,0x01,0x00,0x00,0xe0,0x01,0x80, 0x01,0x00,0x00,0xe0,0x01,0x80,0x01,0x00,0x00,0xf0,0x01,0x80, 0x01,0x00,0x00,0xf0,0x01,0x80,0x01,0x00,0x00,0xf8,0x00,0x80, 0x01,0x00,0x00,0xf8,0x00,0x80,0x01,0x00,0x00,0xf8,0x00,0x80, 0x01,0x00,0x00,0x7c,0x00,0x80,0x01,0x00,0x00,0x7c,0x00,0x80, 0x01,0x00,0x00,0x7e,0x00,0x80,0x01,0x00,0x00,0x7e,0x00,0x80, 0x01,0x00,0x00,0x3f,0x00,0x80,0x01,0x00,0x00,0x3f,0x00,0x80, 0x01,0x00,0x80,0x3f,0x00,0x80,0x01,0x00,0xc0,0x3f,0x00,0x80, 0x01,0x00,0xfc,0x3f,0x00,0x80,0x01,0x00,0xfc,0x3f,0x00,0x80, 0x01,0x80,0xff,0x3f,0x00,0x80,0x01,0xc0,0xff,0xbf,0x07,0x80, 0x01,0xc0,0xff,0xff,0x07,0x80,0x01,0xf8,0xff,0xff,0x03,0x80, 0x01,0xf8,0xff,0xff,0x03,0x80,0x01,0xfc,0xff,0xff,0x03,0x80, 0x01,0xfe,0xff,0xff,0x01,0x80,0x01,0xfe,0xff,0xff,0x01,0x80, 0x01,0xfe,0xff,0xff,0x01,0x80,0x01,0xfe,0xff,0xff,0x01,0x80, 0x01,0xfe,0xff,0xff,0x01,0x80,0x01,0xfe,0xff,0xff,0x01,0x80, 0x01,0xfe,0xff,0xff,0x00,0x80,0x01,0xfe,0xff,0xff,0x00,0x80, 0x01,0xfe,0xff,0x7f,0x00,0x80,0x01,0xfe,0xff,0x7f,0x00,0x80, 0x01,0xfe,0xff,0x3f,0x00,0x80,0x01,0xfc,0xff,0x3f,0x00,0x80, 0x01,0xfc,0xff,0x1f,0x00,0x80,0x01,0xf8,0xff,0x0f,0x00,0x80, 0x01,0xf0,0xff,0x07,0x00,0x80,0x01,0xf0,0xff,0x07,0x00,0x80, 0x03,0xf0,0xff,0x01,0x00,0xc0,0x03,0xf8,0xff,0x00,0x00,0xc0, 0x0f,0xfc,0xff,0x00,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff}; spellcast-1.0/bitmaps/bf.bm100644 2756 144 3044 5515617432 14116 0ustar benusers#define bf_width 48 #define bf_height 48 #define bf_x_hot -1 #define bf_y_hot -1 static char bf_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0xf0, 0x03,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0xc0, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0xc0,0xe0,0x01,0x80, 0x01,0x00,0xe0,0xf1,0x01,0x80,0x01,0x00,0xf0,0xf8,0x00,0x80, 0x01,0x00,0x7c,0x7c,0xc0,0x83,0x01,0x00,0x3e,0x3e,0xf0,0x83, 0x01,0x00,0x1f,0x1f,0xf8,0x81,0x01,0x18,0x8f,0x0f,0xfc,0x80, 0x01,0x9c,0xcf,0x07,0x3e,0x80,0x01,0x9e,0xc7,0x07,0x3f,0x80, 0x01,0xcf,0xe7,0x83,0x1f,0x80,0x01,0xe7,0xe7,0x83,0x0f,0x80, 0x81,0xe7,0xe3,0xc3,0x0f,0x80,0x81,0xf3,0xf3,0xc3,0x07,0x80, 0xc1,0xf3,0xf3,0xe3,0x07,0x80,0xc1,0xfb,0xf9,0xf7,0x03,0x80, 0xc1,0xfb,0xff,0xff,0x03,0x80,0xc1,0xff,0xff,0xff,0x03,0x80, 0xc1,0xff,0xff,0xff,0x03,0x80,0xc1,0xff,0xff,0xff,0x81,0x83, 0xc1,0xff,0xff,0xff,0x81,0x83,0xc1,0xff,0xff,0xff,0xc1,0x83, 0xc1,0xff,0xff,0xff,0xe1,0x83,0xc1,0xff,0xff,0xff,0xf1,0x83, 0xc1,0xff,0xff,0xff,0xf9,0x81,0x81,0xff,0xff,0xff,0xff,0x81, 0x81,0xff,0xff,0xff,0xff,0x80,0x81,0xff,0xff,0xff,0x7f,0x80, 0x81,0xff,0xff,0xff,0x3f,0x80,0x81,0xff,0xff,0xff,0x1f,0x80, 0x01,0xff,0xff,0xff,0x0f,0x80,0x01,0xfe,0xff,0xff,0x03,0x80, 0x01,0xfe,0xff,0xff,0x01,0x80,0x01,0xff,0xff,0xff,0x00,0x80, 0x81,0xff,0xff,0x3f,0x00,0x80,0xc1,0xff,0xff,0x0f,0x00,0x80, 0xe3,0xff,0xff,0x07,0x00,0xc0,0xf3,0xff,0xff,0x01,0x00,0xc0, 0xff,0xff,0xff,0x01,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff}; spellcast-1.0/bitmaps/bk.bm100644 2756 144 3564 5515617432 14132 0ustar benusers#define bk_width 48 #define bk_height 48 #define bk_x_hot -1 #define bk_y_hot -1 static char bk_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x20, 0x01, 0x00, 0x00, 0xf0, 0x03, 0x20, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x20, 0x02, 0x00, 0x00, 0xc0, 0x01, 0x40, 0x06, 0x00, 0x00, 0x80, 0x01, 0x40, 0x04, 0x00, 0x00, 0x80, 0x01, 0x40, 0x04, 0x00, 0x00, 0x80, 0x01, 0x40, 0x0c, 0x00, 0x00, 0x80, 0x01, 0x40, 0x08, 0x00, 0x00, 0x80, 0x01, 0x80, 0x18, 0x00, 0x00, 0x80, 0x01, 0x80, 0x10, 0x00, 0x00, 0x80, 0x01, 0x80, 0x30, 0x00, 0x00, 0x80, 0x01, 0x80, 0x20, 0x00, 0x00, 0x80, 0x01, 0x00, 0x61, 0x00, 0x00, 0x80, 0x01, 0x00, 0xc1, 0x00, 0x00, 0x80, 0x01, 0x00, 0x81, 0x00, 0x00, 0x80, 0x01, 0x00, 0x81, 0x01, 0x00, 0x80, 0x01, 0x00, 0xe2, 0x0f, 0x00, 0x80, 0x01, 0x00, 0xf2, 0x1f, 0x00, 0x80, 0x01, 0x00, 0xfa, 0x3f, 0x00, 0x80, 0x01, 0x00, 0xfe, 0x3f, 0x00, 0x80, 0x01, 0x00, 0xfe, 0x3f, 0x00, 0x80, 0x01, 0x00, 0xff, 0x3f, 0x00, 0x80, 0x01, 0x00, 0xff, 0xff, 0x00, 0x80, 0x01, 0x00, 0xff, 0xff, 0x01, 0x80, 0x01, 0x00, 0xff, 0xff, 0x03, 0x80, 0x01, 0x00, 0xff, 0xff, 0x03, 0x80, 0x01, 0x80, 0xff, 0xff, 0x03, 0x80, 0x01, 0x80, 0xff, 0xff, 0x01, 0x80, 0x01, 0x80, 0xff, 0xff, 0x03, 0x80, 0x01, 0x80, 0xff, 0xff, 0x07, 0x80, 0x01, 0x80, 0xff, 0xff, 0x07, 0x80, 0x01, 0x80, 0xff, 0xff, 0x07, 0x80, 0x01, 0x80, 0xff, 0xff, 0x07, 0x80, 0x01, 0x80, 0xff, 0xff, 0x03, 0x80, 0x01, 0xc0, 0xff, 0xff, 0x07, 0x80, 0x01, 0xc0, 0xff, 0xff, 0x0f, 0x80, 0x01, 0xc0, 0xff, 0xff, 0x0f, 0x80, 0x01, 0xc0, 0xff, 0xff, 0x0f, 0x80, 0x01, 0xc0, 0xff, 0xff, 0x0f, 0x80, 0x01, 0xe0, 0xff, 0xff, 0x07, 0x80, 0x01, 0xe0, 0xff, 0xff, 0x07, 0x80, 0x01, 0xf0, 0xff, 0xff, 0x03, 0x80, 0x01, 0xf0, 0xff, 0xff, 0x03, 0x80, 0x03, 0xf8, 0xff, 0xff, 0x01, 0xc0, 0x03, 0xf8, 0xff, 0xff, 0x00, 0xc0, 0x0f, 0xfc, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; spellcast-1.0/bitmaps/bn.bm100644 2756 144 2774 5515617433 14140 0ustar benusers#define bn_width 48 #define bn_height 48 static char bn_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0xf0, 0x03,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0xc0, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x03,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0xc0, 0x0f,0x00,0x00,0x00,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff}; spellcast-1.0/bitmaps/bp.bm100644 2756 144 3044 5515617433 14131 0ustar benusers#define bp_width 48 #define bp_height 48 #define bp_x_hot -1 #define bp_y_hot -1 static char bp_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0xf0, 0x03,0x00,0x80,0x01,0x00,0xc0,0x03,0x00,0x80,0x03,0x00,0xc0, 0x01,0x00,0xc0,0x63,0x00,0x80,0x01,0x00,0xc0,0xe3,0x00,0x80, 0x01,0x00,0xc0,0xf3,0x00,0x80,0x01,0x00,0xc6,0xf3,0x00,0x80, 0x01,0x00,0xc7,0xf3,0x00,0x80,0x01,0x00,0xcf,0xf3,0x00,0x80, 0x01,0x00,0xcf,0xf3,0x00,0x80,0x01,0x00,0xcf,0xf3,0x00,0x80, 0x01,0x00,0xcf,0xf3,0x00,0x80,0x01,0x00,0xcf,0xf3,0x00,0x80, 0x01,0x00,0xcf,0xf3,0x00,0x80,0x01,0x00,0xcf,0xf3,0x00,0x80, 0x01,0x10,0xcf,0xf3,0x00,0x80,0x01,0x38,0xcf,0xf3,0x00,0x80, 0x01,0x38,0xcf,0xf3,0x00,0x80,0x01,0x38,0xcf,0xf3,0x00,0x80, 0x01,0x38,0xcf,0xf3,0x00,0x80,0x01,0x3c,0xcf,0xf7,0x00,0x83, 0x01,0xbc,0xef,0xff,0x80,0x83,0x01,0xbc,0xff,0xff,0x80,0x83, 0x01,0xbc,0xff,0xff,0xc0,0x83,0x01,0xbc,0xff,0xff,0xc0,0x83, 0x01,0xfc,0xff,0xff,0xe1,0x83,0x01,0xfc,0xff,0xff,0xe1,0x83, 0x01,0xfc,0xff,0xff,0xf1,0x81,0x01,0xfc,0xff,0xff,0xf9,0x81, 0x01,0xfc,0xff,0xff,0xfd,0x81,0x01,0xfc,0xff,0xff,0xff,0x81, 0x01,0xfc,0xff,0xff,0xff,0x80,0x01,0xfc,0xff,0xff,0xff,0x80, 0x01,0xfc,0xff,0xff,0x7f,0x80,0x01,0xfc,0xff,0xff,0x3f,0x80, 0x01,0xf8,0xff,0xff,0x3f,0x80,0x01,0xf8,0xff,0xff,0x1f,0x80, 0x01,0xf8,0xff,0xff,0x0f,0x80,0x01,0xf8,0xff,0xff,0x0f,0x80, 0x01,0xf0,0xff,0xff,0x07,0x80,0x01,0xf0,0xff,0xff,0x07,0x80, 0x01,0xf0,0xff,0xff,0x03,0x80,0x01,0xe0,0xff,0xff,0x01,0x80, 0x03,0xe0,0xff,0xff,0x01,0xc0,0x03,0xc0,0xff,0x7f,0x00,0xc0, 0x0f,0x80,0xff,0x7f,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff}; spellcast-1.0/bitmaps/bs.bm100644 2756 144 3044 5515617434 14135 0ustar benusers#define bs_width 48 #define bs_height 48 #define bs_x_hot -1 #define bs_y_hot -1 static char bs_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0xf0, 0x03,0x00,0x10,0x00,0x02,0xc0,0x03,0x00,0x20,0x00,0x02,0xc0, 0x01,0x00,0x40,0x00,0x02,0x80,0x01,0x00,0x40,0x00,0x01,0x80, 0x01,0x00,0x80,0x00,0x01,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x83,0x01,0x00,0x00,0x00,0xe0,0x80, 0x01,0x00,0x00,0x1c,0x10,0x80,0x01,0x00,0x00,0x3f,0x00,0x80, 0x01,0x00,0xe0,0x3f,0x00,0x80,0x01,0x00,0xf0,0xff,0x00,0x80, 0x01,0x00,0xfc,0xff,0x01,0x80,0x01,0x00,0xff,0xff,0x01,0x80, 0x01,0x80,0xff,0xff,0x81,0xbf,0x01,0xc0,0xff,0xff,0x01,0x80, 0x01,0xe0,0xff,0xf9,0x01,0x80,0x01,0xf0,0xff,0xf8,0x01,0x80, 0x01,0xf8,0x7f,0xf8,0x00,0x80,0x01,0xfc,0x3f,0xfc,0x00,0x80, 0x01,0xfe,0x1f,0xfc,0x20,0x80,0x01,0xff,0x0f,0xfe,0x40,0x80, 0x01,0xff,0x07,0x7f,0x80,0x80,0x81,0xff,0x87,0x7f,0x00,0x81, 0x81,0xff,0xc3,0x7f,0x00,0x80,0xc1,0xff,0xfb,0x7f,0x00,0x80, 0xc1,0xff,0xff,0xff,0x00,0x80,0xc1,0xff,0xff,0xff,0x01,0x80, 0xc1,0xff,0xff,0xff,0x03,0x80,0xc1,0xff,0xff,0xff,0x07,0x80, 0x81,0xff,0xff,0xff,0x07,0x80,0x01,0xff,0xff,0xff,0x07,0x80, 0x01,0xff,0xff,0xff,0x0f,0x80,0x01,0xfc,0xff,0xff,0x0f,0x80, 0x01,0xf8,0xff,0xff,0x0f,0x80,0x01,0xf0,0xff,0xff,0x0f,0x80, 0x01,0xe0,0xff,0xff,0x0f,0x80,0x01,0x80,0xff,0xff,0x0f,0x80, 0x01,0x00,0xff,0xff,0x0f,0x80,0x01,0x00,0xfe,0xff,0x0f,0x80, 0x01,0x00,0xfc,0xff,0x07,0x80,0x01,0x00,0xf8,0xff,0x07,0x80, 0x03,0x00,0xf8,0xff,0x03,0xc0,0x03,0x00,0xe0,0xff,0x03,0xc0, 0x0f,0x00,0xe0,0xff,0x01,0xf0,0xff,0xff,0xff,0xff,0xff,0xff}; spellcast-1.0/bitmaps/bu.bm100644 2756 144 3564 5515617434 14146 0ustar benusers#define bu_width 48 #define bu_height 48 #define bu_x_hot -1 #define bu_y_hot -1 static char bu_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x08, 0x00, 0x00, 0xc0, 0x03, 0x0a, 0x00, 0x00, 0x00, 0xc0, 0x09, 0x00, 0x41, 0x80, 0x20, 0x80, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x10, 0x00, 0x04, 0x00, 0x88, 0x55, 0x08, 0x44, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00, 0x00, 0x00, 0xa0, 0x51, 0x08, 0x41, 0x04, 0x40, 0x80, 0x85, 0x08, 0x04, 0x20, 0x02, 0x84, 0x61, 0x26, 0x20, 0x00, 0x00, 0x80, 0x89, 0x10, 0x01, 0x01, 0x10, 0x90, 0x01, 0x44, 0x08, 0x00, 0x80, 0x80, 0x21, 0x20, 0x41, 0x04, 0x04, 0x88, 0x11, 0x49, 0x08, 0x40, 0x20, 0x80, 0x01, 0x80, 0x82, 0x00, 0x02, 0x82, 0x45, 0x50, 0x28, 0x15, 0x40, 0x80, 0x11, 0x04, 0x12, 0x80, 0x28, 0xa8, 0x01, 0xa1, 0xa4, 0x24, 0x82, 0x82, 0x23, 0x00, 0x01, 0x82, 0x28, 0x88, 0x91, 0x52, 0xaa, 0x10, 0x40, 0xa2, 0x21, 0x08, 0x05, 0x25, 0x09, 0x90, 0x09, 0x42, 0x90, 0x90, 0x42, 0xad, 0x85, 0x10, 0x02, 0x2a, 0x08, 0x80, 0x01, 0xa4, 0x88, 0x40, 0x42, 0xa0, 0x49, 0x00, 0x22, 0x24, 0x10, 0x84, 0x01, 0x88, 0x00, 0x51, 0x09, 0x81, 0x41, 0x02, 0x48, 0x84, 0x44, 0x90, 0x11, 0x20, 0x02, 0x00, 0x12, 0x84, 0x01, 0x00, 0x80, 0x90, 0x24, 0xa1, 0x05, 0x08, 0x01, 0x04, 0x10, 0x88, 0x81, 0x00, 0x48, 0x00, 0x42, 0x82, 0x01, 0x00, 0x00, 0x81, 0x28, 0xc5, 0x01, 0x00, 0x00, 0x10, 0x40, 0x88, 0x01, 0x08, 0x00, 0x00, 0x22, 0x91, 0x01, 0x00, 0x01, 0x00, 0x08, 0xca, 0x11, 0x00, 0x20, 0x82, 0x40, 0x80, 0x01, 0x00, 0x00, 0x00, 0x08, 0xa9, 0x01, 0x00, 0x00, 0x10, 0x00, 0xd4, 0x01, 0x10, 0x00, 0x80, 0x14, 0x80, 0x01, 0x00, 0x20, 0x00, 0x00, 0x91, 0x01, 0x00, 0x00, 0x08, 0x00, 0x80, 0x01, 0x00, 0x00, 0x40, 0x08, 0x80, 0x03, 0x00, 0x00, 0x00, 0x80, 0xd0, 0x03, 0x02, 0x08, 0x00, 0x01, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; spellcast-1.0/bitmaps/bva.bm100644 2756 144 3571 5515617435 14307 0ustar benusers#define bva_width 48 #define bva_height 48 #define bva_x_hot -1 #define bva_y_hot -1 static char bva_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x18, 0x00, 0x81, 0x01, 0x00, 0x00, 0x0c, 0xe0, 0x80, 0x81, 0x01, 0x00, 0x07, 0x1e, 0x80, 0xf1, 0x00, 0xe0, 0xcf, 0x03, 0x80, 0x4d, 0x00, 0x3c, 0xfe, 0x00, 0x80, 0x21, 0x00, 0x0f, 0x1f, 0x00, 0x9e, 0x11, 0xe0, 0x81, 0x03, 0xe0, 0x81, 0x11, 0x38, 0x00, 0x20, 0x1c, 0x80, 0xc9, 0x00, 0x00, 0x30, 0x00, 0x80, 0x3d, 0x00, 0x00, 0x1c, 0x00, 0x80, 0x05, 0x00, 0x00, 0x1e, 0x00, 0x80, 0x01, 0x00, 0x80, 0x0f, 0xe0, 0x8f, 0x01, 0x00, 0xe0, 0x07, 0xff, 0x81, 0x01, 0x00, 0xf8, 0xe7, 0x3f, 0x80, 0x01, 0x00, 0xff, 0xfb, 0x03, 0x80, 0x01, 0xe0, 0xff, 0x7f, 0x00, 0x80, 0x01, 0xfc, 0xff, 0x1f, 0x00, 0x80, 0x01, 0xff, 0xfc, 0x03, 0x00, 0x80, 0xe1, 0x1f, 0x7e, 0x00, 0x00, 0x80, 0xfd, 0x00, 0x1f, 0x00, 0x00, 0xa0, 0x01, 0x80, 0x07, 0x00, 0x00, 0x9f, 0x01, 0xc0, 0x01, 0x00, 0xf0, 0x87, 0x01, 0x64, 0x00, 0x00, 0x3f, 0x80, 0x01, 0x27, 0xc0, 0x01, 0x00, 0x80, 0x81, 0x07, 0x38, 0x00, 0x00, 0x80, 0x61, 0x02, 0x06, 0x00, 0x00, 0x80, 0x31, 0x82, 0x01, 0x00, 0x00, 0x80, 0x09, 0x42, 0x00, 0x00, 0x00, 0x80, 0x01, 0x33, 0x00, 0x00, 0x00, 0x80, 0x01, 0x09, 0x00, 0x00, 0x00, 0x80, 0x01, 0x05, 0x00, 0x00, 0x00, 0x80, 0x01, 0x03, 0x00, 0x00, 0x00, 0x80, 0x81, 0x01, 0x00, 0x00, 0x00, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; spellcast-1.0/bitmaps/bvc.bm100644 2756 144 3051 5515617435 14302 0ustar benusers#define bvc_width 48 #define bvc_height 48 #define bvc_x_hot -1 #define bvc_y_hot -1 static char bvc_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0xf0, 0x03,0x00,0x00,0x00,0x00,0xc0,0x03,0xc0,0x00,0x00,0x00,0xc0, 0x01,0xe0,0x00,0x00,0x00,0x80,0x01,0xe0,0x01,0x00,0x00,0x80, 0x01,0xe0,0x01,0x00,0x00,0x80,0x01,0xe0,0x01,0x00,0x00,0x80, 0x01,0xc0,0x03,0x00,0x00,0x80,0x01,0xc0,0x07,0x00,0x00,0x80, 0x01,0xc0,0x07,0x00,0x00,0x80,0x01,0x80,0x07,0x00,0x00,0x80, 0x01,0x80,0x0f,0x00,0x00,0x80,0x01,0x80,0x0f,0x00,0x00,0x80, 0x01,0x80,0x1f,0x00,0x00,0x80,0x01,0x00,0x1f,0x00,0x00,0x80, 0x01,0x00,0x1f,0x00,0x00,0x80,0x01,0x00,0x3f,0x00,0x00,0x80, 0x01,0x00,0x3f,0x00,0x00,0x80,0x01,0x00,0x3f,0x00,0x00,0x80, 0x01,0x00,0x3f,0x00,0x00,0x80,0x01,0x00,0x3f,0x00,0x00,0x80, 0x01,0x00,0x3f,0x00,0x00,0x80,0x01,0x00,0x7f,0x00,0x00,0x80, 0x01,0x00,0x7f,0x00,0x00,0x80,0x01,0x00,0x7f,0x00,0x00,0x80, 0x01,0x00,0x7f,0x00,0x00,0x80,0x01,0x80,0x3f,0x00,0x00,0x80, 0x01,0x80,0x3f,0x00,0x00,0x80,0x01,0x80,0x3f,0x00,0x00,0x80, 0x01,0x80,0x3f,0x00,0x00,0x80,0x01,0x80,0x3f,0x00,0x00,0x80, 0x01,0xc0,0x3f,0x00,0x00,0x80,0x01,0xc0,0x3f,0x00,0x00,0x80, 0x01,0xe0,0x3f,0x00,0x00,0x80,0x01,0xe0,0x3f,0x00,0x00,0x80, 0x01,0xe0,0x3f,0x00,0x00,0x80,0x01,0xf0,0x3f,0x00,0x00,0x80, 0x01,0xf0,0x7f,0x00,0x00,0x80,0x01,0xf0,0x7f,0x00,0x00,0x80, 0x01,0xe0,0x7f,0x00,0x00,0x80,0x01,0xe0,0xff,0x00,0x00,0x80, 0x01,0xe0,0xff,0x01,0x00,0x80,0x01,0xc0,0xff,0x01,0x00,0x80, 0x03,0xc0,0xff,0x03,0x00,0xc0,0x03,0x80,0xff,0x0f,0x00,0xc0, 0x0f,0x00,0xff,0x1f,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff}; spellcast-1.0/bitmaps/bvd.bm100644 2756 144 3051 5515617436 14304 0ustar benusers#define bvd_width 48 #define bvd_height 48 #define bvd_x_hot -1 #define bvd_y_hot -1 static char bvd_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0xf0, 0x03,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x03,0x00,0x00,0xc0, 0x01,0x80,0x03,0x00,0x00,0x80,0x01,0x80,0x07,0x00,0x00,0x80, 0x01,0x80,0x07,0x00,0x00,0x80,0x01,0x80,0x0f,0x00,0x00,0x80, 0x01,0x80,0x0f,0x00,0x00,0x80,0x01,0x00,0x1f,0x00,0x00,0x80, 0x01,0x00,0x1f,0x00,0x00,0x80,0x01,0x00,0x1f,0x00,0x00,0x80, 0x01,0x00,0x3e,0x00,0x00,0x80,0x01,0x00,0x3e,0x00,0x00,0x80, 0x01,0x00,0x7e,0x00,0x00,0x80,0x01,0x00,0x7e,0x00,0x00,0x80, 0x01,0x00,0xfc,0x00,0x00,0x80,0x01,0x00,0xfc,0x00,0x00,0x80, 0x01,0x00,0xfc,0x01,0x00,0x80,0x01,0x00,0xfc,0x03,0x00,0x80, 0x01,0x00,0xfc,0x3f,0x00,0x80,0x01,0x00,0xfc,0x3f,0x00,0x80, 0x01,0x00,0xfc,0xff,0x01,0x80,0x01,0xe0,0xfd,0xff,0x03,0x80, 0x01,0xe0,0xff,0xff,0x03,0x80,0x01,0xc0,0xff,0xff,0x1f,0x80, 0x01,0xc0,0xff,0xff,0x1f,0x80,0x01,0xc0,0xff,0xff,0x3f,0x80, 0x01,0x80,0xff,0xff,0x7f,0x80,0x01,0x80,0xff,0xff,0x7f,0x80, 0x01,0x80,0xff,0xff,0x7f,0x80,0x01,0x80,0xff,0xff,0x7f,0x80, 0x01,0x80,0xff,0xff,0x7f,0x80,0x01,0x80,0xff,0xff,0x7f,0x80, 0x01,0x00,0xff,0xff,0x7f,0x80,0x01,0x00,0xff,0xff,0x7f,0x80, 0x01,0x00,0xfe,0xff,0x7f,0x80,0x01,0x00,0xfe,0xff,0x7f,0x80, 0x01,0x00,0xfc,0xff,0x7f,0x80,0x01,0x00,0xfc,0xff,0x3f,0x80, 0x01,0x00,0xf8,0xff,0x3f,0x80,0x01,0x00,0xf0,0xff,0x1f,0x80, 0x01,0x00,0xe0,0xff,0x0f,0x80,0x01,0x00,0xe0,0xff,0x0f,0x80, 0x03,0x00,0x80,0xff,0x0f,0xc0,0x03,0x00,0x00,0xff,0x1f,0xc0, 0x0f,0x00,0x00,0xff,0x3f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff}; spellcast-1.0/bitmaps/bvf.bm100644 2756 144 3051 5515617436 14306 0ustar benusers#define bvf_width 48 #define bvf_height 48 #define bvf_x_hot -1 #define bvf_y_hot -1 static char bvf_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0xf0, 0x03,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0xc0, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x80,0x07,0x03,0x00,0x80, 0x01,0x80,0x8f,0x07,0x00,0x80,0x01,0x00,0x1f,0x0f,0x00,0x80, 0xc1,0x03,0x3e,0x3e,0x00,0x80,0xc1,0x0f,0x7c,0x7c,0x00,0x80, 0x81,0x1f,0xf8,0xf8,0x00,0x80,0x01,0x3f,0xf0,0xf1,0x18,0x80, 0x01,0x7c,0xe0,0xf3,0x39,0x80,0x01,0xfc,0xe0,0xe3,0x79,0x80, 0x01,0xf8,0xc1,0xe7,0xf3,0x80,0x01,0xf0,0xc1,0xe7,0xe7,0x80, 0x01,0xf0,0xc3,0xc7,0xe7,0x81,0x01,0xe0,0xc3,0xcf,0xcf,0x81, 0x01,0xe0,0xc7,0xcf,0xcf,0x83,0x01,0xc0,0xef,0x9f,0xdf,0x83, 0x01,0xc0,0xff,0xff,0xdf,0x83,0x01,0xc0,0xff,0xff,0xff,0x83, 0x01,0xc0,0xff,0xff,0xff,0x83,0xc1,0x81,0xff,0xff,0xff,0x83, 0xc1,0x81,0xff,0xff,0xff,0x83,0xc1,0x83,0xff,0xff,0xff,0x83, 0xc1,0x87,0xff,0xff,0xff,0x83,0xc1,0x8f,0xff,0xff,0xff,0x83, 0x81,0x9f,0xff,0xff,0xff,0x83,0x81,0xff,0xff,0xff,0xff,0x81, 0x01,0xff,0xff,0xff,0xff,0x81,0x01,0xfe,0xff,0xff,0xff,0x81, 0x01,0xfc,0xff,0xff,0xff,0x81,0x01,0xf8,0xff,0xff,0xff,0x81, 0x01,0xf0,0xff,0xff,0xff,0x80,0x01,0xc0,0xff,0xff,0x7f,0x80, 0x01,0x80,0xff,0xff,0x7f,0x80,0x01,0x00,0xff,0xff,0xff,0x80, 0x01,0x00,0xfc,0xff,0xff,0x81,0x01,0x00,0xf0,0xff,0xff,0x83, 0x03,0x00,0xe0,0xff,0xff,0xc7,0x03,0x00,0x80,0xff,0xff,0xcf, 0x0f,0x00,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; spellcast-1.0/bitmaps/bvk.bm100644 2756 144 3051 5515617437 14314 0ustar benusers#define bvk_width 48 #define bvk_height 48 #define bvk_x_hot -1 #define bvk_y_hot -1 static char bvk_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x80,0x04,0xf0, 0x03,0x00,0x00,0xc0,0x04,0xc0,0x03,0x00,0x00,0x40,0x04,0xc0, 0x01,0x00,0x00,0x60,0x02,0x80,0x01,0x00,0x00,0x20,0x02,0x80, 0x01,0x00,0x00,0x20,0x02,0x80,0x01,0x00,0x00,0x30,0x02,0x80, 0x01,0x00,0x00,0x10,0x02,0x80,0x01,0x00,0x00,0x18,0x01,0x80, 0x01,0x00,0x00,0x08,0x01,0x80,0x01,0x00,0x00,0x0c,0x01,0x80, 0x01,0x00,0x00,0x04,0x01,0x80,0x01,0x00,0x00,0x86,0x00,0x80, 0x01,0x00,0x00,0x83,0x00,0x80,0x01,0x00,0x00,0x81,0x00,0x80, 0x01,0x00,0x80,0x81,0x00,0x80,0x01,0x00,0xf0,0x47,0x00,0x80, 0x01,0x00,0xf8,0x4f,0x00,0x80,0x01,0x00,0xfc,0x5f,0x00,0x80, 0x01,0x00,0xfc,0x7f,0x00,0x80,0x01,0x00,0xfc,0x7f,0x00,0x80, 0x01,0x00,0xfc,0xff,0x00,0x80,0x01,0x00,0xff,0xff,0x00,0x80, 0x01,0x80,0xff,0xff,0x00,0x80,0x01,0xc0,0xff,0xff,0x00,0x80, 0x01,0xc0,0xff,0xff,0x00,0x80,0x01,0xc0,0xff,0xff,0x01,0x80, 0x01,0x80,0xff,0xff,0x01,0x80,0x01,0xc0,0xff,0xff,0x01,0x80, 0x01,0xe0,0xff,0xff,0x01,0x80,0x01,0xe0,0xff,0xff,0x01,0x80, 0x01,0xe0,0xff,0xff,0x01,0x80,0x01,0xe0,0xff,0xff,0x01,0x80, 0x01,0xc0,0xff,0xff,0x01,0x80,0x01,0xe0,0xff,0xff,0x03,0x80, 0x01,0xf0,0xff,0xff,0x03,0x80,0x01,0xf0,0xff,0xff,0x03,0x80, 0x01,0xf0,0xff,0xff,0x03,0x80,0x01,0xf0,0xff,0xff,0x03,0x80, 0x01,0xe0,0xff,0xff,0x07,0x80,0x01,0xe0,0xff,0xff,0x07,0x80, 0x01,0xc0,0xff,0xff,0x0f,0x80,0x01,0xc0,0xff,0xff,0x0f,0x80, 0x03,0x80,0xff,0xff,0x1f,0xc0,0x03,0x00,0xff,0xff,0x1f,0xc0, 0x0f,0x00,0xfe,0xff,0x3f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff}; spellcast-1.0/bitmaps/bvs.bm100644 2756 144 3051 5515617437 14324 0ustar benusers#define bvs_width 48 #define bvs_height 48 #define bvs_x_hot -1 #define bvs_y_hot -1 static char bvs_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0xf0, 0x03,0x40,0x00,0x08,0x00,0xc0,0x03,0x40,0x00,0x04,0x00,0xc0, 0x01,0x40,0x00,0x02,0x00,0x80,0x01,0x80,0x00,0x02,0x00,0x80, 0x01,0x80,0x00,0x01,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0xc1,0x00,0x00,0x00,0x00,0x80,0x01,0x07,0x00,0x00,0x00,0x80, 0x01,0x08,0x38,0x00,0x00,0x80,0x01,0x00,0xfc,0x00,0x00,0x80, 0x01,0x00,0xfc,0x07,0x00,0x80,0x01,0x00,0xff,0x0f,0x00,0x80, 0x01,0x80,0xff,0x3f,0x00,0x80,0x01,0x80,0xff,0xff,0x00,0x80, 0xfd,0x81,0xff,0xff,0x01,0x80,0x01,0x80,0xff,0xff,0x03,0x80, 0x01,0x80,0x9f,0xff,0x07,0x80,0x01,0x80,0x1f,0xff,0x0f,0x80, 0x01,0x00,0x1f,0xfe,0x1f,0x80,0x01,0x00,0x3f,0xfc,0x3f,0x80, 0x01,0x04,0x3f,0xf8,0x7f,0x80,0x01,0x02,0x7f,0xf0,0xff,0x80, 0x01,0x01,0xfe,0xe0,0xff,0x80,0x81,0x00,0xfe,0xe1,0xff,0x81, 0x01,0x00,0xfe,0xc3,0xff,0x81,0x01,0x00,0xfe,0xdf,0xff,0x83, 0x01,0x00,0xff,0xff,0xff,0x83,0x01,0x80,0xff,0xff,0xff,0x83, 0x01,0xc0,0xff,0xff,0xff,0x83,0x01,0xe0,0xff,0xff,0xff,0x83, 0x01,0xe0,0xff,0xff,0xff,0x81,0x01,0xe0,0xff,0xff,0xff,0x80, 0x01,0xf0,0xff,0xff,0xff,0x80,0x01,0xf0,0xff,0xff,0x3f,0x80, 0x01,0xf0,0xff,0xff,0x1f,0x80,0x01,0xf0,0xff,0xff,0x0f,0x80, 0x01,0xf0,0xff,0xff,0x07,0x80,0x01,0xf0,0xff,0xff,0x01,0x80, 0x01,0xf0,0xff,0xff,0x00,0x80,0x01,0xf0,0xff,0x7f,0x00,0x80, 0x01,0xe0,0xff,0x3f,0x00,0x80,0x01,0xe0,0xff,0x1f,0x00,0x80, 0x03,0xc0,0xff,0x1f,0x00,0xc0,0x03,0xc0,0xff,0x07,0x00,0xc0, 0x0f,0x80,0xff,0x07,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff}; spellcast-1.0/bitmaps/bvw.bm100644 2756 144 3051 5515617440 14322 0ustar benusers#define bvw_width 48 #define bvw_height 48 #define bvw_x_hot -1 #define bvw_y_hot -1 static char bvw_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0xf0, 0x03,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0xc0, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x0f,0x00,0x00,0x80, 0x01,0x80,0x1f,0x00,0x00,0x80,0x01,0x80,0x7f,0x00,0x00,0x80, 0x01,0x00,0xfe,0x00,0x00,0x80,0x01,0x00,0xfc,0x03,0x00,0x80, 0x01,0x00,0xf8,0x0f,0x00,0x80,0x01,0x00,0xe0,0x3f,0x00,0x80, 0x01,0x00,0xc0,0x7f,0x00,0x80,0x01,0x00,0x80,0xff,0x00,0x80, 0x01,0x00,0x00,0xff,0x00,0x80,0x01,0x00,0x00,0xfe,0x01,0x80, 0x01,0x00,0x00,0xfc,0x03,0x80,0x01,0x00,0x00,0xfc,0x07,0x80, 0x01,0x00,0x00,0xf8,0x0f,0x80,0x01,0x00,0x00,0xf8,0x1f,0x80, 0x01,0x00,0x00,0xf0,0x3f,0x80,0x01,0x00,0x00,0xf0,0x3f,0x80, 0x01,0x00,0x00,0xf8,0x7f,0x80,0x01,0x00,0x00,0xf8,0x7f,0x80, 0x01,0x00,0x00,0xfc,0x7f,0x80,0x01,0x00,0x00,0xfe,0x3f,0x80, 0x01,0x00,0x00,0xff,0x1f,0x80,0x01,0x00,0xc0,0xff,0x0f,0x80, 0x01,0x00,0xe0,0xff,0x07,0x80,0x01,0x00,0xf0,0xff,0x03,0x80, 0x01,0x00,0xf8,0xff,0x01,0x80,0x01,0x00,0xfc,0xff,0x00,0x80, 0x01,0x00,0xff,0x7f,0x00,0x80,0x01,0x80,0xff,0x3f,0x00,0x80, 0x01,0xc0,0xff,0x1f,0x00,0x80,0x01,0xe0,0xff,0x0f,0x00,0x80, 0x01,0xe0,0xff,0x0f,0x00,0x80,0x01,0xf0,0xff,0x0f,0x00,0x80, 0x01,0xf0,0xff,0x0f,0x00,0x80,0x01,0xf0,0xff,0x0f,0x00,0x80, 0x03,0xf0,0xff,0x1f,0x00,0xc0,0x03,0xe0,0xff,0x3f,0x00,0xc0, 0x0f,0xc0,0xff,0x3f,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff}; spellcast-1.0/bitmaps/bw.bm100644 2756 144 3044 5515617440 14136 0ustar benusers#define bw_width 48 #define bw_height 48 #define bw_x_hot -1 #define bw_y_hot -1 static char bw_bits[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0xf0, 0x03,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0xc0, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x80, 0x01,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0xf0,0x00,0x80, 0x01,0x00,0x00,0xf8,0x01,0x80,0x01,0x00,0x00,0xfe,0x01,0x80, 0x01,0x00,0x00,0x7f,0x00,0x80,0x01,0x00,0xc0,0x3f,0x00,0x80, 0x01,0x00,0xf0,0x1f,0x00,0x80,0x01,0x00,0xfc,0x07,0x00,0x80, 0x01,0x00,0xfe,0x03,0x00,0x80,0x01,0x00,0xff,0x01,0x00,0x80, 0x01,0x00,0xff,0x00,0x00,0x80,0x01,0x80,0x7f,0x00,0x00,0x80, 0x01,0xc0,0x3f,0x00,0x00,0x80,0x01,0xe0,0x3f,0x00,0x00,0x80, 0x01,0xf0,0x1f,0x00,0x00,0x80,0x01,0xf8,0x1f,0x00,0x00,0x80, 0x01,0xfc,0x0f,0x00,0x00,0x80,0x01,0xfc,0x0f,0x00,0x00,0x80, 0x01,0xfe,0x1f,0x00,0x00,0x80,0x01,0xfe,0x1f,0x00,0x00,0x80, 0x01,0xfe,0x3f,0x00,0x00,0x80,0x01,0xfc,0x7f,0x00,0x00,0x80, 0x01,0xf8,0xff,0x00,0x00,0x80,0x01,0xf0,0xff,0x03,0x00,0x80, 0x01,0xe0,0xff,0x07,0x00,0x80,0x01,0xc0,0xff,0x0f,0x00,0x80, 0x01,0x80,0xff,0x1f,0x00,0x80,0x01,0x00,0xff,0x3f,0x00,0x80, 0x01,0x00,0xfe,0xff,0x00,0x80,0x01,0x00,0xfc,0xff,0x01,0x80, 0x01,0x00,0xf8,0xff,0x03,0x80,0x01,0x00,0xf0,0xff,0x07,0x80, 0x01,0x00,0xf0,0xff,0x07,0x80,0x01,0x00,0xf0,0xff,0x0f,0x80, 0x01,0x00,0xf0,0xff,0x0f,0x80,0x01,0x00,0xf0,0xff,0x0f,0x80, 0x03,0x00,0xf8,0xff,0x0f,0xc0,0x03,0x00,0xfc,0xff,0x07,0xc0, 0x0f,0x00,0xfc,0xff,0x03,0xf0,0xff,0xff,0xff,0xff,0xff,0xff}; spellcast-1.0/bitmaps/sc.bm100644 2756 144 347 5515617441 14117 0ustar benusers#define sc_width 16 #define sc_height 16 static char sc_bits[] = { 0x00,0x00,0x40,0x02,0x40,0x02,0x20,0x04,0x20,0x04,0x30,0x0c, 0x30,0x0c,0x30,0x0c,0x30,0x0c,0x30,0x0c,0x30,0x0c,0x70,0x0e, 0x70,0x0e,0x70,0x0e,0x78,0x1e,0x3c,0x3c}; spellcast-1.0/bitmaps/sd.bm100644 2756 144 347 5515617441 14120 0ustar benusers#define sd_width 16 #define sd_height 16 static char sd_bits[] = { 0x00,0x00,0x00,0x04,0x00,0x06,0x00,0x06,0x00,0x03,0x00,0x03, 0x80,0x03,0xe0,0x03,0xf0,0x07,0xf8,0x07,0xf8,0x07,0xf8,0x07, 0xf8,0x03,0xf8,0x03,0xf0,0x01,0xf8,0x00}; spellcast-1.0/bitmaps/sf.bm100644 2756 144 347 5515617442 14123 0ustar benusers#define sf_width 16 #define sf_height 16 static char sf_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x06,0x40,0x33,0xa8,0x19, 0xb8,0x0d,0xb4,0x0d,0xfc,0x07,0xfc,0x27,0xfc,0x37,0xfc,0x1f, 0xfc,0x0f,0xf8,0x07,0xfc,0x01,0xfe,0x00}; spellcast-1.0/bitmaps/sf2.bm100644 2756 144 424 5515617442 14201 0ustar benusers#define sf2_width 16 #define sf2_height 16 #define sf2_x_hot -1 #define sf2_y_hot -1 static char sf2_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x1a,0x58,0xcd,0xb3,0x67,0xe6, 0x37,0xec,0x37,0xec,0x1f,0xf8,0x9f,0xf9,0xdf,0xfb,0x7f,0xfe, 0x3f,0xfc,0x1f,0xf8,0x07,0xe0,0x03,0xc0}; spellcast-1.0/bitmaps/sp.bm100644 2756 144 347 5515617443 14136 0ustar benusers#define sp_width 16 #define sp_height 16 static char sp_bits[] = { 0x80,0x01,0x80,0x05,0xa0,0x07,0xe0,0x07,0xe0,0x07,0xe8,0x07, 0xf8,0x07,0xf8,0x27,0xf8,0x37,0xf8,0x3f,0xf8,0x3f,0xf8,0x1f, 0xf0,0x0f,0xf0,0x0f,0xf0,0x07,0xe0,0x03}; spellcast-1.0/bitmaps/sp2.bm100644 2756 144 424 5515617443 14214 0ustar benusers#define sp2_width 16 #define sp2_height 16 #define sp2_x_hot -1 #define sp2_y_hot -1 static char sp2_bits[] = { 0x00,0x00,0x18,0x18,0x58,0x1a,0x7c,0x3e,0x7e,0x7e,0x7e,0x7e, 0x7f,0xfe,0x7f,0xfe,0x7f,0xfe,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0x7e,0x7e,0x3e,0x7c}; spellcast-1.0/bitmaps/ss.bm100644 2756 144 347 5515617444 14142 0ustar benusers#define ss_width 16 #define ss_height 16 static char ss_bits[] = { 0x20,0x08,0x40,0x04,0x00,0x00,0x80,0x01,0xe0,0x03,0xf0,0x33, 0x78,0x03,0x3c,0x01,0x9e,0x01,0xfe,0x03,0xfe,0x07,0xfc,0x07, 0xf8,0x07,0xf0,0x07,0xe0,0x03,0xc0,0x03}; spellcast-1.0/bitmaps/ss2.bm100644 2756 144 424 5515617444 14220 0ustar benusers#define ss2_width 16 #define ss2_height 16 #define ss2_x_hot -1 #define ss2_y_hot -1 static char ss2_bits[] = { 0x22,0x89,0x24,0x49,0x00,0x00,0x30,0x0c,0x7c,0x3e,0x7e,0x7e, 0x6f,0xf6,0x27,0xe4,0x33,0xcc,0x7f,0xfe,0xff,0xff,0xff,0xff, 0xff,0xff,0xfe,0x7f,0x7c,0x3e,0x78,0x1e}; spellcast-1.0/bitmaps/sw.bm100644 2756 144 347 5515617444 14146 0ustar benusers#define sw_width 16 #define sw_height 16 static char sw_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x03,0xc0,0x03, 0xe0,0x01,0xf0,0x00,0x78,0x00,0x78,0x00,0xf0,0x01,0xe0,0x03, 0xc0,0x07,0x80,0x0f,0x80,0x0f,0xc0,0x0f}; spellcast-1.0/xtalk.c100644 2756 144 6750 5515617612 13046 0ustar benusers#include #include #include #include #include #include "handwave.h" #include "spelllist.h" #include "xspell.h" #define TALK_X (348) #define TALK_Y (576) #define TALK_W (448) #define TALK_LEADING (8) static char bigbuf[2048], bigbuf2[2048]; void init_talk(py) struct player *py; { py->talk_size = 128; py->talk_buf = (char *)malloc(sizeof(char) * py->talk_size); strcpy(py->talk_buf, ""); py->talk_pt = 0; py->talk_xlast = (-1); py->talk_x = 0; py->talk_toobig = 0; } void redraw_talk_only(py, recomp) struct player *py; int recomp; { static XCharStruct overall; int direction, ascent, descent; int width; static XPoint caret[3] = { {0, 0}, {2, -3}, {2, 3} }; if (recomp) { XTextExtents(py->font, py->talk_buf, py->talk_pt, &direction, &ascent, &descent, &overall); py->talk_x = overall.width; } if (py->talk_x != py->talk_xlast) { caret[0].x = TALK_X+py->talk_xlast - 2; caret[0].y = TALK_Y+py->lineheight + 4; XDrawLines(py->dpy, py->win, py->whitegc, caret, 3, CoordModePrevious); py->talk_xlast = py->talk_x; } width = DrawStringField(py, py->talk_buf, TALK_X, TALK_Y+py->lineheight, TALK_W); caret[0].x = TALK_X+py->talk_x - 2; caret[0].y = TALK_Y+py->lineheight + 4; XDrawLines(py->dpy, py->win, py->blackgc, caret, 3, CoordModePrevious); py->talk_toobig = (width >= (TALK_W-py->lineheight)); } void redraw_talk(py) struct player *py; { XDrawRectangle(py->dpy, py->win, py->blackgc, TALK_X-3, TALK_Y-2, TALK_W+6, py->lineheight+TALK_LEADING+4); redraw_talk_only(py, 0); } static void ensure_talk_size(py, size) struct player *py; int size; { if (size < py->talk_size) return; while (size < py->talk_size) py->talk_size *= 2; py->talk_buf = (char *)realloc(py->talk_buf, sizeof(char) * py->talk_size); } void talk_handle_char(py, ch) struct player *py; char ch; { char *cp; int ix; int pnum; if (isprint(ch)) { if (!py->talk_toobig) { ensure_talk_size(py, strlen(py->talk_buf)+1); for (cp = &(py->talk_buf[py->talk_pt]); *cp; cp++); for (; cp >= &(py->talk_buf[py->talk_pt]); cp--) *(cp+1) = *cp; py->talk_buf[py->talk_pt] = ch; py->talk_pt++; redraw_talk_only(py, 1); } } else switch (ch) { case '\n': case '\r': case '\023': if (py->talk_pt) { pnum = py-players; sprintf(bigbuf, "You say \"%s\"\n", py->talk_buf); sprintf(bigbuf2, "%s says \"%s\"\n", NameOfBeing(gameval, QuVal_Target_Wizard, pnum), py->talk_buf); for (ix=0; ixtalk_pt = 0; py->talk_buf[0] = '\0'; redraw_talk_only(py, 1); break; case '\177': case '\010': if (py->talk_pt) { py->talk_pt--; for (cp = &(py->talk_buf[py->talk_pt]); *cp; cp++) *cp = *(cp+1); redraw_talk_only(py, 1); } break; case '\013': py->talk_buf[py->talk_pt] = '\0'; redraw_talk_only(py, 1); break; case '\002': if (py->talk_pt) { py->talk_pt--; redraw_talk_only(py, 1); } break; case '\006': if (py->talk_buf[py->talk_pt]) { py->talk_pt++; redraw_talk_only(py, 1); } break; case '\001': py->talk_pt = 0; redraw_talk_only(py, 1); break; case '\005': while (py->talk_buf[py->talk_pt]) py->talk_pt++; redraw_talk_only(py, 1); break; } } spellcast-1.0/stupid.c100644 2756 144 31124 5515617401 13240 0ustar benusers#include #include #include "handwave.h" #include "spelllist.h" struct maingame { int ignorestuff; }; static void PrintMsg(msg, gameval, rock) char *msg; game *gameval; struct maingame *rock; { if (msg) { printf("*: "); fputs(msg, stdout); } } static void PrintMsg2(person1, msg1, msgelse, gameval, rock) int person1; char *msg1, *msgelse; game *gameval; struct maingame *rock; { if (msg1) { printf("%d: ", person1); fputs(msg1, stdout); } if (msgelse) { printf("~%d: ", person1); fputs(msgelse, stdout); } } static void PrintMsg3(person1, person2, msg1, msg2, msgelse, gameval, rock) int person1, person2; char *msg1, *msg2, *msgelse; game *gameval; struct maingame *rock; { if (msg1) { printf("%d: ", person1); fputs(msg1, stdout); } if (msg2) { printf("%d: ", person2); fputs(msg2, stdout); } if (msgelse) { printf("~%d/~%d: ", person1, person2); fputs(msgelse, stdout); } } static void Queries(numqueries, qlist, gameval, rock) int numqueries; struct query qlist[]; game *gameval; struct maingame *rock; { int ix, jx, attnum, spellnum; int res; char inbuf[256]; char outbuf[512]; static int targetlist[256]; static char *targetnamelist[256]; int numtargs, targnum; int *hlist; char *ques, *handage; for (ix=0; ix=hlist[0]) { printf(" [Please enter a number from 0 to %d]: ", hlist[0]-1); } else break; } qlist[ix].answer = res; break; case Qu_ElementalType: printf( "%d: Which type of elemental do you want to summon?\n (0:fire, 1:ice): ", qlist[ix].player); while (1) { fgets(inbuf, 256, stdin); res = atol(inbuf); if (res!=0 && res!=1) { printf(" [Please enter 0 or 1]: "); } else break; } qlist[ix].answer = res; break; case Qu_ParalysisHand: printf( "%d: Which of %s's hands do you want to paralyze?\n (0:left, 1:right): ", qlist[ix].player, NameOfBeing(gameval, QuVal_Target_Wizard, qlist[ix].rock)); while (1) { fgets(inbuf, 256, stdin); res = atol(inbuf); if (res!=0 && res!=1) { printf(" [Please enter 0 or 1]: "); } else break; } qlist[ix].answer = res; break; case Qu_CharmHand: printf( "%d: Which of %s's hands do you want to charm?\n (0:left, 1:right): ", qlist[ix].player, NameOfBeing(gameval, QuVal_Target_Wizard, qlist[ix].rock)); while (1) { fgets(inbuf, 256, stdin); res = atol(inbuf); if (res!=0 && res!=1) { printf(" [Please enter 0 or 1]: "); } else break; } qlist[ix].answer = res; break; case Qu_CharmGesture: jx = (int)(qlist[ix].rock); if (jx >= 128) { spellnum = jx - 128; jx = 1; } else { spellnum = jx; jx = 0; } printf( "%d: What gesture do you want %s's %s hand to make?\n (enter a letter): ", qlist[ix].player, NameOfBeing(gameval, QuVal_Target_Wizard, spellnum), (jx?"right":"left")); while (1) { fgets(inbuf, 256, stdin); if (inbuf[0]=='\0' || inbuf[0]=='\n') { printf(" [Please enter a letter]: "); } else { res = cheap_translate(inbuf[0]); break; } } qlist[ix].answer = res; break; case Qu_MonsterTarget: jx = (int)(qlist[ix].rock); attnum = jx / 256; spellnum = jx % 256; switch (attnum) { case 1: sprintf(outbuf, "Whom do you want %s to attack?", NameOfBeing(gameval, QuVal_Target_Creature, spellnum)); break; case 2: sprintf(outbuf, "Whom do you want %s's first attack to be at?", NameOfBeing(gameval, QuVal_Target_Creature, spellnum)); break; case 3: sprintf(outbuf, "Whom do you want %s's second attack to be at?", NameOfBeing(gameval, QuVal_Target_Creature, spellnum)); break; default: sprintf(outbuf, "ERROR: Query about %d (%d)", spellnum, attnum); break; } printf("%d: %s\n", qlist[ix].player, outbuf); targnum = 0; targetlist[targnum] = 0; targetnamelist[targnum] = "nobody"; targnum++; numtargs = NumberOfTargets(gameval, QuVal_Target_Wizard); for (jx=0; jx=numtargs) { printf(" [Please enter a number from 0 to %d]: ", numtargs-1); } else break; } qlist[ix].answer = targetlist[res]; } break; case Qu_WhichToDelay: case Qu_WhichToPerm: if (qlist[ix].qtype == Qu_WhichToDelay) printf("%d: Which spell do you want to delay?\n", qlist[ix].player); else printf("%d: Which spell do you want to make permanent?\n", qlist[ix].player); hlist = (int *)qlist[ix].rock; printf(" ["); for (jx=0; hlist[jx]!=(-1); jx++) { printf("%s%d: %s", ((jx)?", ":""), jx, spelllist[hlist[jx]].name); } numtargs = jx; printf("]: "); while (1) { fgets(inbuf, 256, stdin); res = atol(inbuf); if (res<0 || res>=numtargs) { printf(" [Please enter a number from 0 to %d]: ", numtargs-1); } else break; } qlist[ix].answer = res; break; case Qu_TargetBeing: case Qu_TargetBeingNone: case Qu_TargetWizard: case Qu_TargetWizardNone: case Qu_TargetRaiseDead: jx = (int)(qlist[ix].rock); spellnum = jx & (~QuVal_Hand_MASK); if (jx & QuVal_Hand_Left) handage = "with your left hand"; else if (jx & QuVal_Hand_Right) handage = "with your right hand"; else if (jx & QuVal_Hand_Both) handage = "with both hands"; else handage = "from the Delayed Effect"; if (spellnum==SP__STAB) sprintf(outbuf, "Who do you want to stab at (%s)?", handage); else sprintf(outbuf, "Who do you want to cast %s at (%s)?", spelllist[spellnum].name, handage); printf("%d: %s\n", qlist[ix].player, outbuf); targnum = 0; if (qlist[ix].qtype==Qu_TargetBeingNone || qlist[ix].qtype==Qu_TargetWizardNone) { targetlist[targnum] = 0; targetnamelist[targnum] = "nobody"; targnum++; } numtargs = NumberOfTargets(gameval, QuVal_Target_Wizard); for (jx=0; jx=numtargs) { printf(" [Please enter a number from 0 to %d]: ", numtargs-1); } else break; } qlist[ix].answer = targetlist[res]; } break; default: printf("ERROR: Unknown query type %d!\n", qlist[ix].qtype); break; } } } int cheap_translate(ch) char ch; { switch (ch) { case 'p': case 'P': return Gesture_PALM; case 'f': case 'F': return Gesture_FINGERS; case 'd': case 'D': return Gesture_DIGIT; case 's': case 'S': return Gesture_SNAP; case 'c': case 'C': return Gesture_CLAPHALF; case 'w': case 'W': return Gesture_WAVE; case 'k': case 'K': return Gesture_KNIFE; case ' ': case 'n': case 'N': default: return Gesture_NOTHING; } } void show_beings(gameval) game *gameval; { int ix, max, hp; printf("\n"); max = NumberOfBeings(gameval, QuVal_Target_Wizard); for (ix=0; ix=0) printf("%s (%d); ", NameOfBeing(gameval, QuVal_Target_Wizard, ix), hp); } max = NumberOfBeings(gameval, QuVal_Target_Creature); for (ix=0; ix=0) printf("%s (%d); ", NameOfBeing(gameval, QuVal_Target_Creature, ix), hp); } printf("\n"); } main(argc, argv) int argc; char *argv[]; { struct interface procs; struct maingame ignorerock; game *gameval; static char *namelist[MAXPLAYERS] = {"Arnold", "Barbara", "Crash"}; static int genderlist[MAXPLAYERS] = {Gender_MALE, Gender_FEMALE, Gender_NEUTER}; static int movelist[MAXPLAYERS*2]; static char inbuf[256]; int numplayers, whowon; int ix, val; procs.proc_PrintMsg = PrintMsg; procs.proc_PrintMsg2 = PrintMsg2; procs.proc_PrintMsg3 = PrintMsg3; procs.proc_Queries = Queries; numplayers = 2; if (argc==2 && !strcmp(argv[1], "-3")) { numplayers = 3; } else if (argc>=2) { numplayers = 0; for (ix=1; ix MAXPLAYERS) { printf("There is a maximum of %d players!\n", MAXPLAYERS); exit(12); } gameval = BeginGame(numplayers, namelist, genderlist, &procs, &ignorerock); do { show_beings(gameval); val = 0; switch (TurnType(gameval)) { case Turn_HASTE: printf("(hasted) "); break; case Turn_TIMESTOP: printf("(timestopped) "); break; case Turn_NORMAL: default: break; } for (ix=0; ix #include #include #include "handwave.h" #include "spelllist.h" #include "xspell.h" #define TEXT_WID (400) #define TEXT_HGT (512) #define TEXT_X (32) #define TEXT_Y (32) #define MAXLINESIZE (512) /* maximum number of chars that could possibly fit in a line. If the player uses bits1, this will probably crash. Tough. */ static void redraw_text_only(); void redraw_scrollbar(); void init_xtext(pnum) int pnum; { struct player *py = &(players[pnum]); static XCharStruct overall; int direction, ascent, descent; py->cursx = 0; py->sitext.nlines = 0; XTextExtents(py->font, "pl", 2, &direction, &ascent, &descent, &overall); py->lineheight = ascent+descent; if (py->lineheight <= 12) py->lineheight += 2; else py->lineheight = (int)((double)(py->lineheight)*1.17); py->texty = TEXT_Y + ascent + 1; py->textx = TEXT_X; py->sitext.visible = (TEXT_HGT-2) / py->lineheight; py->ascent = ascent; py->totalheight = ascent+descent; py->lineindex_size = 10; py->lineindex = (struct line *)malloc(sizeof(struct line)*py->lineindex_size); py->linebuf_size = 2*MAXLINESIZE; py->linebuf = (char *)malloc(py->linebuf_size); strcpy(py->linebuf, ""); py->addpoint = 0; py->lineindex[0].start = 0; py->sitext.py = py; py->sitext.top = 0; py->sitext.lineheight = py->lineheight; py->sitext.x = TEXT_X; py->sitext.y = TEXT_Y; py->sitext.h = TEXT_HGT; py->sitext.redraw = redraw_text_only; } static void redraw_text_only(py, baronly) struct player *py; int baronly; { int ix, sline; int len, width; if (!baronly) { /* draw text */ for (ix=py->sitext.top; ix<=py->sitext.nlines; ix++) { sline = ix - py->sitext.top; if (sline>=py->sitext.visible) break; if (ix==py->sitext.nlines) { len = strlen(py->linebuf+py->lineindex[ix].start); } else { len = py->lineindex[ix].len; } width = py->lineindex[ix].width; XDrawImageString(py->dpy, py->win, py->blackgc, py->textx, py->texty + py->lineheight*sline, py->linebuf+py->lineindex[ix].start, len); XClearArea(py->dpy, py->win, py->textx+width, py->texty + py->lineheight*sline - py->ascent, TEXT_WID-width, py->totalheight, 0); } } redraw_scrollbar(&(py->sitext)); } void complete_line(py) struct player *py; { int ln = py->sitext.nlines; int jump; static XCharStruct overall; int direction, ascent, descent; char *start; if (ln+2 >= py->lineindex_size) { py->lineindex_size *= 2; py->lineindex = (struct line *)realloc(py->lineindex, sizeof(struct line)*py->lineindex_size); } start = py->linebuf+py->lineindex[ln].start; py->lineindex[ln].len = strlen(start); XTextExtents(py->font, start, py->lineindex[ln].len, &direction, &ascent, &descent, &overall); py->lineindex[ln].width = overall.width; /* set up new incomplete line */ py->lineindex[ln+1].start = py->lineindex[ln].start+py->lineindex[ln].len + 1; /* len will not be computed until line is finished */ py->lineindex[ln+1].width = 0; start = NULL; if (py->lineindex[ln+1].start+MAXLINESIZE >= py->linebuf_size) { py->linebuf_size *= 2; py->linebuf = (char *)realloc(py->linebuf, py->linebuf_size); } strcpy(py->linebuf+py->lineindex[ln+1].start, ""); py->addpoint = py->lineindex[ln+1].start; py->cursx = 0; py->sitext.nlines++; if (py->sitext.nlines-py->sitext.top == py->sitext.visible) { jump = ((py->sitext.nlines-py->sitext.top) - py->sitext.visible) + 1; py->sitext.top += jump; if (!py->backstore) redraw_text_only(py, 0); } else { if (!py->backstore) redraw_text_only(py, 1); } } void redraw_text(py) struct player *py; { XDrawRectangle(py->dpy, py->win, py->blackgc, TEXT_X-3, TEXT_Y-2, TEXT_WID+4, TEXT_HGT+3); XDrawRectangle(py->dpy, py->win, py->blackgc, TEXT_X-SCROLL_W, TEXT_Y-2, SCROLL_W-3, TEXT_HGT+3); redraw_text_only(py, 0); } void dump_text(pnum, str) int pnum; char *str; { struct player *py = &(players[pnum]); char *cx, *cy; int tmp; char *chtmp; int len, width, sline; static XCharStruct overall; int direction, ascent, descent; if (!str) return; cx = str; while (*cx) { for (cy=cx; !(*cy=='\0' || *cy=='\n' || (*cy==' ' && cy>cx && *(cy-1)!=' ')); cy++); len = (cy-cx); XTextExtents(py->font, cx, len, &direction, &ascent, &descent, &overall); width = overall.width; if (width >= TEXT_WID - py->cursx) { complete_line(py); } sline = py->sitext.nlines - py->sitext.top; if (sline>=0 && slinesitext.visible) { py->gotexpose = 1; if (!py->backstore) XDrawImageString(py->dpy, py->win, py->blackgc, py->textx+py->cursx, py->texty + py->lineheight*sline, cx, len); } chtmp = py->linebuf+py->addpoint; for (tmp=0; tmpaddpoint += len; py->cursx += width; py->lineindex[py->sitext.nlines].width = py->cursx; if (*cy=='\n') { complete_line(py); cy++; } cx = cy; } } int in_scrollbar_box(si, xpos, ypos) struct scroll_interface *si; int xpos, ypos; { return (xpos >= si->x-SCROLL_W && xpos < si->x && ypos >= si->y && ypos < si->y+si->h); } void redraw_scrollbar(si) struct scroll_interface *si; { struct player *py = si->py; int sbeg, send; /* draw scrollbar */ if (si->nlines) { sbeg = (si->top)*si->h / si->nlines; send = (si->top+si->visible)*si->h / si->nlines; if (send>si->h) send = si->h; } else { sbeg = 0; send = si->h; } if (sbeg>0) { XFillRectangle(py->dpy, py->win, py->whitegc, si->x-SCROLL_W+2, si->y, SCROLL_W-6, sbeg); } XFillRectangle(py->dpy, py->win, py->blackgc, si->x-SCROLL_W+2, si->y+sbeg, SCROLL_W-6, send-sbeg); if (sendh) { XFillRectangle(py->dpy, py->win, py->whitegc, si->x-SCROLL_W+2, si->y+send, SCROLL_W-6, si->h-send); } } int scrollbar_hit(si, xpos, ypos, button) struct scroll_interface *si; int xpos, ypos; int button; { int sbeg, send; if (si->nlines) { sbeg = (si->top)*si->h / si->nlines; send = (si->top+si->visible)*si->h / si->nlines; if (send>si->h) send = si->h; } else { sbeg = 0; send = si->h; } if (ypos>=si->y+sbeg && yposy+send) { si->grip = ypos - (si->y+sbeg); } else { si->grip = (-1); } si->moved = 0; si->py->scroll_active = si; return ms_Scroll; } int scrollbar_motion(si, xpos, ypos, button) struct scroll_interface *si; int xpos, ypos; int button; { int newtop; si->moved = 1; if (si->grip != (-1)) { newtop = (ypos-si->grip-si->y)*si->nlines / si->h; if (newtop > si->nlines - si->visible + 1) newtop = si->nlines - si->visible + 1; if (newtop<0) newtop = 0; if (si->top != newtop) { si->top = newtop; (*(si->redraw))(si->py, 0); } } } int scrollbar_release(si, xpos, ypos, button) struct scroll_interface *si; int xpos, ypos; int button; { int ln; int newtop; if (!si->moved) { ln = (ypos-si->y) / si->lineheight; if (ln<=0) ln = 1; newtop = si->top; if (button==1) newtop += (ln); else if (button==3) newtop -= (ln); if (newtop > si->nlines - si->visible + 1) newtop = si->nlines - si->visible + 1; if (newtop<0) newtop = 0; if (si->top != newtop) { si->top = newtop; (*(si->redraw))(si->py, 0); } } } spellcast-1.0/spellcast.6100644 2756 144 113752 5731611051 13670 0ustar benusers.PU .TH SPELLCAST 6 local .SH NAME spellcast \- a game of duelling wizards .SH SYNOPSIS .B spellcast .I remotedisplay [ .I remotedisplay ... ] .PP One game window will appear on the default display (determined by the contents of the DISPLAY environment variable.) The second will appear on .I remotedisplay, which should be either an internet host name or a complete X display identifier (host:0.0, for example.) (If just a host name is given, display 0 and screen 0 are assumed.) If more .I remotedisplay arguments are supplied, additional windows will appear on those screens, and you will have a game with three or more players. .PP All other machines must add your machine to their X access lists, using .B xhost +. .PP There is a maximum of seven .I remotedisplay arguments -- ie, an eight-player game. .SH RESOURCES The game makes use of two X resources: .PP .B spellcast*name: .I namestring .br Sets the name used for your wizard. If you do not set this resource, the game assigns the names "White", "Black", "Red", and so forth. .br By default, each character is male. You can specify a gender by giving a .I namestring of the form .br .in+4 .I name:f for a female character, .br .I name:m for a male, .br .I name:n for a character whose gender is ambiguous or not well-defined in human terms, and .br .I name:x for a genderless character. .PP .B spellcast*font: .I fontname .br The font used for all text and labels in the game window. This should not be larger than about 12-point, or things will start to overflow their boundaries. .SH INTRODUCTION This is a game concerning the imaginary conflict between two or more powerful wizards in a duel of sorcery. The opponents perform magical gestures with their hands to create their supernatural weapons -- spells. Some are so potent as to be able to blind a man, call forth terrifying creatures, or even kill the unfortunate victim instantly. Consequently each wizard must rely on his own cunning to be able to time enough defensive spells to avoid the brunt of his adversary's attack, yet force in sufficient offensive spells of his own to crack the magical armour of his opponent, and kill the wizard outright. The inventor wishes to state that he has never been involved in a magical duel but would be interested to discover how realistic the game is for those who have... .SH THE TURN In a turn, each wizard can either gesture with his hands for part of a spell, stab with his knife, or do nothing. They use both hands, and the hands can act either independently or in concert. Monsters cannot make magical gestures but will obey their masters' commands exactly -- although the identity of the master could change as a result of enchantment. Since wizards are trained intelligent humans, they are able to gesture and attack, using both hands independently or in conjunction. Each monster, being an untrained, unintelligent biped, attacks the same way every time and picks whichever victim its master decides. As a result, only wizards can gesture and cast spells. Players personally acquainted with monsters who wish to vouch for their ability to cast spells are requested to keep quiet. .PP After choosing his or her gestures, each wizard must make a certain number of decisions -- choosing targets for his spells, ordering his monsters to attack particular targets, deciding the effects of certain spells, and so forth. After all players have chosen their gestures and made any necessary decisions, the effects of all spells and attacks are resolved .I simultaneously. The next turn then begins. .SH THE GAME WINDOW The .I spellcast window is divided into seven sections. .PP .B The text window .br This is a large rectangle in the upper left side of the window. It describes what happens in the duel, blow by blow. There is a scroll bar on the left side of the text window. .PP .B The gesture history list .br This is several columns of small squares in the upper right side of the window -- one pair of columns for each player. The player's names are listed at the tops of the columns. .PP Each column lists the recent gestures made by each player's left and right hands. The most recent gestures are at the bottom; as more turns pass, the columns scroll upwards. Each square may show a spell-gesture, a knife stab, or no gesture (an empty square). There may also be a 'disruption' icon, indicating that an 'anti-spell' has interrupted that wizard's gestures at that point, or a 'fog' icon, indicating that you could not see that gesture (because of blindness, for example.) .PP Note that everyone's columns in the history list do not necessarily scroll at the same rate. If one player makes extra gestures (because of a 'time-stop' or 'haste'), his column will scroll up extra spaces. Do not assume that gestures that appear to be lined up actually were performed at the same time. .PP You also use the gesture history list to enter your gestures. At the beginning of each turn, the bottom (most recent) gestures in your column will be empty. (The bottom gestures in your opponent's column will be fogged, since you cannot see his gestures until you both finish choosing.) If you move the mouse into one of your bottom gesture squares, and hold down the left mouse button, a pop-up menu will appear, listing the possible gestures with that hand. When you have chosen gestures for both hands, press the "End Move" button. .PP .B The status window .br This is the small window just below the gesture columns. It lists the name and status of every living being in the arena. Your name is at the top; your opponent's names are on successive lines. Names of monsters are indented, and listed below the wizards who control them. (Monsters who are uncontrolled are indented and listed at the top of the status window -- this occurs mostly in three-player game where a wizard has summoned a monster and then died.) There is a scroll bar on the window, in case you manage to have more beings than will fit. .PP After each name is the number of hit points that being has left. After that, there may be some letters indicating that certain spells are in effect: .br .in+8 I: invisible .br H: resistant to heat .br C: resistant to cold .br P: protection from evil .br b: blind .br d: diseased .br p: poisoned .in-8 .PP .B Speech window .br This is a narrow window, one line tall, below the status window. Anything you type will appear here (the cursor need not be in the speech window.) When you hit .I Return, the message you have typed will appear in each player's text window. .PP The common Emacs editing keys will work: .I ctrl-F, ctrl-B, Delete, ctrl-A, ctrl-E, ctrl-K. .PP .B Spell List button .br This is a button labelled "Spell List", underneath the text window. If you press and hold the mouse button on this button, a pop-up window will appear, listing all the spells and the gestures that produce them. .PP If you use the left mouse button, the spell list will be sorted by gesture. If you use the middle mouse button, the list will be sorted alphabetically by spell name. If you use the right mouse button, the list will be sorted by the .I reversed gesture sequence -- all the spells that .I end with a clap, then all the spells that end with a digit, and so forth. This is useful for looking up your opponent's gestures to see what he might be producing. .PP .B End Move / End Answers button .br This is a button labelled "End Move", underneath the text window. You should click it when you are finished entering your gestures at the start of the turn. If the button changes to read "Move ENDED", then you should wait for your opponent to finish entering his gestures. .PP When the last player presses the "End Move" button, the game will determine which players need to make decisions (about spell targets or other matters.) The decisions you need to make will be listed in the questions window below, and the "End Move" button will change to read "End Answers". When you are finished answering, press the button, and it will change to "Answers ENDED". .PP If at any time the button reads "please wait...", then you have nothing to do but wait. (This may be because there are no decisions you have to make this turn, or because your opponent is taking an extra turn because of a 'time stop' or something similar.) When your opponent is finished, he will click his "End" button and the game will proceed. .PP When the duel is over, this button will change to say "Quit". When all players have pressed it, the windows will be removed and the program will exit. .PP .B Question window .br This is the wide rectangle at the bottom of the screen. Whenever the game has decisions for you to make, it will put them in this window, one per line. (There is a scroll bar, in case there are more questions than lines.) Move the cursor onto a question and hold down the mouse button to get a pop-up menu listing the possible answers. .PP You must have answers to all the questions before you click the "End Answers" button. In some cases, there will be default answers already listed. You may change the answer or leave it alone. .SH GAME TRANSCRIPTS At the end of the game, in addition to his "Quit" button, the player who started the game will see the question "Do you want to save a transcript of this game?" If he answers "yes" before hitting "Quit", the program will store a text transcript of the game in a temporary directory (usually .I /tmp, unless your environment is configured otherwise.) This transcript will show all gestures made by each player, as well as all the text of the game, as seen by an outside observer. Everything said by any of the players will also be in the transcript, including comments made after the end of the game. The filename of the transcript will be printed on the standard output when all players have quit. .SH GESTURES Spells are created by sequences of gestures made with the hands. There are five single-handed gestures: the fingers spread "F", the palm facing forward, "P", the snap "S", the wave "W" and the pointing digit "D". Some spells use two-handed gestures, which must be done simultaneously with both hands to be valid. The most common two-handed gesture is the clap "(c", but the double digit "(d", double wave "(w", and double snap "(s" are also used. The other things which can be done with the hand are the non-gestures: the knife stab "k" and nothing " ". .br (In the game, the gestures are represented by images of the hands in the various positions. The single-letter and parenthesis-letter abbreviations are used only to make this man page readable.) .PP To cast a spell, gestures are put in an order characteristic of a spell. A list of spells (including the gestures needed for them) is given later. For example, 3 finger gestures on consecutive turns (F-F-F) initiates a 'paralysis' spell. The uniqueness of the game, however, is that gestures can be made to operate in more than one spell, provided that: .br .in+4 a) the gestures have been made in the correct sequence without interruption; .br b) not more than one spell is created per gesture; .br. c) all gestures for one spell are made with the same hand. .in-4 .PP For instance, the left hand could cast the F-F-F above and could be followed by S-S-D-D in the next 4 turns to finish off a 'fireball' spell (F-S-S-D-D) as the last 5 gestures are those associated with that spell. Another alternative is to simply perform another F for a second paralysis spell, as the last 3 gestures are still F-F-F. Thus, it is apparent that if spells are used in a wise manner and overlap a lot, the overall number of gestures needed to cast them can be cut quite dramatically. .PP If a gesture can be construed to create two or more spells then the caster must choose which one he wants to use. For example, the last two gestures of a 'finger of death' are the same as 'missile', yet only on odd occasions would the latter be used. Another example of the one-spell-per-gesture concept is the following: .PP Right hand: P P W S Last 4 gestures form 'invisibility' .br Left hand: W W W S Last 3 gestures form 'counter-spell' .PP The trouble here is the 'invisibility' spell needs both hands to perform certain gestures. However, since the final S of the left hand cannot complete two spells it is clear that a choice must be made between the W-W-S of the 'counter-spell' and the P-P-(w-(s of the invisibility. The caster must choose one spell if the gestures are completed in the correct sequence. Most spells can be shot off to nowhere if not required, but some cannot be; for example, 'fire storm', which gets you no matter where it is released. Some of the larger spells have smaller ones incorporated within. .PP Spells can be aborted any way along their development simply by performing a gesture with the hand doing the spell which is not one needed for that spell. There is no penalty, save having wasted some time. Note that no spells contain "stab", "nothing", or "C" (half of a clap) and consequently after pursuing one of these alternatives, any spell must start from scratch. Note also that wizards only have one dagger each, so they cannot stab with both hands at the same time (although they can change hands for stabbing without wasting time.) Such are the disadvantages of physical violence... .PP Certain spells cancel each other if they take effect simultaneously. An obvious example is 'finger of death' and 'raise dead'. Cancellation occurs when the subject for the spells concerned is the same person, although there are some of the heat versus cold variety which don't care who is the subject. Other spells which cancel harmlessly are mostly the enchantments, which direct that something be done which may be impossible to obey due to some contradiction (e.g. you cannot both repeat last turn's gestures and give a random gesture with one hand, as you would if the subject of the spells 'amnesia' and 'confusion' at once). .PP Since spells detonate simultaneously, there is occasionally confusion over spells which don't cancel, yet which seem to depend on which happened first. The best example is when a monster is created and, on the same turn, hit by a 'fireball', or something else sufficient to kill it. Since both are simultaneous, the monster will attack that turn whilst being destroyed. (There are some exceptions explicitly mentioned, for example ice elementals in 'ice storm', or 'counter-spell' / 'dispel magic' against all other spells.) .PP Another example of a seeming conflict is when someone who is resistant to fire is the subject of both a 'remove enchantment' and 'fireball'; the enchantment is removed as the fireball explodes (since they are simultaneous) hence the poor victim is fried. If, instead, he were not resistant to fire and was hit by a 'resist fire' and 'fireball' at once, then he would start to resist fire as the fireball exploded and thus be saved. .PP Before the battle commences, the referee casts a 'dispel magic' followed by an 'anti-spell' at each of the wizards. This is so that they cannot commence gesturing prematurely. Thus being resistant to fire in your last battle doesn't do you any good in the next. .SH WINNING Each wizard can sustain 14 points of damage, but on the 15th or above he dies and the surviving wizard is declared the winner. Simultaneous death is a posthumous draw. Damage given to wizards and monsters is cumulative (so you don't have to do it all in one go!) Dead monsters take no further part in the game. .PP There is another alternative to being killed, namely the 'surrender'. This is not a spell, but a pair of P gestures made by both hands at the same time. If any wizard does this (accidentally or deliberately), he has surrendered, and will be eliminated from the game at the end of that turn. See the end of the spell list for details. .SH SPELLS There now follows, in four sections, a list of the spells which may be cast. .PP .B Protection spells .PP .I 'Shield': .B P .PP This spell protects the subject from all attacks from monsters (that is, creatures created by a summoning spell), from 'missile' spells, and from stabs by wizards. The shield lasts for that turn only, but one shield will cover all such attacks made against the subject that turn. .PP .I 'Remove enchantment': .B P-D-W-P .PP If the subject of this spell is currently being affected by any of the spells in the "enchantments" section, or if spells from that section are cast at him at the same time as the remove enchantment, then all such spells terminate immediately (although their effect for that turn might already have passed.) For example, the victim of a 'blindness' spell would not be able to see what his opponent's gestures were on the turn that his sight is restored by a 'remove enchantment'. Note that the 'remove enchantment' affects all enchantments whether the caster wants them to all go or not. A second effect of the spell is to destroy any monster upon which it is cast, although the monster can attack in that turn. .PP .I 'Magic mirror': .B (c-(w .PP Any spell cast at the subject of this spell is reflected back at the caster of that spell for that turn only. This includes spells like 'missile' and 'lightning bolt' but does not include attacks by monsters already in existence, or stabs from wizards. Note that certain spells are cast by wizards usually upon themselves (e.g. spells from this section and the "Summons" section); the mirror has no effect on these spells. It is countered totally, with no effect whatsoever, if the subject is the simultaneous subject of either a 'counter-spell' or 'dispel magic'. It has no effect on spells which affect more than one person, such as 'fire storm'. Two mirrors cast at someone simultaneously combine to form a single mirror. If a spell is reflected from a mirror back at a wizard who .I also has a mirror, the spell bounces back and forth until it falls apart. .PP .I 'Counter-spell': .B W-P-P .I or .B W-W-S .PP Any other spell cast upon the subject in the same turn has no effect whatever. In the case of blanket-type spells, which affect more than one person, the subject of the 'counter-spell' alone is protected. For example, a 'fire storm' spell would not affect a wizard if that wizard was simultaneously the subject of a 'counter-spell', but everyone else would be affected as usual (unless they had their own protection.) The 'counter-spell' will cancel all the spells cast at the subject for that turn, including 'remove enchantment' and 'magic mirror', but not 'dispel magic' or 'finger of death'. It will combine with another spell of its own type for the same effect as if it were alone. The 'counter-spell' will also act as a 'shield' on its subject, in addition to its other properties. The spell has two alternative gesture sequences, either of which may be used at any time. .PP .I 'Dispel magic': .B (c-D-P-W .PP This spell acts as a combination of 'counter-spell' and 'remove enchantment', but its effects are universal rather than limited to the subject of the spell. It will stop any spell cast in the same turn from working (apart from another 'dispel magic' spell which combines with it for the same result), and will remove all enchantments from all beings before they have effect. In addition, all monsters are destroyed, although they can attack that turn. 'Counter-spells' and 'magic mirrors' have no effect. Like the 'counter-spell', it also acts as a 'shield' for its subject. 'Dispel magic' will not dispel stabs or surrenders, since they are not spells (although the 'shield' effect may block a stab.) .PP .I 'Raise dead': .B D-W-W-F-W-(c .PP The subject of this spell is usually a recently dead human or monster corpse (it will not work on elementals, which dissipate when destroyed.) When the spell is cast, life is instilled back into the corpse and any damage which it has sustained is cured until the owner is back to his usual state of health. A 'remove enchantment' effect is also manifest so any 'diseases' or 'poisons' will be neutralized (plus any other enchantments). The subject will be able to act as normal immediately, so that next turn he can gesture, fight, etc. If the subject is a monster, it will be under the control of the wizard who raised it, and it will be able to attack that turn. .br If the spell is cast on a live individual, the effect is that of a 'cure wounds' recovering 5 points of damage, or as many as have been sustained if less than 5. In this case, 'diseases', 'poisons', and other enchantments are .I not removed. .br This is the only spell which affects corpses properly; therefore, it cannot be stopped by a 'counter-spell', since 'counter-spell' can only be cast on living beings. A 'dispel magic' spell will stop it, since that affects all spells no matter what their subject. Once alive the subject is treated as normal. .PP .I 'Cure light wounds': .B D-F-W .PP If the subject has received damage then he is cured by 1 point as if that point had not been inflicted. (Recall that all spells are resolved simultanously; if a wizard is suffers his 15th point of damage at the same time as he is affected by 'cure light wounds', he will remain alive with 14 points of damage at the end of the turn.) The effect is not removed by a 'dispel magic' or 'remove enchantment'. .PP .I 'Cure heavy wounds': .B D-F-P-W .PP This spell is the same as 'cure light wounds' for its effect, but 2 points of damage are cured instead of 1, or only 1 if only 1 had been sustained. A side effect is that the spell will also cure a disease. (Note that 'raise dead' on a live individual won't). .PP .B Summons spells .PP .I 'Summon Goblin': .B S-F-W .PP This spell creates a goblin under the control of the wizard upon whom the spell is cast. The goblin can attack immediately and its victim can be any any wizard or other monster the controller desires. The goblin does 1 point of damage to its victim per turn and is destroyed after 1 point of damage is inflicted upon it. .PP .I 'Summon Ogre': .B P-S-F-W .PP This spell is the same as 'summon goblin', but the ogre created inflicts and is destroyed by 2 points of damage rather than 1. .PP .I 'Summon Troll': .B F-P-S-F-W .PP This spell is the same as 'summon goblin', but the troll created inflicts and is destroyed by 3 points of damage rather than 1. .PP .I 'Summon Giant': .B W-F-P-S-F-W .PP This spell is the same as 'summon goblin', but the giant created inflicts and is destroyed by 4 points of damage rather than 1. .PP .I 'Summon Elemental': .B (c-S-W-W-S .PP This spell creates either a fire elemental or an ice elemental, at the discretion of the wizard upon whom the spell is cast (after he has seen all the gestures made that turn.) .PP Elementals must be cast at someone and cannot be "shot off" harmlessly at some inanimate object. The elemental will, for that turn and until destroyed, attack everyone (including its owner, and other monsters), causing 3 points of damage per turn. Only wizards and monsters who are resistant to the elemental's element (heat or cold), or who have a 'shield' or a spell with a 'shield' effect, are safe. The elemental takes 3 points of damage to be killed but may be destroyed by spells of the opposite type (e.g. 'fire storm', 'resist cold' or 'fireball' will kill an ice elemental), and will also neutralize the cancelling spell. Elementals will not attack on the turn they are destroyed by such a spell. An elemental will also be engulfed and destroyed by a storm of its own type but, in such an event, the storm is not neutralized although the elemental still does not attack in that turn. Two elementals of the opposite type will also destroy each other before attacking, and two of the same type will join together to form a single elemental of normal strength. If there are two opposite storms and an elemental, or two opposite elementals and one or two storms, all storms and elementals cancel each other out. .PP .B Damaging Spells .PP .I 'Missile': .B S-D .PP This spell creates a material object of hard substance which is hurled towards the subject of the spell and causes him 1 point of damage. The spell is thwarted by a 'shield' in addition to the usual 'counter-spell', 'dispel magic' and 'magic mirror' (the latter causing it to hit whoever cast it instead). .PP .I 'Finger of Death': .B P-W-P-F-S-S-S-D .PP Kills the subject stone dead. This spell is so powerful that it is unaffected by a 'counter-spell', although a 'dispel magic' spell cast upon the final gesture will stop it. The usual way to prevent being harmed by this spell is to disrupt it during casting -- using an 'anti-spell', for example. .PP .I 'Lightning Bolt': .B D-F-F-D-D .I or .B W-D-D-(c .PP The subject of this spell is hit by a bolt of lightning and sustains 5 points of damage. Resistance to heat or cold is irrelevant. There are two gesture combinations for the spell, but the shorter one may be used only once per battle by any wizard. The longer one may be used without restriction. A 'shield' spell offers no defence. .PP .I 'Cause Light Wounds': .B W-F-P .PP The subject of this spell is inflicted with 2 points of damage. Resistance to heat or cold offers no defence. A simultaneous 'cure light wounds' does not cancel the spell; it only heals one of the points of damage. A 'shield' has no effect. .PP .I 'Cause Heavy Wounds': .B W-P-F-D .PP This has the same effect as 'cause light wounds' but inflicts 3 points of damage instead of 2. .PP .I 'Fireball': .B F-S-S-D-D .PP The subject of this spell is hit by a ball of fire, and sustains 5 points of damage unless he is resistant to fire. If at the same time an 'ice storm' prevails, the subject of the 'fireball' is instead not harmed by either spell, although the storm will affect others as normal. If directed at an ice elemental, the fireball will destroy it before it can attack. .PP .I 'Fire storm': .B S-W-W-(c .PP Everything not resistant to heat sustains 5 points of damage that turn. The spell cancels wholly, causing no damage, with either an 'ice storm' or an ice elemental. It will destroy but not be destroyed by a fire elemental. Two 'fire storms' act as one. .PP .I 'Ice storm': .B W-S-S-(c .PP Everything not resistant to cold sustains 5 points of damage that turn. The spell cancels wholly, causing no damage, with either a 'fire storm' or a fire elemental; it will cancel locally with a 'fireball', sparing the subject of the 'fireball' but nobody else. It will destroy but not be destroyed by an ice elemental. Two 'ice storms' act as one. .PP .B Enchantments .PP .I 'Amnesia': .B D-P-P .PP If the subject of this spell is a wizard, next turn he must repeat identically the gestures he made in the current turn, including "nothing" and "stab" gestures. If the subject is a monster it will attack whoever it attacked this turn. If the subject is simultaneously the subject of any of 'confusion', 'charm person', 'charm monster', 'paralysis' or 'fear' then none of the spells work. .PP .I 'Confusion': .B D-S-F .PP If the subject of this spell is a wizard, next turn one of his gestures will be changed randomly. Either his left or his right hand (50% chance of either) will perform a half-clap, palm, digit, fingers, snap, or wave (chosen at random). (Recall that a one-handed clap is useless unless the other hand also attempts to clap.) If the subject of the spell is a monster, it attacks at random that turn. If the subject is also the subject of any of 'amnesia', 'charm person', 'charm monster', 'paralysis' or 'fear', none of the spells work. .PP .I 'Charm Person': .B P-S-D-F .PP Except for cancellation with other enchantments, this spell only affects wizards. When the spell is cast, the caster tells the subject which of his hands will be controlled; in the following turn, the caster chooses the gesture he wants the subject's chosen hand to perform. This could be a stab or nothing. If the 'charm person' spell reflects from a 'magic mirror' back at its caster, the subject of the mirror assumes the role of caster and controls down his opponent's gesture. If the subject is also the subject of any of 'amnesia', 'confusion', 'charm monster', 'paralysis' or 'fear', none of the spells work. .PP .I 'Charm Monster': .B P-S-D-D .PP Except for cancellation with other enchantments, this spell only affects monsters (but not elementals). Control of the monster is transferred to the caster of the spell (or retained by him) as of this turn; i.e., the monster will attack whosoever its new controller dictates from that turn onwards including that turn. Further charms are, of course, possible, transferring as before. If the subject of the charm is also the subject of any of: 'amnesia', 'confusion', 'charm person', 'fear' or 'paralysis', none of the spells work. .PP .I 'Paralysis': .B F-F-F .PP If the subject of the spell is a wizard, then on the turn the spell is cast, after gestures have been revealed, the caster selects one of the wizard's hands; on the next turn that hand is paralyzed into the position it is in this turn. If the wizard already had a paralyzed hand, it must be the same hand which is paralyzed again. Most gestures remain the same (including "stab" and "nothing"), but if the hand being paralyzed is performing a C, S, or W it is instead paralyzed into F, D, or P respectively. A favourite ploy is to continually paralyze a hand (F-F-F-F-F-F etc.) into a non-P gesture and then set a monster on the subject so that he has to use his other hand to protect himself, but then has no defence against other magical attacks. If the subject of the spell is a monster, it simply does not attack in the turn following the one in which the spell was cast. Elementals are unaffected. If the subject of the spell is also the subject of any of 'amnesia', 'confusion', 'charm person', 'charm monster' or 'fear', none of the spells work. .PP .I 'Fear': .B S-W-D .PP In the turn following the casting of this spell, the subject cannot perform a C, D, F or S gesture with either hand. (He can stab, however.) This obviously has no effect on monsters. If the subject is also the subject of 'amnesia', 'confusion', 'charm person', 'charm monster' or 'paralysis', then none of the spells work. .PP .I 'Anti-spell': .B S-P-F .PP On the turn following the casting of this spell, the subject cannot include any gestures made on or before this turn in a spell sequence and must restart a new spell from the beginning of that spell sequence. (This is marked by a special 'disruption' icon interrupting the subject's gesture history.) The spell does not affect spells which are cast on the same turn; nor does it affect monsters. .PP .I 'Protection from Evil': .B W-W-P .PP For this turn and the following three turns, the subject of this spell is protected as if using a 'shield' spell, thus leaving both hands free. Concurrent 'shield' spells offer no further protection, and compound 'protection from evil' spells merely overlap offering no extra cover. .PP .I 'Resist Heat': .B W-W-F-P .PP The subject of this spell becomes permanently resistant to all forms of heat attack ('fireball', 'fire storm' and fire elementals). Only 'dispel magic' or 'remove enchantment' will terminate this resistance once started (although a 'counter-spell' will prevent it from working if cast at the subject at the same time as this spell). A 'resist heat' cast directly on a fire elemental will destroy it before it can attack that turn, but there is no effect on ice elementals. .PP .I 'Resist Cold': .B S-S-F-P .PP The effects of this spell are identical to 'resist heat' but resistance is to cold ('ice storm' and ice elementals). It destroys ice elementals if they are the subject of the spell, but doesn't affect fire elementals. .PP .I 'Disease': .B D-S-F-F-F-(c .PP The subject of this spell immediately contracts a deadly (non-contagious) disease which will kill him at the end of 6 turns counting from the one upon which the spell is cast. The malady is cured by 'remove enchantment', 'cure heavy wounds' or 'dispel magic' in the meantime. .PP .I 'Poison': .B D-W-W-F-W-D .PP This is similar to the 'disease' spell, except that 'cure heavy wounds' does not stop its effects. .PP .I 'Blindness': .B D-W-F-F-(d .PP For the next three turns (not including the one in which the spell was cast), the subject is unable to see. If he is a wizard, he cannot tell what his opponent's gestures are, although he will sense what spells are cast. If he tries to cast spells (or stab) at other beings, he will miss. Blinded monsters are instantly destroyed and cannot attack in that turn. .PP .I 'Invisibility': .B P-P-(w-(s .PP This spell is similar to 'blindness'; the subject of the spell becomes invisible to his opponent and his monsters. His gestures cannot be seen, although his spells can. No other being can attack or cast spells at him, with the exception of elementals. Any monster made invisible is destroyed due to the unstable nature of such magically created creatures. .PP .I 'Haste': .B P-W-P-W-W-(c .PP For the next three turns, the subject is speeded up; wizards can make an extra set of gestures, and monsters can make an extra attack. For wizards, the effects of both sets of gestures are taken simultaneously at the end of the turn. Thus a single 'counter-spell' from his adversary could cancel two spells cast by the hastened wizard on two half-turns if the phasing is right. Non-hastened wizards and monsters can see everything the hastened individual is doing. Hastened monsters can change target in the extra turns if desired. .PP .I 'Time stop': .B S-P-P-(c .PP The subject of this spell immediately takes an extra turn, on which no-one can see or know about unless they are harmed. All non-affected beings have no resistance to any form of attack, e.g. a wizard halfway through the duration of a 'protection from evil' spell can be harmed by a monster which has had its time stopped. Time-stopped monsters attack whoever their controller instructs, and time-stopped elementals affect everyone, resistance to heat or cold being immaterial in that turn. .PP .I 'Delayed effect': .B D-W-S-S-S-P .PP This spell must be cast upon a wizard. The next spell the subject completes, provided it is in one of the next three turns, is "banked" until needed -- i.e. it fails to work until its caster desires. (If you have a spell banked, you will be asked each turn if you want to release it.) Note that spells banked are those cast .I by the subject, not those cast .I at him. If he casts more than one spell at the same time, he chooses which is to be banked. Remember that P is a 'shield' spell, and surrender is not a spell. A wizard may only have one spell banked at any one time. .PP .I 'Permanency': .B S-P-F-P-S-D-W .PP This spell must be upon a wizard. The next spell he completes, provided it is in the next three turns, and which falls into the category of "Enchantments" will have its effect made permanent. (Exeptions: 'anti-spell', 'disease', 'poison', 'time-stop', 'delayed effect', and 'permanency' cannot be made permanent. Note that 'resist heat' and 'resist cold' are inherently permanent enchantments.) This means that the effect of the extended spell on the first turn of its duration is repeated eternally. For example, a 'confusion' spell will produce the same gesture on the same hand rather than changing randomly each turn; a 'charm person' will mean repetition of the chosen gesture, etc. If the subject of the 'permanency' casts more than one spell at the same time eligible for permanency, he chooses which has its duration extended. Note that the person who has his spell made permanent does not necessarily have to make himself the subject of the spell. If both a 'permanency' and 'delayed effect' are eligible for the same spell to be banked or extended, a choice must be made; whichever is not chosen will affect the next eligible spell instead. .PP .B Non-spells .PP .I 'Surrender': .B (p .PP This is not a spell; consequently, it cannot be cast at anyone, nor can it be dispelled, counter-spelled, reflected off a mirror, or banked. A wizard who makes two simultaneous P gestures, irrespective of whether they terminate spells or not, surrenders and the contest is over. The surrendering wizard is deemed to have lost unless his gestures complete spells which kill his opponent. Two simultaneous surrenders count as a draw. It is a necessary skill for wizards to work their spells so that they never accidentally perform two P gestures simultaneously. Wizards can be killed as they surrender (if hit with appropriate spells or attacks) but the "referees" will cure any diseases, poisons, etc. immediately after the surrender for them. .PP .I 'Stab': .B stab .PP This is not a spell, but an attack which can be directed at any individual monster or wizard. Unless protected in that turn by a 'shield' spell or another spell with the same effect, the target stabbed suffers 1 point of damage. The wizard only has one knife, so can only stab with one hand in any turn, although which hand doesn't matter. The stab cannot be reflected, counter-spelled, dispelled, or banked. .SH BUGS Does not conform exactly to the original .I Spellcaster rules. Tough. Some points of divergence: .PP The choosing of targets for monsters is handled much too late in the round, and monster attacks are not perfectly simultaneous with spell attacks. This results in a number of minor effects which are inconsistent with the original rules. Since I don't plan to do a major rewrite anytime soon, you just get to live with it. .PP If 'remove enchantment' is cast on a wizard who is also the subject of a summoning spell, the summoned monster should be destroyed after attacking. .PP If a mind-control spell (paralysis, confusion, amnesia) is cast on a monster by a time-stopped wizard, the spell should take effect on the next turn, rather than (as currently happens) the turn after next. .PP The 'delayed effect' and 'permanency' spells should be able to bank or extend spells cast during the same turn, as well as those cast during the next three turns. .SH HISTORY The original paper-and-pencil version of this game, entitled .I Spellbinder, was created by Richard Bartle; it was printed in his zine .I Sauce of the Nile. He attempted to have it commercially produced, but apparently didn't get very far. .br It was reprinted (with some changes) as .I Spellcaster in the fanzine .I Duel Purpose, written by Mike Lean. From there, it was scanned and posted to the Net by Andrew Buchanan (buchanan@heron.enet.dec.com). I grabbed it and wrote this X version. .br Richard Bartle <76703.3042@compuserve.com> would like to point out that he is not at all dead. He has nicely given his permission to distribute this program, as long as it remains free. .SH AUTHOR Andrew Plotkin spellcast-1.0/spelllist.ps100644 2756 144 42753 5515617406 14162 0ustar benusers%! /centershow {gsave dup stringwidth pop 2 div neg 0 rmoveto show grestore} def /clapstr 288 string def /snapstr 288 string def /wavestr 288 string def /digitstr 288 string def /palmstr 288 string def /fingerstr 288 string def currentfile clapstr readhexstring ffffffffffffffffffffffffffffffffffffffffffff3fffffffffff1fff fffffffe1ffffffffffe1ffffffffffe1ffffffffffc3ffffffffff83fff fffffff83ffffffffff87ffffffffff07ffffffffff07fffffffffe07fff ffffffe0ffffffffffe0ffffffffffc0ffffffffffc0ffffffffffc0ffff ffffffc0ffffffffffc0ffffffffffc0ffffffffff80ffffffffff80ffff ffffff80ffffffffff80ffffffffffc07fffffffffc07fffffffffc07fff ffffffc07fffffffffc07fffffffffc03fffffffffc03fffffffffc01fff ffffffc01fffffffffc01fffffffffc00fffffffff800fffffffff800fff ffffff801fffffffff001ffffffffe001ffffffffe003ffffffffc003fff fffff0007fffffffe000ffffffffffffffff pop pop currentfile snapstr readhexstring fffffffffffffffffffffffffffff7ffbffffffffbffbffffffffdffbfff fffffdff7ffffffffeff7fffffffffffffffffffffffff3ffffffffff8ff ffffffc7f7ffffffff03fffffffff803fffffffff000ffffffffc0007fff ffff00007ffffffe00007e03fffc00007ffffff800607ffffff000e07fff ffe001e0ffffffc003c0ffffff8007c0fbffff000f80fdffff001f01feff fe001e01ff7ffe003c01fffffc002001fffffc000000fffffc0000007fff fc0000003ffffc0000001ffffe0000001fffff0000001fffff0000000fff ffc000000fffffe000000ffffff000000ffffff800000ffffffe00000fff ffff00000fffffff80000fffffffc0001fffffffe0001fffffffe0003fff fffff8003ffffffff8007fffffffffffffff pop pop currentfile wavestr readhexstring ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fffffffffffffffffffffffffffffffffffffffffffffffffffffff0ffff ffffffe07fffffffff807fffffffff01fffffffffc03fffffffff007ffff ffffc01fffffffff803fffffffff007fffffffff00fffffffffe01ffffff fffc03fffffffff803fffffffff007ffffffffe007ffffffffc00fffffff ffc00fffffffff8007ffffffff8007ffffffff8003ffffffffc001ffffff ffe000fffffffff0003ffffffff8001ffffffffc000ffffffffe0007ffff ffff0003ffffffff8000ffffffffc0007fffffffe0003ffffffff0001fff fffff0001ffffffff0000ffffffff0000ffffffff0000fffffffe0000fff ffffc0001fffffffc0003fffffffffffffff pop pop currentfile digitstr readhexstring fffffffffffffffffffffffffffffffffffffffffffcfffffffffffc7fff fffffff87ffffffffff87ffffffffff07ffffffffff07fffffffffe0ffff ffffffe0ffffffffffe0ffffffffffc1ffffffffffc1ffffffffff81ffff ffffff81ffffffffff03ffffffffff03fffffffffe03fffffffffc03ffff ffffc003ffffffffc003fffffffe0003fffffffc00021ffffffc00001fff ffe000003fffffe000003fffffc000003fffff8000007fffff8000007fff ff8000007fffff8000007fffff8000007fffff8000007fffff800000ffff ff800000ffffff800001ffffff800001ffffff800003ffffffc00003ffff ffc00007ffffffe0000ffffffff0001ffffffff0001ffffffff0007fffff ffe000ffffffffc000ffffffffffffffffff pop pop currentfile palmstr readhexstring fffffffffffffffffffffffffffffe7ffffffffffe3ffffffffffc39ffff fffffc38fffffffffc30ffffffff9c30ffffffff1c30ffffffff0c30ffff ffff0c30ffffffff0c30ffffffff0c30ffffffff0c30ffffffff0c30ffff ffff0c30fffffff70c30ffffffe30c30ffffffe30c30ffffffe30c30ffff ffe30c30ffffffc30c10ff3fffc20800fe3fffc20000fe3fffc20000fc3f ffc20000fc3fffc00000783fffc00000783fffc00000707fffc00000607f ffc00000407fffc00000007fffc0000000ffffc0000000ffffc0000001ff ffc0000003ffffe0000003ffffe0000007ffffe000000fffffe000000fff fff000001ffffff000001ffffff000003ffffff800007ffffff800007fff fffc0001fffffffe0001ffffffffffffffff pop pop currentfile fingerstr readhexstring ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff fffffffffffffffffffffffffffffffffffffffffffffffffffffcf87fff fffff8707ffffffff0e0ffffffffc1c1fc3fffff8383f03fffff0707e07f ffe70e0fc0ffffc60c1f83ffff861c1f03ffff0c183e07ffff18183e0fff fe18383c0ffffe30303c1ffffc3030381ffffc2060103ffffc2000003fff fc0000003ffffc0000003ffffc0000007e3ffc0000007e3ffc0000007c3f fc000000783ffc000000703ffc000000607ffe000000007ffe00000000ff fe00000001fffe00000003fffe00000007ffff0000000fffff8000003fff ff8000007fffff000000fffffe000003fffffc00000ffffff800001fffff f000007ffffff000007fffffffffffffffff pop pop /showfinger { gsave translate 12 12 scale 48 48 false [ 48 0 0 -48 0 48 ] { fingerstr } imagemask grestore } def /showpalm { gsave translate 12 12 scale 48 48 false [ 48 0 0 -48 0 48 ] { palmstr } imagemask grestore } def /showdigit { gsave translate 12 12 scale 48 48 false [ 48 0 0 -48 0 48 ] { digitstr } imagemask grestore } def /showsnap { gsave translate 12 12 scale 48 48 false [ 48 0 0 -48 0 48 ] { snapstr } imagemask grestore } def /showwave { gsave translate 12 12 scale 48 48 false [ 48 0 0 -48 0 48 ] { wavestr } imagemask grestore } def /showclap { gsave translate 12 12 scale 48 48 false [ 48 0 0 -48 0 48 ] { clapstr } imagemask grestore } def /showclap2 { gsave translate 12 12 scale -0.3 0 translate 48 48 false [ 48 0 0 -48 0 48 ] { clapstr } imagemask 1.6 0 translate -1 1 scale 48 48 false [ 48 0 0 -48 0 48 ] { clapstr } imagemask grestore } def /showdigit2 { gsave translate 12 12 scale -0.0 0 translate 48 48 false [ 48 0 0 -48 0 48 ] { digitstr } imagemask 1.5 0 translate -1 1 scale 48 48 false [ 48 0 0 -48 0 48 ] { digitstr } imagemask grestore } def /showwave2 { gsave translate 12 12 scale -0.0 0 translate 48 48 false [ 48 0 0 -48 0 48 ] { wavestr } imagemask 1.55 0 translate -1 1 scale 48 48 false [ 48 0 0 -48 0 48 ] { wavestr } imagemask grestore } def /showsnap2 { gsave translate 12 12 scale -0.0 0 translate 48 48 false [ 48 0 0 -48 0 48 ] { snapstr } imagemask 1.55 0 translate -1 1 scale 48 48 false [ 48 0 0 -48 0 48 ] { snapstr } imagemask grestore } def /showpalm2 { gsave translate 12 12 scale -0.2 0 translate 48 48 false [ 48 0 0 -48 0 48 ] { palmstr } imagemask 1.6 0 translate -1 1 scale 48 48 false [ 48 0 0 -48 0 48 ] { palmstr } imagemask grestore } def /nullact { pop pop } def /Times-Roman findfont 12 scalefont setfont 0.5 setlinewidth 72 699 showclap2 84 699 showdigit 96 699 showpalm 108 699 showwave 123 704 moveto 176 704 lineto stroke 180 700 moveto (Dispel Magic) show 72 683 showclap2 84 683 showsnap 96 683 showwave 108 683 showwave 120 683 showsnap 135 688 moveto 176 688 lineto stroke 180 684 moveto (Summon Elemental) show 72 667 showclap2 84 667 showwave2 104 672 moveto 176 672 lineto stroke 180 668 moveto (Magic Mirror) show 72 651 showdigit 84 651 showfinger 96 651 showfinger 108 651 showdigit 120 651 showdigit 135 656 moveto 176 656 lineto stroke 180 652 moveto (Lightning Bolt) show 72 635 showdigit 84 635 showfinger 96 635 showpalm 108 635 showwave 123 640 moveto 176 640 lineto stroke 180 636 moveto (Cure Heavy Wounds) show 72 619 showdigit 84 619 showfinger 96 619 showwave 111 624 moveto 176 624 lineto stroke 180 620 moveto (Cure Light Wounds) show 72 603 showdigit 84 603 showpalm 96 603 showpalm 111 608 moveto 176 608 lineto stroke 180 604 moveto (Amnesia) show 72 587 showdigit 84 587 showsnap 96 587 showfinger 111 592 moveto 176 592 lineto stroke 180 588 moveto (Confusion) show 72 571 showdigit 84 571 showsnap 96 571 showfinger 108 571 showfinger 120 571 showfinger 132 571 showclap2 147 576 moveto 176 576 lineto stroke 180 572 moveto (Disease) show 72 555 showdigit 84 555 showwave 96 555 showfinger 108 555 showfinger 120 555 showdigit2 140 560 moveto 176 560 lineto stroke 180 556 moveto (Blindness) show 72 539 showdigit 84 539 showwave 96 539 showsnap 108 539 showsnap 120 539 showsnap 132 539 showpalm 147 544 moveto 176 544 lineto stroke 180 540 moveto (Delayed Effect) show 72 523 showdigit 84 523 showwave 96 523 showwave 108 523 showfinger 120 523 showwave 132 523 showclap2 147 528 moveto 176 528 lineto stroke 180 524 moveto (Raise Dead) show 72 507 showdigit 84 507 showwave 96 507 showwave 108 507 showfinger 120 507 showwave 132 507 showdigit 147 512 moveto 176 512 lineto stroke 180 508 moveto (Poison) show 72 491 showfinger 84 491 showfinger 96 491 showfinger 111 496 moveto 176 496 lineto stroke 180 492 moveto (Paralysis) show 72 475 showfinger 84 475 showpalm 96 475 showsnap 108 475 showfinger 120 475 showwave 135 480 moveto 176 480 lineto stroke 180 476 moveto (Summon Troll) show 72 459 showfinger 84 459 showsnap 96 459 showsnap 108 459 showdigit 120 459 showdigit 135 464 moveto 176 464 lineto stroke 180 460 moveto (Fireball) show 72 443 showpalm 87 448 moveto 176 448 lineto stroke 180 444 moveto (Shield) show 72 427 showpalm2 92 432 moveto 176 432 lineto stroke 180 428 moveto (SURRENDER) show 72 411 showpalm 84 411 showdigit 96 411 showwave 108 411 showpalm 123 416 moveto 176 416 lineto stroke 180 412 moveto (Remove Enchantment) show 72 395 showpalm 84 395 showpalm 96 395 showwave2 113 395 showsnap2 133 400 moveto 176 400 lineto stroke 180 396 moveto (Invisibility) show 72 379 showpalm 84 379 showsnap 96 379 showdigit 108 379 showdigit 123 384 moveto 176 384 lineto stroke 180 380 moveto (Charm Monster) show 72 363 showpalm 84 363 showsnap 96 363 showdigit 108 363 showfinger 123 368 moveto 176 368 lineto stroke 180 364 moveto (Charm Person) show 72 347 showpalm 84 347 showsnap 96 347 showfinger 108 347 showwave 123 352 moveto 176 352 lineto stroke 180 348 moveto (Summon Ogre) show 72 331 showpalm 84 331 showwave 96 331 showpalm 108 331 showfinger 120 331 showsnap 132 331 showsnap 144 331 showsnap 156 331 showdigit 171 336 moveto 176 336 lineto stroke 180 332 moveto (Finger of Death) show 72 315 showpalm 84 315 showwave 96 315 showpalm 108 315 showwave 120 315 showwave 132 315 showclap2 147 320 moveto 176 320 lineto stroke 180 316 moveto (Haste) show 72 299 showsnap 84 299 showdigit 99 304 moveto 176 304 lineto stroke 180 300 moveto (Missile) show 72 283 showsnap 84 283 showfinger 96 283 showwave 111 288 moveto 176 288 lineto stroke 180 284 moveto (Summon Goblin) show 72 267 showsnap 84 267 showpalm 96 267 showfinger 111 272 moveto 176 272 lineto stroke 180 268 moveto (Anti-Spell) show 72 251 showsnap 84 251 showpalm 96 251 showfinger 108 251 showpalm 120 251 showsnap 132 251 showdigit 144 251 showwave 159 256 moveto 176 256 lineto stroke 180 252 moveto (Permanency) show 72 235 showsnap 84 235 showpalm 96 235 showpalm 108 235 showclap2 123 240 moveto 176 240 lineto stroke 180 236 moveto (Time Stop) show 72 219 showsnap 84 219 showsnap 96 219 showfinger 108 219 showpalm 123 224 moveto 176 224 lineto stroke 180 220 moveto (Resist Cold) show 72 203 showsnap 84 203 showwave 96 203 showdigit 111 208 moveto 176 208 lineto stroke 180 204 moveto (Fear) show 72 187 showsnap 84 187 showwave 96 187 showwave 108 187 showclap2 123 192 moveto 176 192 lineto stroke 180 188 moveto (Fire Storm) show 72 171 showwave 84 171 showdigit 96 171 showdigit 108 171 showclap2 123 176 moveto 176 176 lineto stroke 180 172 moveto (Lightning Bolt) show 72 155 showwave 84 155 showfinger 96 155 showpalm 111 160 moveto 176 160 lineto stroke 180 156 moveto (Cause Light Wounds) show 72 139 showwave 84 139 showfinger 96 139 showpalm 108 139 showsnap 120 139 showfinger 132 139 showwave 147 144 moveto 176 144 lineto stroke 180 140 moveto (Summon Giant) show 72 123 showwave 84 123 showpalm 96 123 showfinger 108 123 showdigit 123 128 moveto 176 128 lineto stroke 180 124 moveto (Cause Heavy Wounds) show 72 107 showwave 84 107 showpalm 96 107 showpalm 111 112 moveto 176 112 lineto stroke 180 108 moveto (Counter-Spell) show 72 91 showwave 84 91 showsnap 96 91 showsnap 108 91 showclap2 123 96 moveto 176 96 lineto stroke 180 92 moveto (Ice Storm) show 72 75 showwave 84 75 showwave 96 75 showfinger 108 75 showpalm 123 80 moveto 176 80 lineto stroke 180 76 moveto (Resist Heat) show 72 59 showwave 84 59 showwave 96 59 showpalm 111 64 moveto 176 64 lineto stroke 180 60 moveto (Protection From Evil) show 72 43 showwave 84 43 showwave 96 43 showsnap 111 48 moveto 176 48 lineto stroke 180 44 moveto (Counter-Spell) show 336 699 showdigit 348 699 showpalm 360 699 showpalm 375 704 moveto 440 704 lineto stroke 444 700 moveto (Amnesia) show 336 683 showsnap 348 683 showpalm 360 683 showfinger 375 688 moveto 440 688 lineto stroke 444 684 moveto (Anti-Spell) show 336 667 showdigit 348 667 showwave 360 667 showfinger 372 667 showfinger 384 667 showdigit2 404 672 moveto 440 672 lineto stroke 444 668 moveto (Blindness) show 336 651 showwave 348 651 showpalm 360 651 showfinger 372 651 showdigit 387 656 moveto 440 656 lineto stroke 444 652 moveto (Cause Heavy Wounds) show 336 635 showwave 348 635 showfinger 360 635 showpalm 375 640 moveto 440 640 lineto stroke 444 636 moveto (Cause Light Wounds) show 336 619 showpalm 348 619 showsnap 360 619 showdigit 372 619 showdigit 387 624 moveto 440 624 lineto stroke 444 620 moveto (Charm Monster) show 336 603 showpalm 348 603 showsnap 360 603 showdigit 372 603 showfinger 387 608 moveto 440 608 lineto stroke 444 604 moveto (Charm Person) show 336 587 showdigit 348 587 showsnap 360 587 showfinger 375 592 moveto 440 592 lineto stroke 444 588 moveto (Confusion) show 336 571 showwave 348 571 showpalm 360 571 showpalm 375 576 moveto 440 576 lineto stroke 444 572 moveto (Counter-Spell) show 336 555 showwave 348 555 showwave 360 555 showsnap 375 560 moveto 440 560 lineto stroke 444 556 moveto (Counter-Spell) show 336 539 showdigit 348 539 showfinger 360 539 showpalm 372 539 showwave 387 544 moveto 440 544 lineto stroke 444 540 moveto (Cure Heavy Wounds) show 336 523 showdigit 348 523 showfinger 360 523 showwave 375 528 moveto 440 528 lineto stroke 444 524 moveto (Cure Light Wounds) show 336 507 showdigit 348 507 showwave 360 507 showsnap 372 507 showsnap 384 507 showsnap 396 507 showpalm 411 512 moveto 440 512 lineto stroke 444 508 moveto (Delayed Effect) show 336 491 showdigit 348 491 showsnap 360 491 showfinger 372 491 showfinger 384 491 showfinger 396 491 showclap2 411 496 moveto 440 496 lineto stroke 444 492 moveto (Disease) show 336 475 showclap2 348 475 showdigit 360 475 showpalm 372 475 showwave 387 480 moveto 440 480 lineto stroke 444 476 moveto (Dispel Magic) show 336 459 showsnap 348 459 showwave 360 459 showdigit 375 464 moveto 440 464 lineto stroke 444 460 moveto (Fear) show 336 443 showpalm 348 443 showwave 360 443 showpalm 372 443 showfinger 384 443 showsnap 396 443 showsnap 408 443 showsnap 420 443 showdigit 435 448 moveto 440 448 lineto stroke 444 444 moveto (Finger of Death) show 336 427 showsnap 348 427 showwave 360 427 showwave 372 427 showclap2 387 432 moveto 440 432 lineto stroke 444 428 moveto (Fire Storm) show 336 411 showfinger 348 411 showsnap 360 411 showsnap 372 411 showdigit 384 411 showdigit 399 416 moveto 440 416 lineto stroke 444 412 moveto (Fireball) show 336 395 showpalm 348 395 showwave 360 395 showpalm 372 395 showwave 384 395 showwave 396 395 showclap2 411 400 moveto 440 400 lineto stroke 444 396 moveto (Haste) show 336 379 showwave 348 379 showsnap 360 379 showsnap 372 379 showclap2 387 384 moveto 440 384 lineto stroke 444 380 moveto (Ice Storm) show 336 363 showpalm 348 363 showpalm 360 363 showwave2 377 363 showsnap2 397 368 moveto 440 368 lineto stroke 444 364 moveto (Invisibility) show 336 347 showdigit 348 347 showfinger 360 347 showfinger 372 347 showdigit 384 347 showdigit 399 352 moveto 440 352 lineto stroke 444 348 moveto (Lightning Bolt) show 336 331 showwave 348 331 showdigit 360 331 showdigit 372 331 showclap2 387 336 moveto 440 336 lineto stroke 444 332 moveto (Lightning Bolt) show 336 315 showclap2 348 315 showwave2 368 320 moveto 440 320 lineto stroke 444 316 moveto (Magic Mirror) show 336 299 showsnap 348 299 showdigit 363 304 moveto 440 304 lineto stroke 444 300 moveto (Missile) show 336 283 showfinger 348 283 showfinger 360 283 showfinger 375 288 moveto 440 288 lineto stroke 444 284 moveto (Paralysis) show 336 267 showsnap 348 267 showpalm 360 267 showfinger 372 267 showpalm 384 267 showsnap 396 267 showdigit 408 267 showwave 423 272 moveto 440 272 lineto stroke 444 268 moveto (Permanency) show 336 251 showdigit 348 251 showwave 360 251 showwave 372 251 showfinger 384 251 showwave 396 251 showdigit 411 256 moveto 440 256 lineto stroke 444 252 moveto (Poison) show 336 235 showwave 348 235 showwave 360 235 showpalm 375 240 moveto 440 240 lineto stroke 444 236 moveto (Protection From Evil) show 336 219 showdigit 348 219 showwave 360 219 showwave 372 219 showfinger 384 219 showwave 396 219 showclap2 411 224 moveto 440 224 lineto stroke 444 220 moveto (Raise Dead) show 336 203 showpalm 348 203 showdigit 360 203 showwave 372 203 showpalm 387 208 moveto 440 208 lineto stroke 444 204 moveto (Remove Enchantment) show 336 187 showsnap 348 187 showsnap 360 187 showfinger 372 187 showpalm 387 192 moveto 440 192 lineto stroke 444 188 moveto (Resist Cold) show 336 171 showwave 348 171 showwave 360 171 showfinger 372 171 showpalm 387 176 moveto 440 176 lineto stroke 444 172 moveto (Resist Heat) show 336 155 showpalm 351 160 moveto 440 160 lineto stroke 444 156 moveto (Shield) show 336 139 showclap2 348 139 showsnap 360 139 showwave 372 139 showwave 384 139 showsnap 399 144 moveto 440 144 lineto stroke 444 140 moveto (Summon Elemental) show 336 123 showwave 348 123 showfinger 360 123 showpalm 372 123 showsnap 384 123 showfinger 396 123 showwave 411 128 moveto 440 128 lineto stroke 444 124 moveto (Summon Giant) show 336 107 showsnap 348 107 showfinger 360 107 showwave 375 112 moveto 440 112 lineto stroke 444 108 moveto (Summon Goblin) show 336 91 showpalm 348 91 showsnap 360 91 showfinger 372 91 showwave 387 96 moveto 440 96 lineto stroke 444 92 moveto (Summon Ogre) show 336 75 showfinger 348 75 showpalm 360 75 showsnap 372 75 showfinger 384 75 showwave 399 80 moveto 440 80 lineto stroke 444 76 moveto (Summon Troll) show 336 59 showpalm2 356 64 moveto 440 64 lineto stroke 444 60 moveto (SURRENDER) show 336 43 showsnap 348 43 showpalm 360 43 showpalm 372 43 showclap2 387 48 moveto 440 48 lineto stroke 444 44 moveto (Time Stop) show /Times-Bold findfont 14 scalefont setfont 306 752 moveto (SpellCast spell lists -- sorted by gesture and name) centershow showpage spellcast-1.0/emonster.c100644 2756 144 26653 5515617413 13602 0ustar benusers#include #include #include "handwave.h" #include "internal.h" static char bigbuf[2048]; static char bigbuf2[2048]; static void exec_monster_attack(); extern void InitBeing(); void kuruk_name() { #define NUMKURUK (23) static char kuruk_syl[NUMKURUK][5] = {"kur", "ak", "ral", "ki", "rel", "uk", "kor", "kul", "kas", "lok", "luk", "las", "mak", "mok", "mas", "mos", "ga", "tha", "gul", "lug", "mag", "mog", "ug"}; int ix, new, old=(-1); int numsyl = random()%3+2; strcpy(bigbuf, ""); for (ix=0; ixnumcres+1 >= self->cre_size) { self->cre_size *= 2; self->cre = (struct creature *)realloc(self->cre, sizeof(struct creature) * self->cre_size); } thud = &self->cre[self->numcres]; self->numcres++; InitBeing(thud); thud->nocorpse = 0; thud->gender = Gender_MALE; thud->type = type; thud->owner = creator; thud->last_target = (-1); thud->last_targettype = 0; thud->nowm_spell = -1; switch (type) { case Creature_GOBLIN: thud->max_hitpoints = 1; snaffi_name(); strcat(bigbuf, " the Goblin"); break; case Creature_OGRE: thud->max_hitpoints = 2; kuruk_name(); strcat(bigbuf, " the Ogre"); break; case Creature_TROLL: thud->max_hitpoints = 3; kuruk_name(); strcat(bigbuf, " the Troll"); break; case Creature_GIANT: thud->max_hitpoints = 4; kuruk_name(); strcat(bigbuf, " the Giant"); break; case Creature_FIREL: thud->max_hitpoints = 3; thud->nocorpse = 1; kuruk_name(); strcat(bigbuf, " the Fiery"); break; case Creature_ICEL: thud->max_hitpoints = 3; thud->nocorpse = 1; kuruk_name(); strcat(bigbuf, " the Icy"); break; } thud->hitpoints = thud->max_hitpoints; thud->name = (char *)malloc(strlen(bigbuf)+1); strcpy(thud->name, bigbuf); } void execute_monsters(self) struct realgame *self; { int ix, cx, jx, kx, numattacks, qtype, qnum; int target, targettype; struct creature *thud; erase_queries(self); for (ix=0; ixnumcres; ix++) { thud = &(self->cre[ix]); if (thud->alive) { /* at this point, thud->haste is 5 if haste just cast this round; 3,2,1 if in effect; 4 if just cast but also previously in effect */ switch (self->turntype) { case Turn_TIMESTOP: if (thud->timestop==1) numattacks = 1; else numattacks = 0; break; case Turn_NORMAL: if (thud->haste>=1 && thud->haste<=4) numattacks = 2; else numattacks = 1; break; default: PrintMsg("ERROR: wrong type of turn in execute_monsters()\n"); break; } for (jx=0; jxtype==Creature_FIREL || thud->type==Creature_ICEL) qtype = Qu_NoQuery; else qtype = Qu_MonsterTarget; switch (thud->nowm_spell) { case SP__CONFUSION: qtype = Qu_NoQuery; if (jx==0) { sprintf(bigbuf, "%s suddenly looks confused.\n", thud->name); PrintMsg(bigbuf); } break; case SP__PARALYSIS: qtype = Qu_NoQuery; if (jx==0) { sprintf(bigbuf, "%s is paralyzed and cannot attack.\n", thud->name); PrintMsg(bigbuf); } break; case SP__AMNESIA: qtype = Qu_NoQuery; if (jx==0) { sprintf(bigbuf, "%s looks around blankly.\n", thud->name); PrintMsg(bigbuf); } break; default: break; } if (thud->owner<0 || thud->owner>=self->numplayers || !self->wiz[thud->owner]->alive) { qtype = Qu_NoQuery; } add_query(self, thud->owner, qtype, ix + 256*(jx+numattacks)); } } } if (self->numqueries) Queries(self->numqueries, self->querylist); for (qnum=0; qnumnumqueries; qnum++) { jx = (int)(self->querylist[qnum].rock); numattacks = jx / 256; ix = jx % 256; thud = &(self->cre[ix]); if (thud->type==Creature_FIREL || thud->type==Creature_ICEL) { /* elementals are not affected by paralysis */ for (cx=0; cxnumplayers; cx++) { if (self->wiz[cx]->alive) exec_monster_attack(self, self->wiz[cx], cx, 1, thud); } for (cx=0; cxnumcres; cx++) { if (self->cre[cx].alive) exec_monster_attack(self, &self->cre[cx], cx, 0, thud); } } else { targettype = 0; target = (-1); if (thud->nowm_spell==SP__PARALYSIS) { /* no attack */ targettype = 0; } else if (thud->nowm_spell==SP__CONFUSION) { int numtwiz, numtcre; if (thud->mind_caster==1 && thud->perm.mind_spell==SP__CONFUSION && thud->perm.mind_detail!=(-1)) { /* grab from detail */ targettype = thud->perm.mind_detail & QuVal_Hand_MASK; target = thud->perm.mind_detail & (~QuVal_Hand_MASK); } else { /* grab randomly */ numtwiz = NumberOfTargets(self, QuVal_Target_Wizard); numtcre = NumberOfTargets(self, QuVal_Target_Creature); kx = random() % (numtwiz + numtcre); if (kxmind_caster==1 && thud->perm.mind_spell==SP__CONFUSION) { /* set detail */ thud->perm.mind_detail = targettype | target; } } else if (thud->nowm_spell==SP__AMNESIA) { targettype = thud->last_targettype; target = thud->last_target; } else { int ival; int tart = self->querylist[qnum].answer & QuVal_Target_MASK; if (tart==0 || (thud->owner<0 || thud->owner>=self->numplayers || !self->wiz[thud->owner]->alive)) { targettype = 0; } else { kx = self->querylist[qnum].answer & (~QuVal_Target_MASK); ival = IndexOfTarget((game *)self, tart, kx); target = ival & (~QuVal_Target_MASK); targettype = ival & QuVal_Target_MASK; } } /*printf("### attack of %s: %d, %d\n", thud->name, targettype, target);*/ thud->last_targettype = targettype; thud->last_target = target; switch (targettype) { case QuVal_Target_Wizard: if (self->wiz[target]->alive) exec_monster_attack(self, self->wiz[target], target, 1, thud); break; case QuVal_Target_Creature: if (self->cre[target].alive) exec_monster_attack(self, &self->cre[target], target, 0, thud); break; default: break; } } } for (ix=0; ixnumcres; ix++) { thud = &(self->cre[ix]); if (thud->alive) { /*printf("### cycling %s: %d => %d\n", thud->name, thud->mind_spell, thud->nowm_spell);*/ if (self->turntype==Turn_TIMESTOP && !thud->timestop) { /* do not cycle */ } else { thud->nowm_spell = thud->mind_spell; thud->nowm_caster = thud->mind_caster; thud->mind_spell = (-1); thud->mind_caster = (-1); } } } } static void exec_monster_attack(self, fred, cnum, wizflag, thud) /* dead not allowed */ struct realgame *self; union being *fred; int cnum; int wizflag; struct creature *thud; { int ix, jx; int *zapl; zapl = fred->both.zaplist; if (fred==(union being *)thud) { if (thud->type==Creature_FIREL || thud->type==Creature_ICEL) { /* say nothing */ } else { sprintf(bigbuf, "%s refuses to attack %s.\n", thud->name, pro_himself(fred->both.gender)); PrintMsg(bigbuf); } return; } if (!(thud->type==Creature_FIREL || thud->type==Creature_ICEL) && fred->both.invisibility) { sprintf(bigbuf, "%s tries to attack you, but cannot see you.\n", thud->name); sprintf(bigbuf2, "%s tries to attack %s, but cannot see %s.\n", thud->name, fred->both.name, pro_him(fred->both.gender)); if (wizflag) PrintMsg2(cnum, bigbuf, bigbuf2); else PrintMsg(bigbuf2); return; } if (zapl[SP__SHIELD]) { sprintf(bigbuf, "The attack of %s is blocked by your Shield.\n", thud->name); sprintf(bigbuf2, "The attack of %s is blocked by %s's Shield.\n", thud->name, fred->both.name); if (wizflag) PrintMsg2(cnum, bigbuf, bigbuf2); else PrintMsg(bigbuf2); return; } if (thud->type==Creature_FIREL) { if (fred->both.fl_resist_heat) { sprintf(bigbuf, "%s reaches towards you, but you feel only a warm breeze.\n", thud->name); sprintf(bigbuf2, "%s reaches toward %s, but cannot penetrate %s blue aura.\n", thud->name, fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, bigbuf, bigbuf2); else PrintMsg(bigbuf2); } else { sprintf(bigbuf, "%s hurls tongues of fire at you.\n", thud->name); sprintf(bigbuf2, "%s hurls fire at %s.\n", thud->name, fred->both.name); if (wizflag) PrintMsg2(cnum, bigbuf, bigbuf2); else PrintMsg(bigbuf2); fred->both.hitpoints -= 3; } } else if (thud->type==Creature_ICEL) { if (fred->both.fl_resist_cold) { sprintf(bigbuf, "%s reaches towards you, but you feel only a chill breeze.\n", thud->name); sprintf(bigbuf2, "%s reaches toward %s, but cannot penetrate %s pink aura.\n", thud->name, fred->both.name, pro_his(fred->both.gender)); if (wizflag) PrintMsg2(cnum, bigbuf, bigbuf2); else PrintMsg(bigbuf2); } else { sprintf(bigbuf, "%s hurls splinters of ice at you.\n", thud->name); sprintf(bigbuf2, "%s hurls ice at %s.\n", thud->name, fred->both.name); if (wizflag) PrintMsg2(cnum, bigbuf, bigbuf2); else PrintMsg(bigbuf2); fred->both.hitpoints -= 3; } } else { /* other creature types */ if (fred==(union being *)thud) { sprintf(bigbuf, "%s attacks %s!\n", thud->name, pro_himself(fred->both.gender)); PrintMsg(bigbuf); } else { sprintf(bigbuf, "%s attacks you.\n", thud->name); sprintf(bigbuf2, "%s attacks %s.\n", thud->name, fred->both.name); if (wizflag) PrintMsg2(cnum, bigbuf, bigbuf2); else PrintMsg(bigbuf2); } switch (thud->type) { case Creature_GOBLIN: fred->both.hitpoints -= 1; break; case Creature_OGRE: fred->both.hitpoints -= 2; break; case Creature_TROLL: fred->both.hitpoints -= 3; break; case Creature_GIANT: fred->both.hitpoints -= 4; break; } } } spellcast-1.0/xquery.c100644 2756 144 53651 5515617415 13303 0ustar benusers#include #include #include #include #include "handwave.h" #include "spelllist.h" #include "xspell.h" #define QUERY_X (32) #define QUERY_Y (620) #define QUERY_W (736) #define QUERY_H (100) #define QUERY_AW (450) #define QUERY_LEADING (8) #define QMENU_LEADING (4) #define QMENU_BORDER (4) #define GEST_SPACE (50) typedef struct _tempstring { struct _tempstring *next; char str[1]; } tempstring; static char *TLElementalType_Names[] = {"Fire", "Ice"}; static char *TLHand_Names[] = {"Left", "Right"}; static char *TLNoYes_Names[] = {"No", "Yes"}; static int TLZeroOne_Num[] = {0, 1}; static struct target_list TLBeing = {0, NULL, NULL, 0}; static struct target_list TLBeingNone = {0, NULL, NULL, 0}; static struct target_list TLWizard = {0, NULL, NULL, 0}; static struct target_list TLWizardNone = {0, NULL, NULL, 0}; static struct target_list TLRaiseDead = {0, NULL, NULL, 0}; static struct target_list TLElementalType = {2, TLElementalType_Names, TLZeroOne_Num, 0}; static struct target_list TLPickHand = {2, TLHand_Names, TLZeroOne_Num, 0}; static struct target_list TLNoYes = {2, TLNoYes_Names, TLZeroOne_Num, 0}; static tempstring *tempstringlist = NULL; void redraw_queries_only(); void init_query(py) struct player *py; { py->answers_size = 8; py->answers = (struct answer *)malloc(sizeof(struct answer) * py->answers_size); py->siquery.nlines = 0; py->query_hgt = py->lineheight + QUERY_LEADING; py->siquery.visible = QUERY_H / py->query_hgt; py->TLLeftHand.size = 0; py->TLLeftHand.num = 0; py->TLRightHand.size = 0; py->TLRightHand.num = 0; py->siquery.py = py; py->siquery.top = 0; py->siquery.lineheight = py->query_hgt; py->siquery.x = QUERY_X; py->siquery.y = QUERY_Y; py->siquery.h = QUERY_H; py->siquery.redraw = redraw_queries_only; } void flush_tempstrings() { tempstring *pt; while (tempstringlist) { pt = tempstringlist->next; free(tempstringlist); tempstringlist = pt; } } char *tempstring_malloc(len) int len; { tempstring *pt; pt = (tempstring *)malloc(sizeof(tempstring) + len + 1); pt->next = tempstringlist; tempstringlist = pt; return (pt->str); } void clear_answers(py) struct player *py; { py->siquery.nlines = 0; py->siquery.top = 0; } void add_answer(py, qu_str, ans_str, done_init, answer_init, qrock, introck) struct player *py; char *qu_str; char *ans_str; int done_init, answer_init; struct query *qrock; long introck; { int num; if (py->siquery.nlines >= py->answers_size) { py->answers_size *= 2; py->answers = (struct answer *)realloc(py->answers, sizeof(struct answer) * py->answers_size); } num = py->siquery.nlines; py->siquery.nlines++; py->answers[num].done = done_init; py->answers[num].answer = answer_init; py->answers[num].query = qrock; py->answers[num].rock = introck; strcpy(py->answers[num].qu_str, qu_str); strcpy(py->answers[num].ans_str, ans_str); } int DrawStringField(py, str, xpos, ypos, width) struct player *py; char *str; int xpos, ypos; int width; { static XCharStruct overall; int direction, ascent, descent; int len = strlen(str); XTextExtents(py->font, str, len, &direction, &ascent, &descent, &overall); XDrawImageString(py->dpy, py->win, py->blackgc, xpos, ypos, str, len); if (overall.widthdpy, py->win, xpos+overall.width, ypos-py->ascent, width-overall.width, py->totalheight, 0); } return overall.width; } void redraw_queries_only(py, baronly) struct player *py; int baronly; { int ix, qline; int ypos; if (!baronly) { for (ix=0; ixsiquery.visible; ix++) { qline = py->siquery.top + ix; if (qline<0) continue; ypos = QUERY_Y+ix*py->query_hgt+py->lineheight; if (qline >= py->siquery.nlines) { DrawStringField(py, "", QUERY_X+16, ypos, QUERY_W-16); } else { DrawStringField(py, py->answers[qline].qu_str, QUERY_X+16, ypos, QUERY_AW-16); DrawStringField(py, py->answers[qline].ans_str, QUERY_X+QUERY_AW, ypos, QUERY_W-QUERY_AW); } } } redraw_scrollbar(&(py->siquery)); } void redraw_queries(py) struct player *py; { int ix; XDrawRectangle(py->dpy, py->win, py->blackgc, QUERY_X-3, QUERY_Y-2, QUERY_W+4, QUERY_H+3); XDrawRectangle(py->dpy, py->win, py->blackgc, QUERY_X-SCROLL_W, QUERY_Y-2, SCROLL_W-3, QUERY_H+3); for (ix=0; ixsiquery.visible; ix++) { if (ix!=0) XDrawLine(py->dpy, py->win, py->blackgc, QUERY_X, QUERY_Y+ix*py->query_hgt, QUERY_X+QUERY_W, QUERY_Y+ix*py->query_hgt); } redraw_queries_only(py, 0); } static void add_to_targetlist(tl, name, targnum) struct target_list *tl; char *name; int targnum; { int size; if (tl->size==0) { tl->size = 8; tl->tnums = (int *)malloc(tl->size*sizeof(int)); tl->tnames = (char **)malloc(tl->size*sizeof(char *)); } size = tl->num; tl->num++; if (tl->size <= size) { while (tl->size <= size) tl->size *= 2; tl->tnums = (int *)realloc(tl->tnums, tl->size*sizeof(int)); tl->tnames = (char **)realloc(tl->tnames, tl->size*sizeof(char *)); } tl->tnums[size] = targnum; tl->tnames[size] = name; } static void invent_target_lists() { int jx, numtargs; char *nm, *realnm; int tl; long stuff; TLBeing.num = 0; TLBeingNone.num = 0; TLWizard.num = 0; TLWizardNone.num = 0; TLRaiseDead.num = 0; add_to_targetlist(&TLBeingNone, "nobody", 0); add_to_targetlist(&TLWizardNone, "nobody", 0); numtargs = NumberOfTargets(gameval, QuVal_Target_Wizard); for (jx=0; jxturn_active = 0; clear_answers(py); } for (ix=0; ixturn_active = 1; pnum = py-players; gotany = 1; switch (qlist[ix].qtype) { case Qu_LeftHand: case Qu_RightHand: if (qlist[ix].qtype==Qu_LeftHand) { strcpy(qu_buf, "What spell do you want to cast with your left hand?"); tl = &(py->TLLeftHand); } else { strcpy(qu_buf, "What spell do you want to cast with your right hand?"); tl = &(py->TLRightHand); } hlist = (int *)qlist[ix].rock; tl->num = 0; for (jx=0; jx= 128) { spellnum = jx - 128; jx = 1; } else { spellnum = jx; jx = 0; } sprintf(qu_buf, "What gesture do you want %s's %s hand to make?", NameOfBeing(gameval, QuVal_Target_Wizard, spellnum), (jx?"right":"left")); strcpy(ans_buf, ""); add_answer(py, qu_buf, ans_buf, 0, 0, &(qlist[ix]), 0); turnstate = State_EQueries; break; case Qu_WhichToDelay: case Qu_WhichToPerm: /* use TLRightHand and TLLeftHand, since these queries always show up by themselves */ if (qlist[ix].qtype == Qu_WhichToDelay) { tl = &(py->TLRightHand); sprintf(qu_buf, "Which spell do you want to delay?"); } else { tl = &(py->TLLeftHand); sprintf(qu_buf, "Which spell do you want to make permanent?"); } hlist = (int *)qlist[ix].rock; tl->num = 0; for (jx=0; hlist[jx]!=(-1); jx++) { add_to_targetlist(tl, spelllist[hlist[jx]].name, jx); } strcpy(ans_buf, ""); add_answer(py, qu_buf, ans_buf, 0, 0, &(qlist[ix]), 0); turnstate = State_EQueries; break; case Qu_SetOffDelay: sprintf(qu_buf, "Do you want to release the %s from the Delayed Effect?", spelllist[(int)qlist[ix].rock].name); strcpy(ans_buf, "No"); add_answer(py, qu_buf, ans_buf, 1, 0, &(qlist[ix]), 0); turnstate = State_EQueries; break; case Qu_ParalysisHand: case Qu_CharmHand: if (qlist[ix].qtype == Qu_ParalysisHand) sprintf(qu_buf, "Which of %s's hands do you want to paralyze?", NameOfBeing(gameval, QuVal_Target_Wizard, qlist[ix].rock)); else sprintf(qu_buf, "Which of %s's hands do you want to control?", NameOfBeing(gameval, QuVal_Target_Wizard, qlist[ix].rock)); strcpy(ans_buf, ""); add_answer(py, qu_buf, ans_buf, 0, 0, &(qlist[ix]), 0); break; case Qu_ElementalType: sprintf(qu_buf, "Which type of elemental do you want to summon?"); strcpy(ans_buf, ""); add_answer(py, qu_buf, ans_buf, 0, 0, &(qlist[ix]), 0); break; case Qu_MonsterTarget: jx = (int)(qlist[ix].rock); attnum = jx / 256; spellnum = jx % 256; switch (attnum) { case 1: sprintf(qu_buf, "Whom do you want %s to attack?", NameOfBeing(gameval, QuVal_Target_Creature, spellnum)); break; case 2: sprintf(qu_buf, "Whom do you want %s's first attack to be at?", NameOfBeing(gameval, QuVal_Target_Creature, spellnum)); break; case 3: sprintf(qu_buf, "Whom do you want %s's second attack to be at?", NameOfBeing(gameval, QuVal_Target_Creature, spellnum)); break; default: sprintf(qu_buf, "ERROR: Query about %d (%d)", spellnum, attnum); break; } { int numtargs = NumberOfTargets(gameval, QuVal_Target_Wizard); strcpy(ans_buf, "nobody"); answer_init = 0; for (jx=0; jxturn_done = !py->turn_active; } for (ix=0; ixsiquery.nlines; jx++) { py->answers[jx].query->answer = py->answers[jx].answer; } } } void draw_query_menu(py) struct player *py; { int ix, jx; int qtype = py->answers[py->query_hit].query->qtype; draw_frame(py, &py->query_rect); if (qtype==Qu_CharmGesture) { int posx, posy, hand; posx = py->query_rect.x+20; posy = py->query_rect.y+20; hand = (strstr(py->answers[py->query_hit].qu_str, "right hand") ? 1 : 0); for (jx=0; jx<2; jx++) for (ix=0; ix<4; ix++) { XCopyPlane(py->dpy, py->gesturebm[hand][jx*4+ix], py->win, py->blackgc, 0, 0, GEST_SIZE, GEST_SIZE, posx+ix*GEST_SPACE, posy+jx*GEST_SPACE, 1); } } else { for (ix=0; ixquery_tl->num; ix++) { XDrawImageString(py->dpy, py->win, py->blackgc, py->query_rect.x+16, py->query_rect.y + ix*(py->lineheight+QMENU_LEADING) + py->lineheight + QMENU_BORDER, py->query_tl->tnames[ix], strlen(py->query_tl->tnames[ix])); } } } int in_query_box(py, xpos, ypos) struct player *py; int xpos, ypos; { return (xpos>=QUERY_X && ypos>=QUERY_Y && xposquery_hgt + py->siquery.top; int ix; static XCharStruct overall; int direction, ascent, descent; if (!py->turn_active || py->turn_done) return ms_None; if (hitq<0 || hitq>=py->siquery.nlines) return ms_None; if (!py->answers[hitq].query) return ms_None; switch (py->answers[hitq].query->qtype) { case Qu_WhichToPerm: py->query_tl = (&(py->TLLeftHand)); break; case Qu_WhichToDelay: py->query_tl = (&(py->TLRightHand)); break; case Qu_LeftHand: py->query_tl = (&(py->TLLeftHand)); break; case Qu_RightHand: py->query_tl = (&(py->TLRightHand)); break; case Qu_ElementalType: py->query_tl = (&TLElementalType); break; case Qu_MonsterTarget: py->query_tl = (&TLBeingNone); break; case Qu_TargetBeing: py->query_tl = (&TLBeing); break; case Qu_TargetBeingNone: py->query_tl = (&TLBeingNone); break; case Qu_TargetWizard: py->query_tl = (&TLWizard); break; case Qu_TargetWizardNone: py->query_tl = (&TLWizardNone); break; case Qu_TargetRaiseDead: py->query_tl = (&TLRaiseDead); break; case Qu_ParalysisHand: case Qu_CharmHand: py->query_tl = (&TLPickHand); break; case Qu_SetOffDelay: py->query_tl = (&TLNoYes); break; case Qu_CharmGesture: py->query_tl = NULL; break; case Qu_SaveTranscript: /* special value defined in xspell.h */ py->query_tl = (&TLNoYes); break; default: return ms_None; break; } py->query_hit = hitq; if (py->answers[hitq].query->qtype==Qu_CharmGesture) { py->query_rect.w = 240; py->query_rect.h = 140; py->query_rect.x = xpos - py->query_rect.w/2; py->query_rect.y = ypos - py->query_rect.h/2; } else { int maxwid = 0; for (ix=0; ixquery_tl->num; ix++) { XTextExtents(py->font, py->query_tl->tnames[ix], strlen(py->query_tl->tnames[ix]), &direction, &ascent, &descent, &overall); if (overall.width > maxwid) maxwid = overall.width; } py->query_rect.w = maxwid + 32 + FRAME_SHADOW; py->query_rect.h = py->query_tl->num * (py->lineheight+QMENU_LEADING) + 2*QMENU_BORDER+FRAME_SHADOW; py->query_rect.x = xpos - py->query_rect.w/2; py->query_rect.y = ypos - py->query_rect.h/2; } py->query_sel = (-1); adjust_rect(&py->query_rect); backing_store(py, &py->query_rect); draw_query_menu(py); query_motion(py, xpos, ypos, button); return ms_Query; } int query_motion(py, xpos, ypos, button) struct player *py; int xpos, ypos; int button; { int hitrow; int qtype = py->answers[py->query_hit].query->qtype; if (qtype==Qu_CharmGesture) { int posx, posy, hitx, hity; posx = py->query_rect.x+20; posy = py->query_rect.y+20; hitx = (xpos - posx + GEST_SPACE) / GEST_SPACE - 1; hity = (ypos - posy + GEST_SPACE) / GEST_SPACE - 1; if (hitx>=0 && hitx<4 && hity>=0 && hity<2) hitrow = hity*4 + hitx; else hitrow = (-1); if (hitrow==py->query_sel) return; if (py->query_sel != (-1)) { /* erase old */ hitx = py->query_sel % 4; hity = py->query_sel / 4; XDrawRectangle(py->dpy, py->win, py->whitegc, posx+hitx*GEST_SPACE-1, posy+hity*GEST_SPACE-1, GEST_SIZE+1, GEST_SIZE+1); XDrawRectangle(py->dpy, py->win, py->whitegc, posx+hitx*GEST_SPACE-2, posy+hity*GEST_SPACE-2, GEST_SIZE+3, GEST_SIZE+3); } py->query_sel = hitrow; if (py->query_sel != (-1)) { /* draw new */ hitx = py->query_sel % 4; hity = py->query_sel / 4; XDrawRectangle(py->dpy, py->win, py->blackgc, posx+hitx*GEST_SPACE-1, posy+hity*GEST_SPACE-1, GEST_SIZE+1, GEST_SIZE+1); XDrawRectangle(py->dpy, py->win, py->blackgc, posx+hitx*GEST_SPACE-2, posy+hity*GEST_SPACE-2, GEST_SIZE+3, GEST_SIZE+3); } } else { ypos -= (py->query_rect.y + QMENU_BORDER); if (ypos<0 || xpos < py->query_rect.x || xpos >= py->query_rect.x+py->query_rect.w) hitrow = (-1); else hitrow = ypos / (py->lineheight+QMENU_LEADING); if (hitrow<0 || hitrow>=py->query_tl->num) hitrow = (-1); if (hitrow==py->query_sel) return; if (py->query_sel != (-1)) { /* erase old */ XDrawRectangle(py->dpy, py->win, py->whitegc, py->query_rect.x+QMENU_BORDER, py->query_rect.y + py->query_sel*(py->lineheight+QMENU_LEADING) + QMENU_BORDER, py->query_rect.w-(FRAME_SHADOW+2*QMENU_BORDER), py->lineheight+QMENU_LEADING); } py->query_sel = hitrow; if (py->query_sel != (-1)) { /* draw new */ XDrawRectangle(py->dpy, py->win, py->blackgc, py->query_rect.x+QMENU_BORDER, py->query_rect.y + py->query_sel*(py->lineheight+QMENU_LEADING) + QMENU_BORDER, py->query_rect.w-(FRAME_SHADOW+2*QMENU_BORDER), py->lineheight+QMENU_LEADING); } } } int query_release(py, xpos, ypos, button) struct player *py; int xpos, ypos; int button; { int qtype = py->answers[py->query_hit].query->qtype; int ix, jx; backing_restore(py); if (py->query_sel != (-1)) { if (qtype==Qu_CharmGesture) { py->answers[py->query_hit].answer = py->query_sel; py->answers[py->query_hit].done = 1; strcpy(py->answers[py->query_hit].ans_str, gesture_name(py->query_sel)); } else { py->answers[py->query_hit].answer = py->query_tl->tnums[py->query_sel]; py->answers[py->query_hit].done = 1; strcpy(py->answers[py->query_hit].ans_str, py->query_tl->tnames[py->query_sel]); if (qtype==Qu_LeftHand || qtype==Qu_RightHand) { struct answer *ans = (&(py->answers[py->query_hit])); struct answer *anso; int *hlist = (int *)ans->rock; int *hlisto; int otherq; int forceans = (-1); struct target_list *othertl; if (qtype==Qu_LeftHand) { otherq = Qu_RightHand; othertl = (&(py->TLRightHand)); } else { otherq = Qu_LeftHand; othertl = (&(py->TLLeftHand)); } for (ix=0; ixsiquery.nlines; ix++) { if (py->answers[ix].query->qtype == otherq) { anso = (&(py->answers[ix])); hlisto = (int *)anso->rock; if (hlist[py->query_sel+1] & QuVal_Hand_Both) { /* force other hand to same spell */ for (jx=0; jxquery_sel+1] == hlisto[jx+1]) { forceans = jx; break; } } else { /* should force other hand away from 2-handed answer, but there is no case in the game where this is a concern. */ } if (forceans != (-1)) { /*printf("Forcing q.%d to %d\n", ix, forceans); fflush(stdout);*/ py->answers[ix].answer = othertl->tnums[forceans]; py->answers[ix].done = 1; strcpy(py->answers[ix].ans_str, othertl->tnames[forceans]); } } } } } redraw_queries_only(py, 0); } } spellcast-1.0/espells.c100644 2756 144 13321 5515617421 13400 0ustar benusers#include #include "handwave.h" #include "internal.h" /* the following are purely for readability */ #define P Gesture_PALM #define D Gesture_DIGIT #define F Gesture_FINGERS #define W Gesture_WAVE #define C Gesture_CLAPHALF #define S Gesture_SNAP #define P2 (Gesture_PALM | Gesture_DOUBLE) #define D2 (Gesture_DIGIT | Gesture_DOUBLE) #define F2 (Gesture_FINGERS | Gesture_DOUBLE) #define W2 (Gesture_WAVE | Gesture_DOUBLE) #define C2 (Gesture_CLAPHALF | Gesture_DOUBLE) #define S2 (Gesture_SNAP | Gesture_DOUBLE) struct spelldef spelllist[NUMSPELLS] = { {4, {C2, D, P, W}, 0, 1, "Dispel Magic"}, {5, {C2, S, W, W, S}, 0, 1, "Summon Elemental"}, {2, {C2, W2}, 0, 1, "Magic Mirror"}, {5, {D, F, F, D, D}, 0, 0, "Lightning Bolt"}, {4, {D, F, P, W}, 0, 1, "Cure Heavy Wounds"}, {3, {D, F, W}, 0, 1, "Cure Light Wounds"}, {3, {D, P, P}, 1, 0, "Amnesia"}, {3, {D, S, F}, 1, 0, "Confusion"}, {6, {D, S, F, F, F, C2},0, 0,"Disease"}, {5, {D, W, F, F, D2}, 1, 0, "Blindness"}, {6, {D, W, S, S, S, P},0, 1, "Delayed Effect"}, {6, {D, W, W, F, W, C2},0, 1,"Raise Dead"}, {6, {D, W, W, F, W, D},0, 0, "Poison"}, {3, {F, F, F}, 1, 0, "Paralysis"}, {5, {F, P, S, F, W}, 0, 1, "Summon Troll"}, {5, {F, S, S, D, D}, 0, 0, "Fireball"}, {1, {P}, 0, 1, "Shield"}, {1, {P2}, 0, 0, "SURRENDER"}, {4, {P, D, W, P}, 0, 1, "Remove Enchantment"}, {4, {P, P, W2, S2}, 1, 1, "Invisibility"}, {4, {P, S, D, D}, 1, 0, "Charm Monster"}, {4, {P, S, D, F}, 1, 0, "Charm Person"}, {4, {P, S, F, W}, 0, 1, "Summon Ogre"}, {8, {P, W, P, F, S, S, S, D},0,0,"Finger of Death"}, {6, {P, W, P, W, W, C2},1, 1,"Haste"}, {2, {S, D}, 0, 0, "Missile"}, {3, {S, F, W}, 0, 1, "Summon Goblin"}, {3, {S, P, F}, 0, 0, "Anti-Spell"}, {7, {S, P, F, P, S, D, W},0,1,"Permanency"}, {4, {S, P, P, C2}, 0, 1, "Time Stop"}, {4, {S, S, F, P}, 1, 1, "Resist Cold"}, {3, {S, W, D}, 1, 0, "Fear"}, {4, {S, W, W, C2}, 0, 0, "Fire Storm"}, {4, {W, D, D, C2}, 0, 0, "Lightning Bolt"}, {3, {W, F, P}, 0, 0, "Cause Light Wounds"}, {6, {W, F, P, S, F, W},0, 1, "Summon Giant"}, {4, {W, P, F, D}, 0, 0, "Cause Heavy Wounds"}, {3, {W, P, P}, 0, 0, "Counter-Spell"}, {4, {W, S, S, C2}, 0, 0, "Ice Storm"}, {4, {W, W, F, P}, 1, 1, "Resist Heat"}, {3, {W, W, P}, 1, 1, "Protection From Evil"}, {3, {W, W, S}, 0, 0, "Counter-Spell"}, {1, {Gesture_KNIFE}, 0, 0, "stab"} }; #undef P #undef D #undef F #undef W #undef C #undef S #undef P2 #undef D2 #undef F2 #undef W2 #undef C2 #undef S2 int reverse_sort_list[NUMSPELLS] = { SP__LIGHTNING_BOLT2, SP__DISEASE, SP__TIME_STOP, SP__ICE_STORM, SP__RAISE_DEAD, SP__HASTE, SP__FIRE_STORM, SP__LIGHTNING_BOLT, SP__CHARM_MONSTER, SP__FIREBALL, SP__BLINDNESS, SP__CAUSE_HEAVY_WOUNDS, SP__MISSILE, SP__FINGER_OF_DEATH, SP__POISON, SP__FEAR, SP__CHARM_PERSON, SP__PARALYSIS, SP__ANTI_SPELL, SP__CONFUSION, SP__SHIELD, SP__SURRENDER, SP__RESIST_COLD, SP__CAUSE_LIGHT_WOUNDS, SP__RESIST_HEAT, SP__AMNESIA, SP__COUNTER_SPELL, SP__DELAYED_EFFECT, SP__REMOVE_ENCHANTMENT, SP__PROTECTION_FROM_EVIL, SP__INVISIBILITY, SP__COUNTER_SPELL2, SP__SUMMON_ELEMENTAL, SP__MAGIC_MIRROR, SP__PERMANENCY, SP__CURE_LIGHT_WOUNDS, SP__SUMMON_GOBLIN, SP__SUMMON_OGRE, SP__SUMMON_TROLL, SP__SUMMON_GIANT, SP__DISPEL_MAGIC, SP__CURE_HEAVY_WOUNDS, SP__STAB }; int alphabet_sort_list[NUMSPELLS] = { SP__AMNESIA, SP__ANTI_SPELL, SP__BLINDNESS, SP__CAUSE_HEAVY_WOUNDS, SP__CAUSE_LIGHT_WOUNDS, SP__CHARM_MONSTER, SP__CHARM_PERSON, SP__CONFUSION, SP__COUNTER_SPELL, SP__COUNTER_SPELL2, SP__CURE_HEAVY_WOUNDS, SP__CURE_LIGHT_WOUNDS, SP__DELAYED_EFFECT, SP__DISEASE, SP__DISPEL_MAGIC, SP__FEAR, SP__FINGER_OF_DEATH, SP__FIRE_STORM, SP__FIREBALL, SP__HASTE, SP__ICE_STORM, SP__INVISIBILITY, SP__LIGHTNING_BOLT, SP__LIGHTNING_BOLT2, SP__MAGIC_MIRROR, SP__MISSILE, SP__PARALYSIS, SP__PERMANENCY, SP__POISON, SP__PROTECTION_FROM_EVIL, SP__RAISE_DEAD, SP__REMOVE_ENCHANTMENT, SP__RESIST_COLD, SP__RESIST_HEAT, SP__SHIELD, SP__SUMMON_ELEMENTAL, SP__SUMMON_GIANT, SP__SUMMON_GOBLIN, SP__SUMMON_OGRE, SP__SUMMON_TROLL, SP__SURRENDER, SP__TIME_STOP, SP__STAB }; static int check_one_spell(numgests, glist, mainhand, spel) int numgests; struct wizgesture *glist; int mainhand; struct spelldef *spel; { int otherhand = (1-mainhand); int jx, result, pos; for (jx=spel->length-1; jx>=0; jx--) { pos = numgests - (spel->length - jx); if (pos<0) { /* fell off beginning of gesture list */ return 0; } if (spel->gests[jx] & Gesture_DOUBLE) { result = spel->gests[jx] & (~Gesture_DOUBLE); if (!(glist[pos].did[mainhand] == result && glist[pos].did[otherhand] == result)) { /* failed to do two-handed gesture */ return 0; } } else { if (!(glist[pos].did[mainhand] == spel->gests[jx])) { /* failed to do one-handed gesture */ return 0; } } } return 1; } /* writes results into found[] (OR of MASK_LEFT and MASK_RIGHT, or else MASK_BOTH) */ void find_castspells(found, numgests, glist) int *found; /* pointer to array[NUMSPELLS] */ int numgests; struct wizgesture *glist; { int ix, result; struct spelldef *spel; for (ix=0; ixgests[spel->length-1] & Gesture_DOUBLE)) { /* spell was completed with a double-handed gesture */ result = MASK_TWOHAND; } found[ix] = result; } } spellcast-1.0/handwave.h100644 2756 144 10520 5515617422 13532 0ustar benusers/* header file for client */ typedef void game; #define Turn_NORMAL (0) #define Turn_HASTE (1) #define Turn_TIMESTOP (2) #define Gesture_NOTHING (0) #define Gesture_PALM (1) #define Gesture_DIGIT (2) #define Gesture_FINGERS (3) #define Gesture_WAVE (4) #define Gesture_CLAPHALF (5) #define Gesture_SNAP (6) #define Gesture_KNIFE (7) #define Gesture_ANTISPELL (8) /* not less than NUMGESTURES, because. */ #define Gesture_UNCLEAR (9) /* not less than NUMGESTURES, because. */ #define NUMGESTURES (8) #define Gesture_DOUBLE (16) #define MAXPLAYERS (8) #define Gender_NONE (0) #define Gender_MALE (1) #define Gender_FEMALE (2) #define Gender_NEUTER (3) #define Stuff_RESIST_HEAT (1<<0) #define Stuff_RESIST_COLD (1<<1) #define Stuff_PROTECT_EVIL (1<<2) #define Stuff_POISON (1<<3) #define Stuff_DISEASE (1<<4) #define Stuff_INVISIBLE (1<<5) #define Stuff_BLIND (1<<6) #define Qu_NoQuery (0) /* placeholder; to be ignored by client */ #define Qu_LeftHand (1) #define Qu_RightHand (2) /* rock is an array of int. rock[0] is the list length; rock[1..len] is a spell number, ORed with QuVal_Hand_Both if the spell requires both hands. Answer is an index into rock (0..len-1) */ #define Qu_SetOffDelay (3) /* rock is the spell number */ #define Qu_ElementalType (4) /* no rock */ #define Qu_ParalysisHand (5) #define Qu_CharmHand (6) /* rock is index number of target wizard */ #define Qu_CharmGesture (7) /* rock is index number of target wizard. Answer is Gesture_*. */ #define Qu_MonsterTarget (8) /* rock is (0 if monster gets one attack, 1 or 2 if it gets two) * 256 + monster index. Answer is a wizard/creature number, ORed with QuVal_Target_*. (Or 0 for none). */ #define Qu_WhichToDelay (9) #define Qu_WhichToPerm (10) /* rock is a pointer to an int array of spell numbers, terminated by -1. */ /* for qtypes higher than this, it's a target picker. rock is the spell number, ORed with QuVal_Hand_*. Answer is a wizard/creature/corpse number, ORed with QuVal_Target_*. (Or 0 for none) */ #define Qu_TargetBeing (20) #define Qu_TargetBeingNone (21) #define Qu_TargetWizard (22) #define Qu_TargetWizardNone (23) #define Qu_TargetRaiseDead (24) #define QuVal_Hand_Left (256) #define QuVal_Hand_Right (512) #define QuVal_Hand_Both (1024) #define QuVal_Hand_MASK (QuVal_Hand_Left | QuVal_Hand_Right | QuVal_Hand_Both) #define QuVal_Target_Wizard (256) #define QuVal_Target_Creature (512) #define QuVal_Target_Corpse (1024) #define QuVal_Target_MASK (QuVal_Target_Wizard | QuVal_Target_Creature | QuVal_Target_Corpse) struct query { int player; int qtype; char *rock; int answer; /* to be filled in */ }; struct interface { /* in the printing calls, any char * may be NULL */ void (*proc_PrintMsg)( /* char *msg, game *game, rock */ ); void (*proc_PrintMsg2)( /* int person1, char *msg1, char *msgelse, game *game, rock */ ); void (*proc_PrintMsg3)( /* int person1, int person2, char *msg1, char *msg2, char *msgelse, game *game, rock */ ); void (*proc_Queries)( /* int numqueries, struct query *qlist, game *game, rock */ ); }; extern game *BeginGame( /* int numplayers, char **names, int *genders, struct interface *callbacks, rock */ ); /* names is a pointer to an array of name strings. */ extern int RunTurn( /* game *game, int *moves */ ); /* moves contains two ints for each player (left, right). The encoding is with Gesture_*. */ extern void SeeGesture( /* game *game, int player, int asker, int *buf, int size */ ); extern void FreeGame( /* game *game */ ); extern int TurnType( /* game *game */ ); extern int TurnPlayerActive( /* game *game, int player */ ); extern int NumberOfTargets( /* game *game, int targettype */); extern char *NameOfTarget( /* game *game, int targettype, int targetnum */); extern int StuffAboutTarget( /* game *game, int targettype, int targetnum */); /* targettype is QuVal_Target_* */ extern int NumberOfBeings( /* game *game, int targettype */); extern int HitPointsOfBeing( /* game *game, int targettype, int indexnum */); extern int StuffAboutBeing( /* game *game, int targettype, int indexnum */); extern int OwnerOfCreature( /* game *game, int indexnum */); extern char *NameOfBeing( /* game *game, int targettype, int indexnum */); /* targettype is QuVal_Target_* */ extern void LogInTranscript( /* game *game, char *str */); extern void WriteTranscript( /* game *game, FILE *f */); spellcast-1.0/internal.h100644 2756 144 10300 5515617422 13545 0ustar benusers#include "spelllist.h" #define PrintMsg(msg) (log_text(self, msg),\ self->callbacks.proc_PrintMsg)((msg), self,\ (self->rock)) #define PrintMsg2(person, msg1, msgelse) (log_text(self, msgelse),\ self->callbacks.proc_PrintMsg2)((person), (msg1),\ (msgelse), self, (self->rock)) #define PrintMsg3(person1, person2, msg1, msg2, msgelse) (log_text(self, msgelse),\ self->callbacks.proc_PrintMsg3)((person1), (person2),\ (msg1), (msg2), (msgelse), self, (self->rock)) #define Queries(numqueries, querylist) (setup_targetlist(self),\ (self->callbacks.proc_Queries)((numqueries),\ (querylist), self, (self->rock))) #define MAXSPELLCHOICES (16) /* max number of spells that could possibly be invoked with one gesture */ struct target { char *name; int index; long stuff; }; struct realgame { struct interface callbacks; char *rock; int numplayers; int turn; int turntype; int turnactive[MAXPLAYERS]; char *gamelog; int gamelog_pos; int gamelog_size; struct wizard *wiz[MAXPLAYERS]; struct creature *cre; int numcres, cre_size; struct query *querylist; int querylist_size; int numqueries; int numtargets[3]; struct target *targetlist[3]; int targetlist_size[3]; struct castspell *castlist, *hastelist; /* per-round data */ int fl_icestorm, fl_firestorm, fl_dispelmagic; int blind_array; }; struct wizgesture { int did[2]; int invisible; /* was invisible for this move? */ int blind; /* bit-array -- who was blind this move? */ int turnnum, log_hp; }; struct permstats { int mind_spell, mind_detail; int fl_haste; int fl_prot_evil; int fl_resist_heat; int fl_resist_cold; int fl_blindness; int fl_invisibility; }; struct wizard { int alive; int hitpoints, max_hitpoints; int resistant_heat, resistant_cold, prot_from_evil, haste, timestop; int invisibility, blindness; int poison_time, disease_time; int mind_spell, mind_caster; struct permstats perm; char *name; int gender; /* per-round */ int zaplist[NUMSPELLS]; int enchant_caster, raisedead_caster, enchant_ppend; int fl_resist_heat, fl_resist_cold; int fl_resist_icestorm; /* due to fireball hits */ int numgests; int gests_size; struct wizgesture *gests; int surrendered; int fl_cast_lightning; int hand_paralyzed; int perm_time, delay_time; int delay_bank; int foundlist[NUMSPELLS]; int llist[MAXSPELLCHOICES], rlist[MAXSPELLCHOICES]; }; struct creature { int alive; int hitpoints, max_hitpoints; int resistant_heat, resistant_cold, prot_from_evil, haste, timestop; int invisibility, blindness; int poison_time, disease_time; int mind_spell, mind_caster; struct permstats perm; char *name; int gender; /* per-round */ int zaplist[NUMSPELLS]; int enchant_caster, raisedead_caster, enchant_ppend; int fl_resist_heat, fl_resist_cold; int fl_resist_icestorm; /* due to fireball hits */ int type; int nocorpse; int owner; int last_target, last_targettype; int nowm_spell, nowm_caster; }; union being { struct { int alive; int hitpoints, max_hitpoints; int resistant_heat, resistant_cold, prot_from_evil, haste, timestop; int invisibility, blindness; int poison_time, disease_time; int mind_spell, mind_caster; struct permstats perm; char *name; int gender; /* per-round */ int zaplist[NUMSPELLS]; int enchant_caster, raisedead_caster, enchant_ppend; int fl_resist_heat, fl_resist_cold; int fl_resist_icestorm; /* due to fireball hits */ } both; struct wizard wiz; struct creature cre; }; #define MASK_LEFT (1) #define MASK_RIGHT (2) #define MASK_TWOHAND (4) struct castspell { int caster; int handage; int spellnum; int target; int targettype; /* QuVal_Target_*, or 0 for nobody, or (-1) for no target required */ int permanent; int rock; struct castspell *next; }; #define Creature_GOBLIN (1) #define Creature_OGRE (2) #define Creature_TROLL (3) #define Creature_GIANT (4) #define Creature_ICEL (5) #define Creature_FIREL (6) extern void setup_targetlist(); /* needed if Queries() is to be used */ spellcast-1.0/main.c100644 2756 144 26145 5515617423 12667 0ustar benusers/* This program is copyright 1993 by Andrew Plotkin. The source code may be freely copied, distributed, and modified, as long as this copyright notice is retained. */ #include #include #include #include #include "handwave.h" #include "spelllist.h" #include "patchlevel.h" #include "xspell.h" int win_wid, win_hgt; struct player *players; int numplayers; int turnstate; game *gameval = NULL; static int defaultnum = 0; static char *defaultnamelist[10] = {"White", "Black", "Red", "Green", "Blue", "Yellow", "Orange", "Purple", "Grey", "Charteuse"}; static char *namelist[MAXPLAYERS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; static char *displist[MAXPLAYERS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; static int genderlist[MAXPLAYERS] = {Gender_MALE, Gender_MALE, Gender_MALE, Gender_MALE, Gender_MALE, Gender_MALE, Gender_MALE, Gender_MALE}; static struct query savequery = { 0, Qu_SaveTranscript, NULL, 0 }; static void PrintMsg(), PrintMsg2(), PrintMsg3(); extern void redraw(); extern void XQueries(); main(argc, argv) int argc; char *argv[]; { struct interface procs; struct maingame ignorerock; static char inbuf[256]; int whowon; int ix, val; struct player *py; int movelist[MAXPLAYERS*2]; procs.proc_PrintMsg = PrintMsg; procs.proc_PrintMsg2 = PrintMsg2; procs.proc_PrintMsg3 = PrintMsg3; procs.proc_Queries = XQueries; if (argc==1) { printf("usage: spellcast RemoteDisplay [ RemoteDisplay2 ... ]\n"); exit(12); } numplayers = 1; displist[0] = NULL; for (ix=1; ix MAXPLAYERS) { printf("There is a maximum of %d players!\n", MAXPLAYERS); exit(12); } players = (struct player *)malloc(sizeof(struct player) * numplayers); win_wid = 832; if (numplayers > 3) win_wid += (numplayers-3) * (2*GEST_SIZE + 20); win_hgt = 750; turnstate = State_Init; for (ix=0; ixturn_active = TurnPlayerActive(gameval, ix); py->turn_done = !py->turn_active; } for (ix=0; ixgesture_chosen[0] = Gesture_NOTHING; py->gesture_chosen[1] = Gesture_NOTHING; clear_answers(py); if (py->turn_active) switch (val) { case Turn_HASTE: add_answer(py, "Enter your gestures for your Hastened move.", "", 1, 0, NULL, 0); break; case Turn_TIMESTOP: add_answer(py, "Enter your gestures for your Time-Stopped move.", "", 1, 0, NULL, 0); break; default: add_answer(py, "Enter your gestures for this move, at the bottom of your gesture list.", "", 1, 0, NULL, 0); break; } else switch (val) { case Turn_HASTE: add_answer(py, "Other people are Hastened this turn.", "", 1, 0, NULL, 0); break; case Turn_TIMESTOP: add_answer(py, "You are frozen in time.", "", 1, 0, NULL, 0); break; default: add_answer(py, "You are out of the game.", "", 1, 0, NULL, 0); break; } redraw_column(py); draw_button(py, 0, 1); /* redraw turn-end button */ redraw_queries_only(py, 0); /*update_statlist(py);*/ } mainloop(); for (ix=0; ixgesture_chosen[0]; movelist[ix*2+1] = py->gesture_chosen[1]; } whowon = RunTurn(gameval, movelist); } while (whowon < 0); if (whowon==MAXPLAYERS) sprintf(inbuf, "\n+++ The game is a draw +++\n"); else sprintf(inbuf, "\n+++ %s has won +++\n", NameOfBeing(gameval, QuVal_Target_Wizard, whowon)); PrintMsg(inbuf, gameval, &ignorerock); LogInTranscript(gameval, inbuf); LogInTranscript(gameval, "\n"); turnstate = State_End; for (ix=0; ixturn_active = 1; py->turn_done = 0; } for (ix=0; ixdpy = XOpenDisplay(displist[pnum]); if (!py->dpy) { fprintf(stderr, "spellcast: could not open display for player %d.\n", pnum); return 0; } py->scn = DefaultScreen(py->dpy); py->win = XCreateSimpleWindow(py->dpy, DefaultRootWindow(py->dpy), 100, 100, win_wid, win_hgt, 1, BlackPixel(py->dpy, py->scn), WhitePixel(py->dpy, py->scn)); py->backpm = XCreatePixmap(py->dpy, py->win, win_wid, win_hgt, DefaultDepth(py->dpy, py->scn)); py->backstore = 0; { /* make some window managers happy */ XWMHints wmhints; wmhints.flags = InputHint; wmhints.input = True; XSetWMHints(py->dpy, py->win, &wmhints); } attr.event_mask = EVENTMASK; XChangeWindowAttributes(py->dpy, py->win, CWEventMask, &attr); tmp = XGetDefault(py->dpy, "spellcast", "name"); if (tmp) { name = (char *)malloc(strlen(tmp)+1); strcpy(name, tmp); tmp = index(name, ':'); if (!tmp) genderlist[pnum] = Gender_MALE; else { switch (*(tmp+1)) { case 'f': case 'F': genderlist[pnum] = Gender_FEMALE; break; case 'n': case 'N': genderlist[pnum] = Gender_NEUTER; break; case 'x': case 'X': genderlist[pnum] = Gender_NONE; break; case 'm': case 'M': default: genderlist[pnum] = Gender_MALE; break; } *tmp = '\0'; } tmp = name+strlen(name)-1; while (tmp>name && (*tmp==' ' || *tmp=='\t')) tmp--; *(tmp+1) = '\0'; namelist[pnum] = name; } else { namelist[pnum] = defaultnamelist[defaultnum]; defaultnum++; } do { val = 0; if (strlen(namelist[pnum])<1) val = 1; if (!strcmp(namelist[pnum], "nobody")) val = 1; if (!strcmp(namelist[pnum], "Nobody")) val = 1; for (ix=0; ixdpy, py->win, winname); XMapWindow(py->dpy, py->win); fontname = XGetDefault(py->dpy, "spellcast", "font"); if (!fontname) fontname = BODYFONT; py->font = XLoadQueryFont(py->dpy, fontname); if (!py->font) { fprintf(stderr, "spellcast: could not find font %s for player %d. Switching to %s...\n", fontname, pnum, BODYFONT_ALT); py->font = XLoadQueryFont(py->dpy, BODYFONT_ALT); if (!py->font) { fprintf(stderr, "spellcast: could not find font %s for player %d. Switching to %s...\n", BODYFONT_ALT, pnum, BODYFONT_ALT2); py->font = XLoadQueryFont(py->dpy, BODYFONT_ALT2); if (!py->font) { fprintf(stderr, "spellcast: could not find font %s for player %d.\n", BODYFONT_ALT2, pnum); return 0; } } } gcvalues.font = py->font->fid; gcvalues.foreground = BlackPixel(py->dpy, py->scn); gcvalues.background = WhitePixel(py->dpy, py->scn); py->blackgc = XCreateGC(py->dpy, py->win, GCForeground|GCBackground|GCFont, &gcvalues); XSetGraphicsExposures(py->dpy, py->blackgc, 0); gcvalues.foreground = WhitePixel(py->dpy, py->scn); gcvalues.background = BlackPixel(py->dpy, py->scn); py->whitegc = XCreateGC(py->dpy, py->win, GCForeground|GCBackground|GCFont, &gcvalues); XSetGraphicsExposures(py->dpy, py->whitegc, 0); init_bitmaps(py); init_xtext(pnum); init_query(py); init_stats(py); init_talk(py); py->button_lit = (-1); redraw(py); return 1; } #define POPUP_ELBOW (8) void adjust_rect(mrec) struct rect *mrec; { if (mrec->x+mrec->w >= win_wid-POPUP_ELBOW) mrec->x = win_wid-POPUP_ELBOW - mrec->w; if (mrec->y+mrec->h >= win_hgt-POPUP_ELBOW) mrec->y = win_hgt-POPUP_ELBOW - mrec->h; if (mrec->x < POPUP_ELBOW) mrec->x = POPUP_ELBOW; if (mrec->y < POPUP_ELBOW) mrec->y = POPUP_ELBOW; } void backing_store(py, mrec) struct player *py; struct rect *mrec; { py->backrec = (*mrec); if (py->backstore) { printf("ERROR: backing store already on\n"); } py->backstore = 1; py->gotexpose = 0; XCopyArea(py->dpy, py->win, py->backpm, py->blackgc, mrec->x, mrec->y, mrec->w, mrec->h, 0, 0); } void backing_restore(py) struct player *py; { if (!py->backstore) { printf("ERROR: backing store already off\n"); } py->backstore = 0; if (py->gotexpose) { XClearArea(py->dpy, py->win, py->backrec.x, py->backrec.y, py->backrec.w, py->backrec.h, 0); redraw(py); } else { XCopyArea(py->dpy, py->backpm, py->win, py->blackgc, 0, 0, py->backrec.w, py->backrec.h, py->backrec.x, py->backrec.y); } } static void PrintMsg(msg, gameval, rock) char *msg; game *gameval; struct maingame *rock; { int ix; if (msg) { for (ix=0; ix #include #include #include "handwave.h" #include "spelllist.h" #include "xspell.h" #define BBOX_X (32) #define BBOX_Y (576) #define BBOX_W (2) #define BBOX_H (1) #define BUTTON_W (150) #define BUTTON_H (32) #define BUTTON_CORNER (3) #define BUTTON_SPACE (4) void draw_button(); void DrawStringCentered(py, str, xpos, ypos) struct player *py; char *str; int xpos, ypos; { static XCharStruct overall; int direction, ascent, descent; int len = strlen(str); XTextExtents(py->font, str, len, &direction, &ascent, &descent, &overall); XDrawImageString(py->dpy, py->win, py->blackgc, xpos-(overall.width)/2, ypos, str, len); } /* list NUMSPELLS-1 spells (skip SP__STAB) */ void draw_spelllist(py) struct player *py; { int ix, jx, snum, gx, val, pos; int tablehgt; struct spelldef *spel; char *cx; #define SL_COLUMNS (2) int posx = py->spelllist_rect.x+16; int posy = py->spelllist_rect.y+32; draw_frame(py, &py->spelllist_rect); if (py->spelllist_way==1) cx = "Spell List (left button: sorted by gesture)"; else if (py->spelllist_way==2) cx = "Spell List (middle button: alphabetical sort)"; else cx = "Spell List (right button: reversed sort by gesture)"; DrawStringCentered(py, cx, py->spelllist_rect.x+py->spelllist_rect.w/2, py->spelllist_rect.y+4+py->lineheight); tablehgt = (NUMSPELLS-1+SL_COLUMNS-1) / SL_COLUMNS; for (ix=0; ixspelllist_way==1) snum = ix*tablehgt+jx; else if (py->spelllist_way==2) snum = alphabet_sort_list[ix*tablehgt+jx]; else snum = reverse_sort_list[ix*tablehgt+jx]; if (snum >= NUMSPELLS-1) break; spel = &(spelllist[snum]); for (gx=0; gxlength; gx++) { val = spel->gests[gx]; pos = ((py->spelllist_way==3) ? (gx+(8-spel->length))*(GEST_SMALL+1)-8 : gx*(GEST_SMALL+1)); /*spel->length-gx-1 for reversed gestures*/ XCopyPlane(py->dpy, py->spelllistbm [(val&Gesture_DOUBLE)?1:0] [(val&(~Gesture_DOUBLE))-1], py->win, py->blackgc, 0, 0, GEST_SMALL, GEST_SMALL, posx+ix*300+pos, posy+jx*18, 1); } if (py->spelllist_way!=3) for (gx = spel->length; gx<8; gx++) { pos = gx*(GEST_SMALL+1); XCopyPlane(py->dpy, py->spelllistbm[0][6], py->win, py->blackgc, 0, 0, GEST_SMALL, GEST_SMALL, posx+ix*300+pos, posy+jx*18, 1); } XDrawImageString(py->dpy, py->win, py->blackgc, posx+ix*300+8*(GEST_SMALL+1), posy+jx*18+((GEST_SMALL+py->lineheight)/2)-2, spel->name, strlen(spel->name)); } } static void light_button(py, bnum) struct player *py; int bnum; { int hitx, hity; if (py->button_lit != (-1)) { hitx = py->button_lit % BBOX_W; hity = py->button_lit / BBOX_W; XDrawRectangle(py->dpy, py->win, py->whitegc, BBOX_X+hitx*BUTTON_W-1, BBOX_Y+hity*BUTTON_H-1, BUTTON_W-BUTTON_SPACE+2, BUTTON_H-BUTTON_SPACE+2); } py->button_lit = bnum; if (py->button_lit != (-1)) { hitx = py->button_lit % BBOX_W; hity = py->button_lit / BBOX_W; XDrawRectangle(py->dpy, py->win, py->blackgc, BBOX_X+hitx*BUTTON_W-1, BBOX_Y+hity*BUTTON_H-1, BUTTON_W-BUTTON_SPACE+2, BUTTON_H-BUTTON_SPACE+2); } } void redraw_buttons(py) struct player *py; { int bnum; for (bnum=0; bnumbutton_lit); } void draw_button(py, bnum, mode) struct player *py; int bnum; int mode; /* 0 for all, 1 for clear interior and relabel */ { int ix, jx; char *cx; static XPoint plist[9] = { {0+BUTTON_CORNER, 0}, {BUTTON_W-BUTTON_SPACE-2*BUTTON_CORNER, 0}, {BUTTON_CORNER, BUTTON_CORNER}, {0, BUTTON_H-BUTTON_SPACE-2*BUTTON_CORNER}, {-BUTTON_CORNER, BUTTON_CORNER}, {-(BUTTON_W-BUTTON_SPACE-2*BUTTON_CORNER), 0}, {-BUTTON_CORNER, -BUTTON_CORNER}, {0, -(BUTTON_H-BUTTON_SPACE-2*BUTTON_CORNER)}, {BUTTON_CORNER, -BUTTON_CORNER}, }; ix = bnum % BBOX_W; jx = bnum / BBOX_W; if (mode==0) { plist[0].x = BBOX_X + ix*BUTTON_W + BUTTON_CORNER; plist[0].y = BBOX_Y + jx*BUTTON_H; XDrawLines(py->dpy, py->win, py->blackgc, plist, 9, CoordModePrevious); } if (mode==1) { /* clear interior */ XClearArea(py->dpy, py->win, BBOX_X + ix*BUTTON_W + BUTTON_CORNER, BBOX_Y + jx*BUTTON_H + BUTTON_CORNER, BUTTON_W-BUTTON_SPACE-2*BUTTON_CORNER, BUTTON_H-BUTTON_SPACE-2*BUTTON_CORNER, 0); } switch (bnum) { case 0: if (!py->turn_active) cx = "please wait...."; else if (turnstate == State_Top) { if (!py->turn_done) cx = "End Move"; else cx = "Move ENDED."; } else if (turnstate == State_End) { if (!py->turn_done) cx = "Quit"; else cx = "Wait...."; } else { if (!py->turn_done) cx = "End Answers"; else cx = "Answers ENDED."; } DrawStringCentered(py, cx, BBOX_X+ix*BUTTON_W+BUTTON_W/2, BBOX_Y+jx*BUTTON_H+py->lineheight+1); break; case 1: DrawStringCentered(py, "Spell List", BBOX_X+ix*BUTTON_W+BUTTON_W/2, BBOX_Y+jx*BUTTON_H+py->lineheight+1); break; default: break; } } int in_bbox_box(py, xpos, ypos) struct player *py; int xpos, ypos; { return (xpos >= BBOX_X && xpos < BBOX_X + BBOX_W*BUTTON_W && ypos >= BBOX_Y && ypos < BBOX_Y + BBOX_H*BUTTON_H); } int button_hit(py, xpos, ypos, button) struct player *py; int xpos, ypos; int button; { int hitx, hity, bnum; int ix; hitx = (xpos-BBOX_X) / BUTTON_W; hity = (ypos-BBOX_Y) / BUTTON_H; if (hitx<0 || hity<0 || hitx>=BBOX_W || hity>=BBOX_H) return ms_None; bnum = hitx + hity*BBOX_W; switch (bnum) { case 0: if (!py->turn_active) return ms_None; light_button(py, bnum); return ms_DoneBtn; break; case 1: py->spelllist_rect.w = 620; py->spelllist_rect.h = 420; py->spelllist_rect.x = 10; py->spelllist_rect.y = 10; py->spelllist_way = button; backing_store(py, &py->spelllist_rect); draw_spelllist(py); return ms_SpellBtn; break; default: printf("ERROR: unknown button thing!\n"); break; } } int button_motion(py, xpos, ypos, button) struct player *py; int xpos, ypos; int button; { int hitx, hity, bnum; switch (py->mousestate) { case ms_DoneBtn: hitx = (xpos-BBOX_X+BUTTON_W) / BUTTON_W - 1; hity = (ypos-BBOX_Y+BUTTON_H) / BUTTON_H - 1; if (hitx==0 && hity==0) { if (py->button_lit!=0) light_button(py, 0); } else { if (py->button_lit!=(-1)) light_button(py, (-1)); } break; case ms_SpellBtn: default: break; } } int button_release(py, xpos, ypos, button) struct player *py; int xpos, ypos; int button; { int ix, isok; switch (py->mousestate) { case ms_DoneBtn: isok = 1; if (turnstate==State_EQueries || turnstate==State_Queries) { for (ix=0; ixsiquery.nlines; ix++) if (!py->answers[ix].done) { isok = 0; strcpy(py->answers[ix].ans_str, ""); /* ### set value to scroll to? */ } } if (py->button_lit==0) { if (isok) { py->turn_done = !(py->turn_done); redraw_done_markers(py); } else redraw_queries_only(py, 0); light_button(py, (-1)); } draw_button(py, 0, 1); break; case ms_SpellBtn: backing_restore(py); break; default: break; } } spellcast-1.0/xgest.c100644 2756 144 25654 5515617425 13103 0ustar benusers#include #include #include #include "handwave.h" #include "spelllist.h" #include "xspell.h" #include "ba.bm" #include "bc.bm" #include "bd.bm" #include "bf.bm" #include "bk.bm" #include "bn.bm" #include "bp.bm" #include "bs.bm" #include "bu.bm" #include "bw.bm" #include "bva.bm" #include "bvc.bm" #include "bvd.bm" #include "bvf.bm" #include "bvk.bm" #include "bvp.bm" #include "bvs.bm" #include "bvw.bm" #include "sc.bm" #include "sd.bm" #include "sd2.bm" #include "sf.bm" #include "sf2.bm" #include "sp.bm" #include "sp2.bm" #include "ss.bm" #include "ss2.bm" #include "sw.bm" #include "sw2.bm" #include "sdot.bm" #define COLUMN_SIZE (8) #define COLUMN_X (476) #define COLUMN_Y (33) #define GEST_SPACE (50) void init_bitmaps(py) struct player *py; { py->gesturebm[0][0] = XCreatePixmapFromBitmapData(py->dpy, py->win, bn_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[0][1] = XCreatePixmapFromBitmapData(py->dpy, py->win, bp_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[0][2] = XCreatePixmapFromBitmapData(py->dpy, py->win, bd_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[0][3] = XCreatePixmapFromBitmapData(py->dpy, py->win, bf_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[0][4] = XCreatePixmapFromBitmapData(py->dpy, py->win, bw_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[0][5] = XCreatePixmapFromBitmapData(py->dpy, py->win, bc_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[0][6] = XCreatePixmapFromBitmapData(py->dpy, py->win, bs_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[0][7] = XCreatePixmapFromBitmapData(py->dpy, py->win, bk_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[0][8] = XCreatePixmapFromBitmapData(py->dpy, py->win, ba_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[0][9] = XCreatePixmapFromBitmapData(py->dpy, py->win, bu_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[1][0] = XCreatePixmapFromBitmapData(py->dpy, py->win, bn_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[1][1] = XCreatePixmapFromBitmapData(py->dpy, py->win, bvp_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[1][2] = XCreatePixmapFromBitmapData(py->dpy, py->win, bvd_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[1][3] = XCreatePixmapFromBitmapData(py->dpy, py->win, bvf_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[1][4] = XCreatePixmapFromBitmapData(py->dpy, py->win, bvw_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[1][5] = XCreatePixmapFromBitmapData(py->dpy, py->win, bvc_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[1][6] = XCreatePixmapFromBitmapData(py->dpy, py->win, bvs_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[1][7] = XCreatePixmapFromBitmapData(py->dpy, py->win, bvk_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[1][8] = XCreatePixmapFromBitmapData(py->dpy, py->win, bva_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->gesturebm[1][9] = XCreatePixmapFromBitmapData(py->dpy, py->win, bu_bits, GEST_SIZE, GEST_SIZE, 1, 0, 1); py->spelllistbm[0][0] = XCreatePixmapFromBitmapData(py->dpy, py->win, sp_bits, GEST_SMALL, GEST_SMALL, 1, 0, 1); py->spelllistbm[0][1] = XCreatePixmapFromBitmapData(py->dpy, py->win, sd_bits, GEST_SMALL, GEST_SMALL, 1, 0, 1); py->spelllistbm[0][2] = XCreatePixmapFromBitmapData(py->dpy, py->win, sf_bits, GEST_SMALL, GEST_SMALL, 1, 0, 1); py->spelllistbm[0][3] = XCreatePixmapFromBitmapData(py->dpy, py->win, sw_bits, GEST_SMALL, GEST_SMALL, 1, 0, 1); py->spelllistbm[0][4] = 0; /* there is no single clap */ py->spelllistbm[0][5] = XCreatePixmapFromBitmapData(py->dpy, py->win, ss_bits, GEST_SMALL, GEST_SMALL, 1, 0, 1); py->spelllistbm[0][6] = XCreatePixmapFromBitmapData(py->dpy, py->win, sdot_bits, GEST_SMALL, GEST_SMALL, 1, 0, 1); py->spelllistbm[1][0] = XCreatePixmapFromBitmapData(py->dpy, py->win, sp2_bits, GEST_SMALL, GEST_SMALL, 1, 0, 1); py->spelllistbm[1][1] = XCreatePixmapFromBitmapData(py->dpy, py->win, sd2_bits, GEST_SMALL, GEST_SMALL, 1, 0, 1); py->spelllistbm[1][2] = XCreatePixmapFromBitmapData(py->dpy, py->win, sf2_bits, GEST_SMALL, GEST_SMALL, 1, 0, 1); py->spelllistbm[1][3] = XCreatePixmapFromBitmapData(py->dpy, py->win, sw2_bits, GEST_SMALL, GEST_SMALL, 1, 0, 1); py->spelllistbm[1][4] = XCreatePixmapFromBitmapData(py->dpy, py->win, sc_bits, GEST_SMALL, GEST_SMALL, 1, 0, 1); py->spelllistbm[1][5] = XCreatePixmapFromBitmapData(py->dpy, py->win, ss2_bits, GEST_SMALL, GEST_SMALL, 1, 0, 1); py->spelllistbm[1][6] = 0; /* no double dots */ } void redraw_column(py) struct player *py; { int buf[COLUMN_SIZE+1]; int ix, gx; int vall, valr; int posx, posy; int pnum = py-players; if (turnstate==State_Init) { return; } for (ix=0; ixlineheight+py->ascent); if (turnstate!=State_Top) { SeeGesture(gameval, ix, pnum, buf, COLUMN_SIZE); gx=0; if (turnstate==State_EQueries && ix!=pnum) { buf[0] = (Gesture_UNCLEAR<<5) + Gesture_UNCLEAR; } } else { SeeGesture(gameval, ix, pnum, buf+1, COLUMN_SIZE); gx=1; if (ix==pnum) { vall = py->gesture_chosen[0]; valr = py->gesture_chosen[1]; } else { vall = Gesture_UNCLEAR; valr = Gesture_UNCLEAR; } XCopyPlane(py->dpy, py->gesturebm[0][vall], py->win, py->blackgc, 0, 0, GEST_SIZE, GEST_SIZE, posx, posy+(GEST_SPACE)*(COLUMN_SIZE-1), 1); XCopyPlane(py->dpy, py->gesturebm[1][valr], py->win, py->blackgc, 0, 0, GEST_SIZE, GEST_SIZE, posx+GEST_SPACE, posy+(GEST_SPACE)*(COLUMN_SIZE-1), 1); } for (/* gx is set */; gx> 5; vall = buf[gx] & 31; /* 31==01111 */ } XCopyPlane(py->dpy, py->gesturebm[0][vall], py->win, py->blackgc, 0, 0, GEST_SIZE, GEST_SIZE, posx, posy+(GEST_SPACE)*(COLUMN_SIZE-(gx+1)), 1); XCopyPlane(py->dpy, py->gesturebm[1][valr], py->win, py->blackgc, 0, 0, GEST_SIZE, GEST_SIZE, posx+GEST_SPACE, posy+(GEST_SPACE)*(COLUMN_SIZE-(gx+1)), 1); } } } void draw_frame(py, mrec) struct player *py; struct rect *mrec; { XClearArea(py->dpy, py->win, mrec->x, mrec->y, mrec->w, mrec->h, 0); XDrawRectangle(py->dpy, py->win, py->blackgc, mrec->x, mrec->y, mrec->w-FRAME_SHADOW, mrec->h-FRAME_SHADOW); XDrawRectangle(py->dpy, py->win, py->blackgc, mrec->x+1, mrec->y+1, mrec->w-FRAME_SHADOW-2, mrec->h-FRAME_SHADOW-2); XFillRectangle(py->dpy, py->win, py->blackgc, mrec->x+mrec->w-FRAME_SHADOW, mrec->y+FRAME_SHADOW, FRAME_SHADOW, mrec->h-FRAME_SHADOW); XFillRectangle(py->dpy, py->win, py->blackgc, mrec->x+FRAME_SHADOW, mrec->y+mrec->h-FRAME_SHADOW, mrec->w-FRAME_SHADOW, FRAME_SHADOW); } void draw_gesture_menu(py) struct player *py; { static char gesture_prompt[2][128]; int ix, jx; int posx, posy; draw_frame(py, &py->gesture_rect); sprintf(gesture_prompt[0], "What gesture do you want to"); sprintf(gesture_prompt[1], "make with your %s hand?", py->gesture_hand?"right":"left"); XDrawImageString(py->dpy, py->win, py->blackgc, py->gesture_rect.x+20, py->gesture_rect.y+10+py->lineheight, gesture_prompt[0], strlen(gesture_prompt[0])); XDrawImageString(py->dpy, py->win, py->blackgc, py->gesture_rect.x+20, py->gesture_rect.y+10+2*py->lineheight, gesture_prompt[1], strlen(gesture_prompt[1])); posx = py->gesture_rect.x+20; posy = py->gesture_rect.y+60; for (jx=0; jx<2; jx++) for (ix=0; ix<4; ix++) { XCopyPlane(py->dpy, py->gesturebm[py->gesture_hand][jx*4+ix], py->win, py->blackgc, 0, 0, GEST_SIZE, GEST_SIZE, posx+ix*GEST_SPACE, posy+jx*GEST_SPACE, 1); } } int in_gesture_box(py, xpos, ypos) struct player *py; int xpos, ypos; { return (xpos >= COLUMN_X && xpos < COLUMN_X + numplayers*(2*GEST_SIZE + 20) && ypos >= COLUMN_Y && ypos < COLUMN_Y + GEST_SPACE*COLUMN_SIZE); } int gesture_hit(py, xpos, ypos, button) struct player *py; int xpos, ypos; /* relative to column pos */ int button; { int pnum = py-players; int hitcol, hitrow, hithand; xpos -= COLUMN_X; ypos -= COLUMN_Y; if (!py->turn_active || py->turn_done) return ms_None; hitcol = xpos / (2*GEST_SIZE + 20); hitrow = ypos / GEST_SPACE; hithand = (xpos % (2*GEST_SIZE + 20)) / GEST_SPACE; if (hithand < 0 || hithand > 1) return ms_None; if (hitrow==COLUMN_SIZE-1 && hitcol==pnum && button==1 && turnstate==State_Top) { py->gesture_rect.w = 240; py->gesture_rect.h = 180; py->gesture_rect.x = xpos + COLUMN_X - py->gesture_rect.w/2; py->gesture_rect.y = ypos + COLUMN_Y - py->gesture_rect.h/2; py->gesture_hand = hithand; py->gesture_sel = (-1); adjust_rect(&py->gesture_rect); backing_store(py, &py->gesture_rect); draw_gesture_menu(py); gesture_motion(py, xpos+COLUMN_X, ypos+COLUMN_Y, button); return ms_Gesture; } return ms_None; } int gesture_motion(py, xpos, ypos, button) struct player *py; int xpos, ypos; int button; { int hitx, hity, hit; int posx, posy; posx = py->gesture_rect.x+20; posy = py->gesture_rect.y+60; hitx = (xpos - posx + GEST_SPACE) / GEST_SPACE - 1; hity = (ypos - posy + GEST_SPACE) / GEST_SPACE - 1; if (hitx>=0 && hitx<4 && hity>=0 && hity<2) hit = hity*4 + hitx; else hit = (-1); if (hit==py->gesture_sel) return; if (py->gesture_sel != (-1)) { /* erase old */ hitx = py->gesture_sel % 4; hity = py->gesture_sel / 4; XDrawRectangle(py->dpy, py->win, py->whitegc, posx+hitx*GEST_SPACE-1, posy+hity*GEST_SPACE-1, GEST_SIZE+1, GEST_SIZE+1); XDrawRectangle(py->dpy, py->win, py->whitegc, posx+hitx*GEST_SPACE-2, posy+hity*GEST_SPACE-2, GEST_SIZE+3, GEST_SIZE+3); } py->gesture_sel = hit; if (py->gesture_sel != (-1)) { /* draw new */ hitx = py->gesture_sel % 4; hity = py->gesture_sel / 4; XDrawRectangle(py->dpy, py->win, py->blackgc, posx+hitx*GEST_SPACE-1, posy+hity*GEST_SPACE-1, GEST_SIZE+1, GEST_SIZE+1); XDrawRectangle(py->dpy, py->win, py->blackgc, posx+hitx*GEST_SPACE-2, posy+hity*GEST_SPACE-2, GEST_SIZE+3, GEST_SIZE+3); } } int gesture_release(py, xpos, ypos, button) struct player *py; int xpos, ypos; /* relative to column pos */ int button; { int posx, posy; int pnum = py-players; xpos -= COLUMN_X; ypos -= COLUMN_Y; backing_restore(py); if (py->gesture_sel != (-1)) py->gesture_chosen[py->gesture_hand] = py->gesture_sel; posx = COLUMN_X + pnum*(2*GEST_SIZE + 20); posy = COLUMN_Y; XCopyPlane(py->dpy, py->gesturebm[0][py->gesture_chosen[0]], py->win, py->blackgc, 0, 0, GEST_SIZE, GEST_SIZE, posx, posy+(GEST_SPACE)*(COLUMN_SIZE-1), 1); XCopyPlane(py->dpy, py->gesturebm[1][py->gesture_chosen[1]], py->win, py->blackgc, 0, 0, GEST_SIZE, GEST_SIZE, posx+GEST_SPACE, posy+(GEST_SPACE)*(COLUMN_SIZE-1), 1); } spellcast-1.0/etran.c100644 2756 144 5065 5515617447 13040 0ustar benusers#include #include #include "handwave.h" #include "internal.h" static char bigbuf[512]; void log_text(); void init_transcript(self) struct realgame *self; { self->gamelog_size = 4096; self->gamelog = (char *)malloc(sizeof(char) * self->gamelog_size); strcpy(self->gamelog, ""); self->gamelog_pos = 0; log_text(self, "Spellcast Game Transcript\n\n"); } void log_text(self, str) struct realgame *self; char *str; { int len; if (!str) return; len = strlen(str); if (len+self->gamelog_pos >= self->gamelog_size) { while (len+self->gamelog_pos >= self->gamelog_size) { self->gamelog_size *= 2; } self->gamelog = (char *)realloc(self->gamelog, sizeof(char) * self->gamelog_size); } strcpy(self->gamelog+self->gamelog_pos, str); self->gamelog_pos += len; } void LogInTranscript(pgame, str) game *pgame; char *str; { log_text((struct realgame *)pgame, str); } static char cheap_untranslate(val) int val; { switch (val) { case Gesture_PALM: return 'P'; case Gesture_DIGIT: return 'D'; case Gesture_FINGERS: return 'F'; case Gesture_WAVE: return 'W'; case Gesture_SNAP: return 'S'; case Gesture_CLAPHALF: return 'C'; case Gesture_KNIFE: return 'K'; case Gesture_NOTHING: return '.'; case Gesture_ANTISPELL: return '='; default: return '?'; } } void log_round_header(self) struct realgame *self; { char *cx; int ix, gnum; switch (self->turntype) { case Turn_TIMESTOP: cx = " (Time Stop)"; break; case Turn_HASTE: cx = " (Haste)"; break; default: cx = ""; break; } sprintf(bigbuf, "\n\tTurn %d%s:\n", self->turn, cx); log_text(self, bigbuf); for (ix=0; ixnumplayers; ix++) { struct wizard *wiz = self->wiz[ix]; if (wiz->alive) { if (self->turnactive[ix]) { gnum = wiz->numgests-1; sprintf(bigbuf, "%s (%d): %c %c\n", wiz->name, wiz->hitpoints, cheap_untranslate(wiz->gests[gnum].did[0]), cheap_untranslate(wiz->gests[gnum].did[1])); } else { sprintf(bigbuf, "%s (%d): [no gestures]\n", wiz->name, wiz->hitpoints); } log_text(self, bigbuf); } } for (ix=0; ixnumcres; ix++) { struct creature *thud = &(self->cre[ix]); if (thud->alive) { sprintf(bigbuf, "%s (%d)\n", thud->name, thud->hitpoints); log_text(self, bigbuf); } } log_text(self, "\n"); } #define ABBREVLEN (8) void WriteTranscript(pgame, f) game *pgame; FILE *f; { struct realgame *self = (struct realgame *)pgame; fputs(self->gamelog, f); } spellcast-1.0/makelist.c100644 2756 144 4671 5515617447 13542 0ustar benusers#include #include "handwave.h" #include "internal.h" #define MARGIN_SIDE 72 #define MARGIN_TOP 72 #define LINEHEIGHT 16 #define GEST_SPACE 12 #define TEXT_MARGIN 108 char *psroutine(val, size) int val; int *size; { int tmp; if (!size) size = (&tmp); switch (val) { case Gesture_PALM: *size = GEST_SPACE; return "showpalm"; case Gesture_DIGIT: *size = GEST_SPACE; return "showdigit"; case Gesture_FINGERS: *size = GEST_SPACE; return "showfinger"; case Gesture_WAVE: *size = GEST_SPACE; return "showwave"; case Gesture_SNAP: *size = GEST_SPACE; return "showsnap"; case Gesture_CLAPHALF: *size = GEST_SPACE; return "showclap"; case Gesture_PALM | Gesture_DOUBLE: *size = 17; return "showpalm2"; case Gesture_DIGIT | Gesture_DOUBLE: *size = 17; return "showdigit2"; case Gesture_FINGERS | Gesture_DOUBLE: *size = GEST_SPACE; return "showfinger2"; case Gesture_WAVE | Gesture_DOUBLE: *size = 17; return "showwave2"; case Gesture_SNAP | Gesture_DOUBLE: *size = 17; return "showsnap2"; case Gesture_CLAPHALF | Gesture_DOUBLE: *size = GEST_SPACE; return "showclap2"; default: *size = GEST_SPACE; return "nullact"; } } void dump_list(topedge, leftedge, filter) int topedge, leftedge; int (*filter)(); { int ix, gx; int xpos, ypos, xval; int val, hop; char *cx; struct spelldef *spel; for (ix=0; ixlength; gx++) { val = spel->gests[gx]; cx = psroutine(val, &hop); printf("%d %d %s\n", xval, ypos-1, cx); xval += hop; } printf("%d %d moveto %d %d lineto stroke\n", xval+3, ypos+4, xpos+TEXT_MARGIN-4, ypos+4); printf("%d %d moveto (%s) show\n", xpos+TEXT_MARGIN, ypos, spel->name); } } int alphasort(val) int val; { return alphabet_sort_list[val]; } main() { printf("/Times-Roman findfont 12 scalefont setfont\n"); printf("0.5 setlinewidth\n"); dump_list(772 - MARGIN_TOP, 0, NULL); dump_list(772 - MARGIN_TOP, 264, alphasort); printf("/Times-Bold findfont 14 scalefont setfont\n"); printf("306 752 moveto\n"); printf("(SpellCast spell lists -- sorted by gesture and name) centershow\n"); printf("\nshowpage\n"); } spellcast-1.0/spelllist.h100644 2756 144 3250 5515617450 13733 0ustar benusers#define NUMSPELLS (43) /* number of spells in the book */ #define MAXSPELLLENGTH 8 struct spelldef { int length; int gests[MAXSPELLLENGTH]; int extendable; /* with permanency */ int selfcast; /* generally cast it on yourself? */ char *name; }; extern struct spelldef spelllist[NUMSPELLS]; extern int reverse_sort_list[NUMSPELLS]; extern int alphabet_sort_list[NUMSPELLS]; #define SP__DISPEL_MAGIC (0) #define SP__SUMMON_ELEMENTAL (1) #define SP__MAGIC_MIRROR (2) #define SP__LIGHTNING_BOLT (3) #define SP__CURE_HEAVY_WOUNDS (4) #define SP__CURE_LIGHT_WOUNDS (5) #define SP__AMNESIA (6) #define SP__CONFUSION (7) #define SP__DISEASE (8) #define SP__BLINDNESS (9) #define SP__DELAYED_EFFECT (10) #define SP__RAISE_DEAD (11) #define SP__POISON (12) #define SP__PARALYSIS (13) #define SP__SUMMON_TROLL (14) #define SP__FIREBALL (15) #define SP__SHIELD (16) #define SP__SURRENDER (17) #define SP__REMOVE_ENCHANTMENT (18) #define SP__INVISIBILITY (19) #define SP__CHARM_MONSTER (20) #define SP__CHARM_PERSON (21) #define SP__SUMMON_OGRE (22) #define SP__FINGER_OF_DEATH (23) #define SP__HASTE (24) #define SP__MISSILE (25) #define SP__SUMMON_GOBLIN (26) #define SP__ANTI_SPELL (27) #define SP__PERMANENCY (28) #define SP__TIME_STOP (29) #define SP__RESIST_COLD (30) #define SP__FEAR (31) #define SP__FIRE_STORM (32) #define SP__LIGHTNING_BOLT2 (33) #define SP__CAUSE_LIGHT_WOUNDS (34) #define SP__SUMMON_GIANT (35) #define SP__CAUSE_HEAVY_WOUNDS (36) #define SP__COUNTER_SPELL (37) #define SP__ICE_STORM (38) #define SP__RESIST_HEAT (39) #define SP__PROTECTION_FROM_EVIL (40) #define SP__COUNTER_SPELL2 (41) #define SP__STAB (42) /* ok, it's not really a spell */ spellcast-1.0/xspell.h100644 2756 144 5713 5515617450 13235 0ustar benusersstruct maingame { int ignorestuff; }; struct line { int start; int len; int width; }; struct rect { int x, y, w, h; }; struct scroll_interface { struct player *py; int x, y, h; int top; int visible; int nlines; int lineheight; int grip; int moved; void (*redraw)(); }; #define MAXQUESTIONLENGTH (256) #define MAXANSWERLENGTH (64) struct target_list { int num; char **tnames; int *tnums; int size; }; struct answer { struct query *query; /* NULL for just a message */ int answer; int done; char qu_str[MAXQUESTIONLENGTH]; char ans_str[MAXANSWERLENGTH]; long rock; }; struct statthing { int index, type; int hp; long stuff; }; struct player { Display *dpy; int scn; Window win; Pixmap backpm; GC blackgc, whitegc; XFontStruct *font; Pixmap gesturebm[2][10]; Pixmap spelllistbm[2][7]; int backstore; struct rect backrec; int gotexpose; /* matters during backing store periods */ int cursx; /* pixels, lines */ int textx, texty; int lineheight; struct scroll_interface sitext, siquery, sistats; struct scroll_interface *scroll_active; int ascent, totalheight; struct line *lineindex; int lineindex_size; int linesnum; /* number of complete lines actually in buffer */ char *linebuf; /* null-terminated lines. The last one (pointed to by lineindex[linesnum].start) is incomplete (or empty), but still null-term. */ int linebuf_size; int addpoint; /* points to '\0' at end of incomplete line */ int mousestate, mousebutton; int button_lit; int turn_active, turn_done; int turn_blinklimit, turn_blinked; int gesture_chosen[2]; struct rect gesture_rect; int gesture_hand, gesture_sel; struct rect spelllist_rect; int spelllist_way; int query_hgt; int query_hit; int query_sel; struct target_list *query_tl; struct rect query_rect; struct target_list TLRightHand, TLLeftHand; struct answer *answers; int answers_size; struct statthing *statlist; int statlist_size; char *talk_buf; int talk_size; int talk_pt, talk_xlast, talk_x, talk_toobig; }; extern int win_wid, win_hgt; #define SCROLL_W (16) #define GEST_SIZE (48) #define GEST_SMALL (16) #define FRAME_SHADOW (3) /* values for py->mousestate */ #define ms_None (0) #define ms_Gesture (1) #define ms_DoneBtn (2) #define ms_SpellBtn (3) #define ms_Scroll (4) #define ms_Query (5) #define ms_Talk (6) #define EVENTMASK (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | \ KeyPressMask | ExposureMask) extern int numplayers; extern struct player *players; extern game *gameval; #define State_Init (0) #define State_Top (1) #define State_EQueries (2) /* Queries before gestures are revealed */ #define State_Queries (3) #define State_End (4) #define Qu_SaveTranscript (-50) extern int turnstate; extern int movelist[]; extern int blinklevel;