int msg_drop (int n, int msg, int z) { int sh=kindtable[obj_drop]*256; int c; objtype *pobj; pobj=&(objs[n]); switch (msg) { case msg_update: if (pobj->state==0) { if (++pobj->counter>=60) { pobj->counter=0; addobj (obj_drop,pobj->x,pobj->y+2,0,2); objs[numobjs-1].state=1; }; } else { if (!justmove(n,pobj->x,pobj->y+pobj->yd+2)) { c=((pobj->y+pobj->yd+2)&0xfff0)+16-pobj->yl; if ((c==pobj->y)||(!justmove(n,pobj->x,c))) { addobj (obj_splash,pobj->x-11,pobj->y+2,0,0); killobj (n); }; }; if ((pobj->yd+=2)>12) pobj->yd=12; }; return (1); case msg_draw: if (pobj->state==0) { drawshape (&gamevp,sh+12+pobj->counter/20,pobj->x,pobj->y); } else drawshape (&gamevp,sh+11,pobj->x,pobj->y); break; case msg_touch: if (z==0) hitplayer (n,0); }; return (0); };
int msg_splash (int n, int msg, int z) { int sh=kindtable[obj_splash]*256+15; objtype *pobj; pobj=&(objs[n]); switch (msg) { case msg_update: if (++pobj->counter>=28) killobj (n); break; case msg_draw: drawshape (&gamevp,sh+pobj->counter/2,pobj->x,pobj->y); break; case msg_touch: if (z==0) hitplayer (n,0); }; return (0); };
/* * mmove(x,y,xd,yd) Function to actually perform the monster movement * int x,y,xd,yd; * * Enter with the from coordinates in (x,y) and the destination coordinates * in (xd,yd). */ static void mmove(int aa, int bb, int cc, int dd) { int tmp,i,flag; char *who = ""; char *p = ""; flag=0; /* set to 1 if monster hit by arrow trap */ if ((cc==playerx) && (dd==playery)) { hitplayer(aa,bb); return; } i=item[cc][dd]; if ((i==OPIT) || (i==OTRAPDOOR)) switch(mitem[aa][bb]) { case BAT: case EYE: case SPIRITNAGA: case PLATINUMDRAGON: case WRAITH: case VAMPIRE: case SILVERDRAGON: case POLTERGEIST: case DEMONLORD: case DEMONLORD+1: case DEMONLORD+2: case DEMONLORD+3: case DEMONLORD+4: case DEMONLORD+5: case DEMONLORD+6: case DEMONPRINCE: break; default: mitem[aa][bb]=0; /* fell in a pit or trapdoor */ }; tmp = mitem[aa][bb]; mitem[cc][dd] = tmp; if (i==OANNIHILATION) { if (tmp>=DEMONLORD+3) /* demons dispel spheres */ { cursors(); lprintf("\nThe %s dispels the sphere!",monster[tmp].name); rmsphere(cc,dd); /* delete the sphere */ } else mitem[cc][dd]=i=tmp=0; } stealth[cc][dd]=1; if ((hitp[cc][dd] = hitp[aa][bb]) < 0) hitp[cc][dd]=1; mitem[aa][bb] = 0; if (tmp == LEPRECHAUN) switch(i) { case OGOLDPILE: case OMAXGOLD: case OKGOLD: case ODGOLD: case ODIAMOND: case ORUBY: case OEMERALD: case OSAPPHIRE: item[cc][dd] = 0; /* leprechaun takes gold */ }; if (tmp == TROLL) /* if a troll regenerate him */ if ((gtime & 1) == 0) if (monster[tmp].hitpoints > hitp[cc][dd]) hitp[cc][dd]++; if (i==OTRAPARROW) /* arrow hits monster */ { who = "An arrow"; if ((hitp[cc][dd] -= rnd(10)+level) <= 0) { mitem[cc][dd]=0; flag=2; } else flag=1; } if (i==ODARTRAP) /* dart hits monster */ { who = "A dart"; if ((hitp[cc][dd] -= rnd(6)) <= 0) { mitem[cc][dd]=0; flag=2; } else flag=1; } if (i==OTELEPORTER) /* monster hits teleport trap */ { flag=3; fillmonst(mitem[cc][dd]); mitem[cc][dd]=0; } if (cdesc[BLINDCOUNT]) return; /* if blind don't show where monsters are */ if (know[cc][dd] & HAVESEEN) { p=0; if (flag) cursors(); switch(flag) { case 1: p="\n%s hits the %s"; break; case 2: p="\n%s hits and kills the %s"; break; case 3: p="\nThe %s%s gets teleported"; who=""; break; }; if (p) { lprintf(p,who,monster[tmp].name); } } /* if (yrepcount>1) { know[aa][bb] &= 2; know[cc][dd] &= 2; return; } */ if (know[aa][bb] & HAVESEEN) show1cell(aa,bb); if (know[cc][dd] & HAVESEEN) show1cell(cc,dd); }