#include "devices/audio.h" extern char *LoadSound(); extern int FreeSound(); extern struct IOAudio *StartSound(); extern int StopSound(); extern int rand(); #include "obj.h" #define COMM 20 /* Anzahl der möglichen "fighters" (number of fighters) */ #define MTEXT 300 /* Anzahl der Inschriften */ #define IMAX 70 #define ITM 200 unsigned char ox[200]; /* X-Koordinaten der bewegten Objekte */ unsigned char oy[200]; /* Y-Koordinaten der bewegten Objekte */ unsigned char oh[200]; /* Hintergrund der bewegten Objekte */ unsigned char oz[200]; /* Wann kommen die Objekte immer dran?*/ unsigned char oj[200]; /* Worüber kommen die Objekte ? */ unsigned char oa[200]; /* Zeichen für das Objekt */ unsigned char ou[200]; /* Grundzeichen =0,bei Objekten, die nicht "richten" */ unsigned int heat[200];/* Energie der einzelnen Objekte (früher mal heat) */ unsigned int aheat[200];/* Alte Energie der einzelnen Objekte */ char dx[200]; /* Richtung, in die die Objekte zeigen */ char dy[200]; /* ebenfalls, hier: Y-Richtung -1,1 */ char rx[200]; /* X-Richtung bei Rechtsdrehung */ char ry[200]; /* Y-Richtung bei Rechtsdrehung */ unsigned char nd; /* =-1 fürs Neuzeichnen */ unsigned int zeit; /* Zeit (in "Tics") */ unsigned char wlk; /* =-1, wenn wirklich ge"walkt" */ unsigned char all[256];/* Gehen über dieses Pic erlaubt? */ unsigned char oll[200];/* Nummern der Objekte */ long score=0L; /* Inzwischen: Credits (Geld) */ char *snd1; char *snd2; struct IOAudio *ia; char *texts; #define TEXTBUF 20000L unsigned char ix[MTEXT]; unsigned char iy[MTEXT]; unsigned int it[MTEXT]; char com[COMM][500]; char coname[COMM][10]; unsigned char con[COMM]; char *coa[COMM]; unsigned char cow[COMM]; int coh[COMM]; int coz[COMM]; unsigned char ak_com; char com_attack[COMM][10]; unsigned int mx_energy=100; unsigned char sst[200]; /* Shoot-Strength */ unsigned char hst[200]; /* Hit-Strength */ unsigned char ac[200]; /* Armor-Class */ #define JUMP_COM while(*(++coa[fn])!='"') struct Objekt { char *name; unsigned char interval; unsigned char oj; unsigned char oa; unsigned char ou; unsigned int heat; }; struct Objekt obb[]= { { "COBRA-MECH" ,1,10,6,6,60000 }, { "STANDARD-LASER",1,5 ,10,0,500 }, { "GRANATE" ,3,5 ,11,0,13 }, { "FIGHTER" ,13,10,18,18,9000 }, { "DRONE" ,15,10,23,0,5000 }, { "EXPLOSION" ,3,20,14,0,4 }, { "BOMBE T1" ,3,20,14,0,11 }, { "DOOR" ,1,105,67,0,2100 } }; struct Item { char name[18]; char art; unsigned int prize; int level; }; struct Item item[IMAX]; unsigned char itx[ITM]; unsigned char ity[ITM]; unsigned char itw[ITM]; unsigned char itp[9]; unsigned char itc[9]; unsigned char srwp; /* short-range weapon */ unsigned char lrwp; /* long-range weapon */ unsigned char sh; /* Shield */ int insc=0; char * com_arg(wohin,woher) char *wohin,*woher; { register char *p1,*p2; p1=wohin; p2=woher+1; while((*(p1++)=*(p2++))!='"'); *(p1-1)=0; return(p2-1); } void show_items() { int tok; int itok; int itok4; tok=-1; while(++tok<4) { itok=itp[tok]; itok4=itp[tok+4]; sprintf(jj,"%1d %-12s %c#%02d %1d %-12s %c#%02d", tok+1, item[itok].name, item[itok].art, itc[tok], tok+5, item[itok4].name, item[itok4].art, itc[tok+4]); cprint(jj); } } void get_item(nr) int nr; { int tok; tok=0; while(itp[tok]!=0 && tok<8 && itp[tok]!=itw[nr]) tok++; if(tok>=8) { cprint("Sorry, you are already carrying 8 items."); return(); } if(itp[tok]==itw[nr]) itc[tok]++; else { itp[tok]=itw[nr]; itc[tok]=1; } itw[nr]=255; switch(item[itp[tok]].art) { case 'E': mx_energy+=item[itp[tok]].level; break; } cprint("OK."); } void take_item(xi,yi) int xi,yi; { register int tl; char tost; int anyth=0; tost=0; tl=0; agaiggi: while((itw[tl]==255 || itx[tl]!=xi || ity[tl]!=yi) && tl=ITM) { if(tost==0) cprint("There is nothing."); if(anyth==0 && oh[0]==54) oh[0]=0; return(); } sprintf(jj,"You find: %s",item[itw[tl]].name); cprint(jj); cprint("Do you want to take it? (y/n)"); kwait: while(((tost=*((char *)0xbfec01))&1)!=1); if(tost==-99 || tost==-43) { get_item(tl); tl++; goto agaiggi; } if(tost==-109) { tl++; cprint("Not taken."); anyth=1; goto agaiggi; } goto kwait; } char * find_label(fn,lbl) unsigned char fn; char *lbl; { register char *sok; sok=com[fn]-1; weiter_suchen: while(*(++sok)!='_'); sok=com_arg(jj,sok+1); if(strcmp(jj,lbl)!=0) goto weiter_suchen; return(sok); } void show_heat() { SetAPen(pm.dbr[dbz],2L); RectFill(pm.dbr[dbz],114L,(long)(43+(0xFFFF-heat[0])/1000),118L,108L); SetAPen(pm.dbr[1-dbz],2L); RectFill(pm.dbr[1-dbz],114L,(long)(43+(0xFFFF-heat[0])/1000),118L,108L); SetAPen(pm.dbr[dbz],0L); RectFill(pm.dbr[dbz],114L,43L,118L,(long)(43+(0xFFFF-heat[0])/1000)); SetAPen(pm.dbr[1-dbz],0L); RectFill(pm.dbr[1-dbz],114L,43L,118L,(long)(43+(0xFFFF-heat[0])/1000)); } void Save_items(nmm) char *nmm; { int fc; if((fc=open(nmm,O_WRONLY|O_CREAT))==-1) return(); write(fc,&item[0],(int)sizeof(struct Item)*IMAX); write(fc,&itx[0],(int)sizeof(unsigned char)*ITM); write(fc,&ity[0],(int)sizeof(unsigned char)*ITM); write(fc,&itw[0],(int)sizeof(unsigned char)*ITM); close(fc); } void Load_items(nmm) char *nmm; { int fc; if((fc=open(nmm,O_RDONLY))==-1) return(); read(fc,&item[0],(int)sizeof(struct Item)*IMAX); read(fc,&itx[0],(int)sizeof(unsigned char)*ITM); read(fc,&ity[0],(int)sizeof(unsigned char)*ITM); read(fc,&itw[0],(int)sizeof(unsigned char)*ITM); close(fc); } void LadeText(name) char *name; { int fd; long lai; if((fd=open(name,O_RDONLY))==-1) { sprintf(jj,"[Couldn't open %s]",name); cprint(jj); return(); } lai=lseek(fd,0L,2); lseek(fd,0L,0); read(fd,texts,(int)lai); close(fd); sprintf(jj,"%s.l",name); if((fd=open(jj,O_RDONLY))==-1) { sprintf(jj,"[Couldn't open %s.l]",name); cprint(jj); return(); } read(fd,&ix[0],(int)(sizeof(unsigned char)*MTEXT)); read(fd,&iy[0],(int)(sizeof(unsigned char)*MTEXT)); read(fd,&it[0],(int)(sizeof(unsigned int)*MTEXT)); close(fd); } void Save_objs(nmm) char *nmm; { int fc; if((fc=open(nmm,O_WRONLY|O_CREAT))==-1) return(); write(fc,&ox[0],(int)sizeof(unsigned char)*200); write(fc,&oy[0],(int)sizeof(unsigned char)*200); write(fc,&oh[0],(int)sizeof(unsigned char)*200); write(fc,&oz[0],(int)sizeof(unsigned char)*200); write(fc,&oj[0],(int)sizeof(unsigned char)*200); write(fc,&oa[0],(int)sizeof(unsigned char)*200); write(fc,&ou[0],(int)sizeof(unsigned char)*200); write(fc,&heat[0],(int)sizeof(unsigned int)*200); write(fc,&aheat[0],(int)sizeof(unsigned int)*200); write(fc,&oll[0],(int)sizeof(unsigned char)*200); write(fc,&dx[0],(int)sizeof(char)*200); write(fc,&dy[0],(int)sizeof(char)*200); write(fc,&rx[0],(int)sizeof(char)*200); write(fc,&ry[0],(int)sizeof(char)*200); write(fc,&sst[0],(int)sizeof(unsigned char)*200); write(fc,&hst[0],(int)sizeof(unsigned char)*200); write(fc,&ac[0],(int)sizeof(unsigned char)*200); close(fc); } void Load_objs(nmm) char *nmm; { int fc; if((fc=open(nmm,O_RDONLY))==-1) return(); read(fc,&ox[0],(int)sizeof(unsigned char)*200); read(fc,&oy[0],(int)sizeof(unsigned char)*200); read(fc,&oh[0],(int)sizeof(unsigned char)*200); read(fc,&oz[0],(int)sizeof(unsigned char)*200); read(fc,&oj[0],(int)sizeof(unsigned char)*200); read(fc,&oa[0],(int)sizeof(unsigned char)*200); read(fc,&ou[0],(int)sizeof(unsigned char)*200); read(fc,&heat[0],(int)sizeof(unsigned int)*200); read(fc,&aheat[0],(int)sizeof(unsigned int)*200); read(fc,&oll[0],(int)sizeof(unsigned char)*200); read(fc,&dx[0],(int)sizeof(char)*200); read(fc,&dy[0],(int)sizeof(char)*200); read(fc,&rx[0],(int)sizeof(char)*200); read(fc,&ry[0],(int)sizeof(char)*200); read(fc,&sst[0],(int)sizeof(unsigned char)*200); read(fc,&hst[0],(int)sizeof(unsigned char)*200); read(fc,&ac[0],(int)sizeof(unsigned char)*200); close(fc); } void LadeAlles(nmm) char *nmm; { char kkl[30]; sprintf(kkl,"%s.pm",nmm); LoadPlay(kkl); sprintf(kkl,"%s.it",nmm); Load_items(kkl); sprintf(kkl,"%s.texts",nmm); LadeText(kkl); sprintf(kkl,"%s.objs",nmm); Load_objs(kkl); } void addscore(addy) int addy; { score+=(long)addy; sprintf(jj,"%06ld",score); SetAPen(pm.dbr[dbz],2L); SetBPen(pm.dbr[dbz],0L); SetAPen(pm.dbr[1-dbz],2L); SetBPen(pm.dbr[1-dbz],0L); Move(pm.dbr[dbz],47L,62L); Text(pm.dbr[dbz],jj,(long)strlen(jj)); Move(pm.dbr[1-dbz],47L,62L); Text(pm.dbr[1-dbz],jj,(long)strlen(jj)); } void death() { cprint("You are really lucky - As this is only version 0.5 of MF, you can't die... Normally, your mech would have been blown to pieces just now."); heat[0]=60000L; show_heat(); } void explosion(nr) register unsigned char nr; { pic(ox[nr],oy[nr],(unsigned char)14); oa[nr]=14; oll[nr]=5; heat[nr]=obb[5].heat; oz[nr]=obb[5].interval; StopSound(ia); ia=StartSound(snd2,64,15000,1); } unsigned char walk(nx,ny,nr) register unsigned char nx,ny; register unsigned char nr; { register unsigned char haha; wlk=0; haha=(*(pm.playbeg+ny*pm.b+nx))&127; if(all[haha]>oj[nr]) return(haha); pic(ox[nr],oy[nr],oh[nr]); if(ou[nr]!=0) { switch((int)(nx-ox[nr])) { case 1: oa[nr]=ou[nr]; dx[nr]=1; dy[nr]=0; break; case -1: oa[nr]=ou[nr]+2; dx[nr]=-1; dy[nr]=0; break; case 0: oa[nr]= (nyanf) cprint(anf); return(); } if(pos>anf) { *pos=0; cprint(anf); } *(pos++)='&'; anf=pos+1; switch(*pos) { case 'T': /* Teleport: "&T23/45&dnjcndv&Pgold.iff&You see...&W&&p& */ { int tx,ty; while(*(++pos)!='/'); *pos=0; tx=atoi(anf); *pos='/'; anf=pos+1; while(*(++pos)!='&'); *pos=0; ty=atoi(anf); *pos='&'; walk(tx,ty,0); nd=-1; } break; case 'P': { struct BitMap bbit; while(*(++pos)!='&'); *pos=0; strcpy(jj,anf); *pos='&'; openbit(&bbit,96,90,5); read_iff(jj,&bbit,0L,0L); SetAPen(pm.dbr[1-dbz],0L); RectFill(pm.dbr[1-dbz],131L,18L,233L,109L); BltBitMap(&bbit,0L,0L,pm.sb[1-dbz],134L,18L,96L,90L,0xC0L,0xFFL,0L); WaitBlit(); closebit(&bbit); } break; case 'p': pos++; SetAPen(pm.dbr[1-dbz],0L); RectFill(pm.dbr[1-dbz],131L,18L,233L,109L); gn=1; ShowPlay(ox[0]-5,oy[0]-4); turn(); break; case 'W': pos++; while(!LMB_DRUCK); break; case 'Q': /* Question: "&Qbanana&Yes, that was the password.&E&&q&That was wrong!" */ { char inni[50]; while(*(++pos)!='&'); *pos=0; strcpy(jj,anf); *pos='&'; Inline(inni); if(strcmp(jj,inni)!=0) { pos++; while(*pos!='&' || *(pos+1)!='q') pos++; pos=pos+2; } } break; case 'E': return(); break; case 'D': { int del; while(*(++pos)!='&'); *pos=0; del=atoi(anf); *pos='&'; Delay((long)del); } break; case 'S': /* Set "&S23/77=109&" */ { unsigned char wx,wy,wd; while(*(++pos)!='/'); *pos=0; wx=(unsigned char)atoi(anf); *pos='/'; anf=pos+1; while(*(++pos)!='='); *pos=0; wy=(unsigned char)atoi(anf); *pos='='; anf=pos+1; while(*(++pos)!='&'); *pos=0; wd=(unsigned char)atoi(anf); *pos='&'; pic(wx,wy,wd); } break; default: while(*(++pos)!='&'); } anf=pos+1; goto msloop; } unsigned int hvorher; int sub(x,y,wieviel) register unsigned char x,y; unsigned int wieviel; { register unsigned char simoka,nm; if((*(pm.playbeg+y*pm.b+x))&127==0) return(-1); simoka=0; while(simoka<200 && (oa[simoka]==0 || ox[simoka]!=x || oy[simoka]!=y)) simoka++; if(simoka>=200) { if((*(pm.playbeg+y*pm.b+x)&127)==27) { *(pm.playbeg+y*pm.b+x)&=128; add(x,y,x,y,6); StopSound(ia); ia=StartSound(snd2,50,17000,1); } return(-1); } nm=oll[simoka]; if(nm==1 || nm==2 || (nm>=5 && nm<=7)) return(-1); wieviel=((rand()/1000)*wieviel*ac[simoka])/3500; hvorher=heat[simoka]; heat[simoka]-=wieviel; if(nm==0) { sprintf(jj,"You have been hit for %d damage points.",wieviel); cprint(jj); show_heat(); } if(heat[simoka]>hvorher) { oa[simoka]=0; /* ______EXPLOSION !!!!!!!! */ switch(nm) { case 0: death(); break; case 3: addscore(100); explosion(simoka); nm=-1; while(con[++nm]!=simoka); coa[nm]=0L; cprint("Hostile FIGHTER exploded."); break; case 4: addscore(50); explosion(simoka); cprint("Hostile DRONE exploded."); break; case 8: addscore(150); explosion(simoka); cprint("Hostile fighter exploded."); break; } return(-2); } return(wieviel); } void lade_com(xc,yc) unsigned char xc,yc; { char com_name[50]; int fc; long lai; sprintf(com_name,"%d-%d.com",(int)xc,(int)yc); if((fc=open(com_name,O_RDONLY))==-1) return(); lai=lseek(fc,0L,2); lseek(fc,0L,0); read(fc,com[ak_com],(int)lai); close(fc); fc=0; while(ox[fc]!=xc || oy[fc]!=yc) fc++; con[ak_com]=fc; coa[ak_com]=com[ak_com]; cow[ak_com]=0; ak_com++; /* Nummer des entsprechenden Fighters suchen und eintragen */ } void Game() { register int si; register unsigned char xx,yy; register unsigned char zz; unsigned char weapon=1; int tafel=0; int fnumber=0; char *mesg=0L; ak_com=0; cw.rp=pm.dbr[1-dbz]; cprint("This program was created with the PlayMap-Routines by Florian Marquardt."); hst[0]=10; ac[0]=200; sst[0]=10; srwp=8; lrwp=8; sh=8; si=-1; while(++si<256) all[si]=100; si=-1; while(++si<9) itp[si]=0; /* ___Jetzt muß alles, worüber man gehen kann auf <10 gesetzt werden. */ all[0]=1; all[4]=2; all[12]=3; all[13]=4; all[24]=1; all[26]=6; all[32]=1; all[33]=1; all[34]=1; all[35]=1; all[48]=1; all[49]=1; all[50]=1; all[51]=1; all[100]=1; all[54]=1; all[55]=1; all[56]=7; all[44]=1; all[45]=1; all[46]=1; all[47]=1; /* ___Bewegliche Objekte aufsuchen */ xx=0; oa[0]=2; while(++xx<200) { yy=0; while(++yy<100) { switch((*(pm.playbeg+yy*pm.b+xx))&127) { case 6: printf("MECH-COBRA bei %d,%d!\n",xx,yy); (*(pm.playbeg+yy*pm.b+xx))&=128; oa[0]=0; add(xx-1,yy,xx,yy,0); break; } } } nd=-1; #asm move.b #0,$bfea01 move.b #0,$bfe901 move.b #0,$bfe801 #endasm blopp: #asm move.l d0,-(a7) _nochnicht: clr.l d0 move.b $bfea01,d0 lsl.l #8,d0 lsl.l #8,d0 move.b $bfe901,d0 lsl.l #8,d0 move.b $bfe801,d0 cmp.w #3,d0 bls _nochnicht move.b #0,$bfea01 move.b #0,$bfe901 move.b #0,$bfe801 move.l (a7)+,d0 #endasm if(nd) { ShowPlay(ox[0]-5,oy[0]-4); turn(); nd=0; } zeit++; if(zeit%1000==0 && heat[0]<65000) { heat[0]++; show_heat(); } if(mesg!=0L) { message(mesg); mesg=0L; } si=-1; while(++si<200) { if(oa[si]!=0 && zeit%oz[si]==0) { switch(oll[si]) { case 0: break; case 1: zz=walk(ox[si]+dx[si],oy[si]+dy[si],si); if(wlk==0) { oa[si]=0; pic(ox[si],oy[si],oh[si]); if(zz>=6 && zz<=9) sub(ox[si]+dx[si],oy[si]+dy[si],heat[si]); if(zz==23) sub(ox[si]+dx[si],oy[si]+dy[si],heat[si]); if(zz>=18 && zz<=21) sub(ox[si]+dx[si],oy[si]+dy[si],heat[si]); if(zz==27) sub(ox[si]+dx[si],oy[si]+dy[si],heat[si]); nd=-1; } break; case 2: heat[si]--; nd=-1; if(heat[si]>=10) { zz=walk(ox[si]+dx[si],oy[si]+dy[si],si); break; } if(heat[si]==0) { pic(ox[si],oy[si],13); oa[si]=0; break; } xx=(unsigned char)(ox[si]-rand()%5+2); yy=(unsigned char)(oy[si]-rand()%5+2); sub(xx,yy,3000); if((*(pm.playbeg+yy*pm.b+xx))&127==0) pic(xx,yy,12); pic(ox[si],oy[si],(unsigned char)(zeit%2+14)); break; case 4: dx[si]=((unsigned char)rand()%3)-1; dy[si]=((unsigned char)rand()%3)-1; zz=walk(ox[si]+dx[si], oy[si]+dy[si],si); if(wlk==0) if(dx[si]!=0 || dy[si]!=0) sub(ox[si]+dx[si],oy[si]+dy[si],10000); break; case 5: heat[si]--; nd=-1; if(heat[si]>0) pic(ox[si],oy[si],(unsigned char)(zeit%2+14)); else { pic(ox[si],oy[si],(unsigned char)13); oa[si]=0; } break; case 6: heat[si]--; nd=-1; if(heat[si]==9) { sub(ox[si]-1,oy[si],10000); pic(ox[si]-1,oy[si],14); sub(ox[si]+1,oy[si],10000); pic(ox[si]+1,oy[si],14); sub(ox[si],oy[si]+1,10000); pic(ox[si],oy[si]+1,14); sub(ox[si],oy[si]-1,10000); pic(ox[si],oy[si]-1,14); break; } if(heat[si]<=7) { pic(ox[si]-1,oy[si],0); pic(ox[si]+1,oy[si],0); pic(ox[si],oy[si]+1,0); pic(ox[si],oy[si]-1,0); pic(ox[si],oy[si],0); oa[si]=0; break; } break; case 7: heat[si]--; if(heat[si]>2049 && heat[si]<2089) break; if(heat[si]>=2090) { nd=-1; pic(ox[si],oy[si],(unsigned char)(heat[si]-2033)); break; } if(heat[si]==2089) { nd=-1; pic(ox[si],oy[si],0); break; } if(heat[si]==2049) if((*(pm.playbeg+ox[si]+oy[si]*pm.b))&127!=0) { heat[si]++; break; } else { StopSound(ia); ia=StartSound(snd2,15,20000,1); } if(heat[si]>=2039) { nd=-1; pic(ox[si],oy[si],(unsigned char)(2106-heat[si])); break; } oa[si]=0; break; case 8: if((ox[0]==ox[si] || oy[0]==oy[si]) && zeit%5==0) { if(ox[si]==ox[0]) { if(oy[si]>oy[0] && oy[si]-oy[0]<5) { obb[1].heat=(unsigned int)sst[si]*5; add(ox[si],oy[si],ox[si],oy[si]-1,(unsigned char)1); if(wlk==0) sub(ox[si],oy[si]-1,(unsigned int)hst[si]*5); break; } if(oy[si]ox[0] && ox[si]-ox[0]<5) { obb[1].heat=(unsigned int)sst[si]*5; add(ox[si],oy[si],ox[si]-1,oy[si],(unsigned char)1); if(wlk==0) sub(ox[si]-1,oy[si],(unsigned int)hst[si]*5); break; } if(ox[si]ox[si]) { walk(ox[si]+1,oy[si],si); if(wlk!=0) break; } if(oy[0]oy[si]) walk(ox[si],oy[si]+1,si); break; } } } /* Steuerung der "Fighter": */ /* fnumber++; if(fnumber>=ak_com) fnumber=0; if(coa[fnumber]!=0L) { register unsigned char fn; register unsigned char conni; fn=(unsigned char)fnumber; conni=con[fn]; nochmal_com: if(heat[conni]': dx[conni]=rx[conni]; dy[conni]=ry[conni]; rx[conni]=(dx[conni]*dx[conni]-1)*dy[conni]; ry[conni]=-(dy[conni]*dy[conni]-1)*dx[conni]; oa[conni]=ou[conni]-dx[conni]+1+(dy[conni]+1)*dy[conni]; pic(ox[conni],oy[conni],oa[conni]); nd=-1; break; case '-': walk(ox[conni]+dx[conni],oy[conni]+dy[conni],conni); if(wlk==0) cow[fn]|=4; else BITCLEAR(cow[fn],4); break; case 'y': si=0; coa[fn]=com_arg(jj,coa[fn]+1); while(++si<=20 && all[(*(pm.playbeg+ox[conni]+dx[conni]*si+(oy[conni]+dy[conni]*si)*pm.b))&127]<=10); if(ox[0]==ox[conni]+dx[conni]*si && oy[0]==oy[conni]+dy[conni]+si) coa[fn]=find_label(fn,jj); break; case 'l': add( ox[conni], oy[conni], ox[conni]+dx[conni], oy[conni]+dy[conni], (unsigned char)1); break; case 'a': add( ox[conni], oy[conni], ox[conni]+dx[conni], oy[conni]+dy[conni], (unsigned char)6); break; case 'C': coa[fn]=com_arg(jj,coa[fn]+1); coh[fn]=atoi(jj); coz[fn]=0; break; case 'R': if((cow[fn]&8)!=8 && all[(*(pm.playbeg+ox[conni]+rx[conni]+(oy[conni]+ry[conni])*pm.b))&127]<=10) { dx[conni]=rx[conni]; dy[conni]=ry[conni]; rx[conni]=(dx[conni]*dx[conni]-1)*dy[conni]; ry[conni]=-(dy[conni]*dy[conni]-1)*dx[conni]; oa[conni]=ou[conni]-dx[conni]+1+(dy[conni]+1)*dy[conni]; pic(ox[conni],oy[conni],oa[conni]); nd=-1; BITSET(cow[fn],8); } else { BITCLEAR(cow[fn],8); walk(ox[conni]+dx[conni],oy[conni]+dy[conni],conni); if(wlk==0) { dx[conni]=-rx[conni]; dy[conni]=-ry[conni]; rx[conni]=(dx[conni]*dx[conni]-1)*dy[conni]; ry[conni]=-(dy[conni]*dy[conni]-1)*dx[conni]; oa[conni]=ou[conni]-dx[conni]+1+(dy[conni]+1)*dy[conni]; pic(ox[conni],oy[conni],oa[conni]); nd=-1; BITSET(cow[fn],8); } else BITCLEAR(cow[fn],4); } break; case 'L': if((cow[fn]&8)!=8 && all[(*(pm.playbeg+ox[conni]-rx[conni]+(oy[conni]-ry[conni])*pm.b))&127]<=10) { dx[conni]=-rx[conni]; dy[conni]=-ry[conni]; rx[conni]=(dx[conni]*dx[conni]-1)*dy[conni]; ry[conni]=-(dy[conni]*dy[conni]-1)*dx[conni]; oa[conni]=ou[conni]-dx[conni]+1+(dy[conni]+1)*dy[conni]; pic(ox[conni],oy[conni],oa[conni]); nd=-1; BITSET(cow[fn],8); } else { BITCLEAR(cow[fn],8); walk(ox[conni]+dx[conni],oy[conni]+dy[conni],conni); if(wlk==0) { dx[conni]=rx[conni]; dy[conni]=ry[conni]; rx[conni]=(dx[conni]*dx[conni]-1)*dy[conni]; ry[conni]=-(dy[conni]*dy[conni]-1)*dx[conni]; oa[conni]=ou[conni]-dx[conni]+1+(dy[conni]+1)*dy[conni]; pic(ox[conni],oy[conni],oa[conni]); nd=-1; BITSET(cow[fn],8); } else BITCLEAR(cow[fn],4); } break; } coa[fn]++; } */ /* Ende der Steuerung der "Fighter" */ if(RMB_DRUCK) { int choice; choice=menu(pm.dbs[1-dbz],pm.dbr[1-dbz],(int)pm.dbs[1-dbz]->MouseX, (int)pm.dbs[1-dbz]->MouseY,10,4,"Menu:|Actions|Game|Cancel||"); switch(choice) { case 2: choice=menu(pm.dbs[1-dbz],pm.dbr[1-dbz],(int)pm.dbs[1-dbz]->MouseX, (int)pm.dbs[1-dbz]->MouseY,10,5,"Game:|Quit|Debug|Coords|Cancel||"); switch(choice) { case 1: return(); case 2: { cprint("Nr. of object to debug ?"); Inline(jj); choice=atoi(jj); sprintf(jj,"%d: ID:%d x:%d y:%d h:%d dx:%d dy:%d oa:%d ou:%d sst:%d hst:%d ac:%d", choice,(int)oll[choice],(int)ox[choice],(int)oy[choice],(int)heat[choice],(int)dx[choice],(int)dy[choice], (int)oa[choice],(int)ou[choice],(int)sst[choice],(int)hst[choice],(int)ac[choice]); cprint(jj); } break; case 3: sprintf(jj,"Current location: X:%d Y:%d",ox[0],oy[0]); cprint(jj); break; } break; case 1: choice=menu(pm.dbs[1-dbz],pm.dbr[1-dbz],(int)pm.dbs[1-dbz]->MouseX, (int)pm.dbs[1-dbz]->MouseY,10,8,"Actions:|Inventory|Take|Drop|SRWeapon|LRWeapon|Shield|Cancel||"); switch(choice) { case 1: show_items(); break; case 2: take_item(ox[0],oy[0]); break; case 3: show_items(); cprint("Which item do you want to drop?"); while(!LMB_DRUCK); choice=(pm.dbs[1-dbz]->MouseX/160)*4+ (pm.dbs[1-dbz]->MouseY-cw.yo)/cw.rp->TxHeight-cw.zh+5; if(choice<0 || choice>7 || itp[choice]=='.') cprint("Nothing dropped."); else { register int such; if(srwp==choice) hst[0]-=item[itp[choice]].level; if(lrwp==choice) sst[0]-=item[itp[choice]].level; if(sh==choice) ac[0]+=item[itp[choice]].level; such=-1; while(itw[++such]!=255); itw[such]=itp[choice]; itx[such]=ox[0]; ity[such]=oy[0]; sprintf(jj,"%s dropped.",item[itp[choice]].name); cprint(jj); if((--itc[choice])<=0) itp[choice]=0; if(oh[0]==0) oh[0]=54; } break; case 4: show_items(); cprint("Select short-range weapon."); while(!LMB_DRUCK); choice=(pm.dbs[1-dbz]->MouseX/160)*4+ (pm.dbs[1-dbz]->MouseY-cw.yo)/cw.rp->TxHeight-cw.zh+6; if(choice<1 || choice>8 || item[itp[choice-1]].art!='R') cprint("Nothing selected."); else { choice--; if(srwp!=8) hst[0]=hst[0]-item[itp[srwp]].level+item[itp[choice]].level; else hst[0]+=item[itp[choice]].level; srwp=(unsigned char)choice; sprintf(jj,"OK. '%s' selected as short-range weapon.",item[itp[srwp]].name); cprint(jj); } break; case 5: show_items(); cprint("Select long-range weapon."); while(!LMB_DRUCK); choice=(pm.dbs[1-dbz]->MouseX/160)*4+ (pm.dbs[1-dbz]->MouseY-cw.yo)/cw.rp->TxHeight-cw.zh+6; if(choice<1 || choice>8 || item[itp[choice-1]].art>'L' || item[itp[choice]].art<'F') cprint("Nothing selected."); else { choice--; if(lrwp!=8) hst[0]=hst[0]-item[itp[lrwp]].level+item[itp[choice]].level; else hst[0]+=item[itp[choice]].level; lrwp=(unsigned char)choice; sprintf(jj,"OK. '%s' selected as long-range weapon.",item[itp[lrwp]].name); cprint(jj); } break; case 6: show_items(); cprint("Select shield."); while(!LMB_DRUCK); choice=(pm.dbs[1-dbz]->MouseX/160)*4+ (pm.dbs[1-dbz]->MouseY-cw.yo)/cw.rp->TxHeight-cw.zh+6; if(choice<1 || choice>8 || item[itp[choice-1]].art!='S') cprint("Nothing selected."); else { choice--; if(sh!=8) ac[0]=ac[0]+item[itp[sh]].level-item[itp[choice]].level; else ac[0]-=item[itp[choice]].level; sh=(unsigned char)choice; sprintf(jj,"OK. '%s' selected as shield.",item[itp[sh]].name); cprint(jj); } break; } break; } } if(!LMB_DRUCK && (*taste)&1!=1) goto blopp; /* >>> Jetzt folgt die Reaktion auf das Klicken der Maus: */ { int x,y,dxx,dyy; dxx=0; dyy=0; if(!LMB_DRUCK) { switch((char)*taste) { case 53: obb[1].heat=(unsigned int)sst[0]*5; add(ox[0],oy[0],ox[0]+dx[0],oy[0]+dy[0],weapon); if(wlk==0) { x=sub(ox[0]+dx[0],oy[0]+dy[0],(unsigned int)hst[0]*5); StopSound(ia); ia=StartSound(snd1,40,4000,1); if(x==0) cprint("You miss."); else { if(x>0) { sprintf(jj,"You hit for %d damage points.",x); cprint(jj); } } } else { StopSound(ia); ia=StartSound(snd1,64,6000,1); } goto blopp; case 103: dyy=-1; goto go_; case 97: dxx=-1; goto go_; case 99: dxx=1; goto go_; case 101: dyy=1; goto go_; case -47: show_items(); goto blopp; case -41: take_item(ox[0],oy[0]); goto blopp; } goto blopp; } x=(int)pm.dbs[1-dbz]->MouseX; y=(int)pm.dbs[1-dbz]->MouseY; if(x>253 && x<273 && y>18 && y<36) /* Richtungspfeil */ { dyy=-1; goto go_; } if(x>273 && x<289 && y>36 && y<56) /* Richtungspfeil */ { dxx=1; goto go_; } if(x>253 && x<273 && y>58 && y<76) /* Richtungspfeil */ { dyy=1; goto go_; } if(x>236 && x<256 && y>38 && y<56) /* Richtungspfeil */ { dxx=-1; goto go_; } if(x>258 && x<267 && y>38 && y<56) { obb[1].heat=(unsigned int)sst[0]*5; add(ox[0],oy[0],ox[0]+dx[0],oy[0]+dy[0],weapon); if(wlk==0) { x=sub(ox[0]+dx[0],oy[0]+dy[0],(unsigned int)hst[0]*5); StopSound(ia); ia=StartSound(snd1,40,4000,1); if(x==0) cprint("You miss."); else { if(x>0) { sprintf(jj,"You hit for %d damage points.",x); cprint(jj); } } } else { StopSound(ia); ia=StartSound(snd1,64,6000,1); } goto blopp; } if(x>238 && x<258 && y>92 && y<110) { /* _____Weapon-Auswahl */ if(weapon==1) { weapon=2; cprint("GRANATE activated."); goto blopp; } if(weapon==2) { weapon=1; cprint("STANDARD-LASER activated."); goto blopp; } goto blopp; } if(x>260 && x<280 && y>92 && y<110) { /* Computer-Befehlseingabe: ____weitere Befehle dazu! */ cprint("Neuro-II active - COMMAND?"); Inline(jj); if(strcmp(jj,"ende")==0) return(); if(strcmp(jj,"dbg")==0) { cprint("Which number?"); Inline(jj); x=atoi(jj); sprintf(jj,"%d: Z:%d I:%d O:%d H:%d",x,(int)oa[x],(int)oz[x],(int)oll[x], (int)oh[x]); cprint(jj); sprintf(jj,"NAME: %s",obb[oll[x]].name); cprint(jj); goto blopp; } goto blopp; } if(x>282 && x<302 && y>92 && y<110) { cprint("STATUS:"); sprintf(jj,"ENERGY:%ld SST:%d HST:%d AC:%d CREDITS:%ld",(long)heat[0],(int)sst[0], (int)hst[0],(int)ac[0],(long)score); cprint(jj); sprintf(jj,"SRWP: %s",item[itp[srwp]].name); cprint(jj); sprintf(jj,"LRWP: %s",item[itp[lrwp]].name); cprint(jj); sprintf(jj,"SHLD: %s",item[itp[sh]].name); cprint(jj); goto blopp; } go_: if(zeit%oz[0]==0) { zz=walk(ox[0]+dxx,oy[0]+dyy,0); if(wlk!=0) { switch(zz) { case 24: { register int tafo; tafo=0; while(it[tafo]!=30000) { if(ix[tafo]==ox[0] && iy[tafo]==oy[0]) { mesg=&texts[it[tafo]]; break; } tafo++; } } break; case 26: { cprint("You collect a piece of iridium."); oh[0]=0; addscore(20); } break; case 44: if(dy[0]==-1) { register int tafo; tafo=0; while(it[tafo]!=30000) { if(ix[tafo]==ox[0] && iy[tafo]==oy[0]) { mesg=&texts[it[tafo]]; break; } tafo++; } } break; case 45: if(dy[0]==1) { register int tafo; tafo=0; while(it[tafo]!=30000) { if(ix[tafo]==ox[0] && iy[tafo]==oy[0]) { mesg=&texts[it[tafo]]; break; } tafo++; } } break; case 46: if(dx[0]==1) { register int tafo; tafo=0; while(it[tafo]!=30000) { if(ix[tafo]==ox[0] && iy[tafo]==oy[0]) { mesg=&texts[it[tafo]]; break; } tafo++; } } break; case 47: if(dx[0]==-1) { register int tafo; tafo=0; while(it[tafo]!=30000) { if(ix[tafo]==ox[0] && iy[tafo]==oy[0]) { mesg=&texts[it[tafo]]; break; } tafo++; } } break; default: insc=0; } } else { dx[0]=dxx; dy[0]=dyy; rx[0]=(dx[0]*dx[0]-1)*dy[0]; ry[0]=-(dy[0]*dy[0]-1)*dx[0]; oa[0]=ou[0]-dx[0]+1+(dy[0]+1)*dy[0]; pic(ox[0],oy[0],oa[0]); nd=-1; switch(zz) { case 5: if(heat[0]<60000) { heat[0]+=5000; show_heat(); cprint("Heat sinks as you walk in the cool water."); } break; case 25: { register int tafo; tafo=0; if(insc==0) { while(tafo=tafel) cprint("You feel that once there must have been an inscription right here!"); insc=1; } else insc=1; } break; case 28: if((*(pm.playbeg+ox[0]+(dxx*2)+(oy[0]+(dyy*2))*pm.b))&127==0) { pic(ox[0]+dxx*2,oy[0]+dyy*2,28); pic(ox[0]+dxx,oy[0]+dyy,0); walk(ox[0]+dxx,oy[0]+dyy,0); } else { if((*(pm.playbeg+ox[0]+(dxx*2)+(oy[0]+(dyy*2))*pm.b))&127==29) { pic(ox[0]+dxx*2,oy[0]+dyy*2,30); pic(ox[0]+dxx,oy[0]+dyy,0); walk(ox[0]+dxx,oy[0]+dyy,0); addscore(200); cprint("BONK - you have pushed the crate into the hole."); } } break; case 38: { int x11,y11,x22,y22; register int xxx,yyy; int ccount=0; cprint("A robot voice declares: 'Just checking if you have really delivered all the crates...'"); xxx=ox[0]+dxx; yyy=oy[0]+dyy; while((*(pm.playbeg+xxx+yyy*pm.b))&127!=31) xxx++; x22=xxx; y22=yyy; yyy--; while((*(pm.playbeg+xxx+yyy*pm.b))&127!=31) yyy--; y11=yyy; xxx--; while((*(pm.playbeg+xxx+yyy*pm.b))&127!=31) xxx--; x11=xxx; for(xxx=x11;xxx<=x22;xxx++) for(yyy=y11;yyy<=y22;yyy++) { if((*(pm.playbeg+xxx+yyy*pm.b))&127==29) ccount++; } if(ccount==0) { cprint("'Congratulations. Your way to the next level won't be blocked any more...'"); pic(ox[0]+dxx,oy[0]+dyy,0); cprint("With a flash of lightning, the 'checkport' vanishes and leaves +5000 credits behind."); addscore(5000); } else { sprintf(jj,"'Sorry, there are still %d holes left.'",ccount); cprint(jj); } } break; case 67: cprint("The laser-door opens..."); add(ox[0],oy[0],ox[0]+dx[0],oy[0]+dy[0],7); StopSound(ia); ia=StartSound(snd2,30,20000,1); break; } } } } goto blopp; } main(argc,argv) int argc; char *argv[]; { int fd; InitFuncs(); palette(0,0,0,0,0); /* palette(0,1,0,0,0); */ palette(0,2,0,0,0); palette(0,3,0,0,0); scropen(2," ",4,320,200,6); ScreenToFront(scr[0]); readiff("presents.ham",2); ScreenToFront(scr[2]); Delay(250L); ScreenToFront(scr[0]); readiff("sunset.ham",2); ScreenToFront(scr[2]); Delay(300L); /* Hier käme auch noch der andere Titel */ scrclose(2); InitPlay("MF.iff","FPM.iff",10,200,100,160,160); loadfont(2,"flow.font",8); SetFont(pm.dbr[1-dbz],ff[2]); SetFont(pm.dbr[dbz],ff[2]); cw.rp=pm.dbr[1-dbz]; cprint(" >>> MechFight "); cprint("1990 by Florian Marquardt"); cprint(" Jagdschloss Hirschbrunn"); cprint(" 8861 Dornstadt-Auhausen D"); cprint(" "); snd1=LoadSound("laser.snd"); snd2=LoadSound("expl.snd"); ia=StartSound(snd1,0,6000,1); texts=gme(TEXTBUF,(long)MEMF_CLEAR); LadeAlles("MF"); Game(); fme(texts,TEXTBUF); StopSound(ia); FreeSound(snd1); FreeSound(snd2); ClosePlay(); palette(0,0,5,5,5); palette(0,1,15,15,15); palette(0,2,0,0,0); palette(0,3,10,0,0); CloseFuncs(); }