Annotation of src/whbuild.c, revision 1.1.1.1

1.1       root        1: #include "build.h"
                      2: #include "names.h"
                      3: #include "stdio.h"
                      4: 
                      5: extern long zmode, kensplayerheight;
                      6: 
                      7: #define AVERAGEFRAMES   16
                      8: 
                      9: static long frameval[AVERAGEFRAMES], framecnt = 0;
                     10: 
                     11: 
                     12: extern
                     13: long posx,
                     14:          posy,
                     15:          posz,
                     16:          horiz,
                     17:          qsetmode;
                     18: 
                     19: extern
                     20: short ang,
                     21:          cursectnum;
                     22: 
                     23: extern
                     24: short ceilingheinum,
                     25:          floorheinum;
                     26: 
                     27: extern
                     28: char names[MAXTILES][17];
                     29: 
                     30: extern
                     31: short searchsector,
                     32:          searchwall,
                     33:          searchstat;              //search output
                     34: 
                     35: static
                     36: short temppicnum,
                     37:          tempcstat;
                     38: 
                     39: static
                     40: char tempshade,
                     41:          tempxrepeat,
                     42:          tempyrepeat,
                     43:          somethingintab=255;
                     44: 
                     45: extern
                     46: void __interrupt __far timerhandler(void);
                     47: 
                     48: long xoldtimerhandler;
                     49: 
                     50: void __interrupt __far
                     51: xtimerhandler(void)
                     52: {
                     53:          timerhandler();
                     54:          if (qsetmode == 480) {
                     55:                         Keys2d();
                     56:          }
                     57:          else {
                     58:                         Keys3d();
                     59:          }
                     60: }
                     61: 
                     62: 
                     63: void faketimerhandler(void) {
                     64:        return;
                     65: }
                     66: 
                     67: void
                     68: xinittimer(void)
                     69: {
                     70:          outp(0x43,54);
                     71:          outp(0x40,9942&255);
                     72:          outp(0x40,9942>>8);      //120 times/sec
                     73:          xoldtimerhandler=(long)_dos_getvect(0x8);
                     74:          _disable();
                     75:          _dos_setvect(0x8,xtimerhandler);
                     76:          _enable();
                     77: }
                     78: 
                     79: static
                     80: char tempbuf[256];            //161
                     81: 
                     82: static
                     83: int  numsprite[2000];
                     84: 
                     85: static
                     86: char lo[32];
                     87: 
                     88: static
                     89: const char *levelname;
                     90: 
                     91: static
                     92: short curwall=0,
                     93:          wallpicnum=0,
                     94:          curwallnum=0;
                     95: 
                     96: static
                     97: short cursprite=0,
                     98:          curspritenum=0;
                     99: 
                    100: static
                    101: char wallsprite=0;
                    102: 
                    103: static helpon=0;
                    104: 
                    105: static
                    106: char once=0;
                    107: 
                    108: void
                    109: ExtLoadMap(const char *mapname)
                    110: {
                    111:          if (once == 0) {
                    112:                         xinittimer();
                    113:          }
                    114:          once=1;
                    115:          levelname=mapname;
                    116:          ReadPaletteTable();
                    117:          visibility=11;
                    118: //     pskyoff[0]=0;
                    119: //     pskybits=3;
                    120: }
                    121: 
                    122: void
                    123: ExtSaveMap(const char *mapname)
                    124: {
                    125:          clearmidstatbar16();             //Clear middle of status bar
                    126:          sprintf(tempbuf,"Saving File : %s",mapname);
                    127:          printmessage16(tempbuf);
                    128: }
                    129: 
                    130: const
                    131: char *ExtGetSectorCaption(short sectnum)
                    132: {
                    133: 
                    134:          short which;
                    135:          int temp=0;
                    136:          char string[5];
                    137:          char destination[25];
                    138: 
                    139:          which = sector[sectnum].lotag;
                    140: 
                    141:          if ((sector[sectnum].lotag|sector[sectnum].hitag) == 0) {
                    142:                         tempbuf[0]=0;
                    143:          }
                    144:          else {
                    145:                         if( which >= 1100 && which <= 1900) {
                    146:                                 temp = sector[sectnum].lotag / 100;  
                    147:                                 which = temp * 100;
                    148:                                 itoa(sector[sectnum].lotag-which,string,10);
                    149:                         }
                    150:                         else if( which >=2000 && which <= 2999 ) {
                    151: 
                    152: 
                    153:                         }
                    154:                         if( which >= 80 && which <= 89 ) {
                    155:                                // panning
                    156:                                temp=which-80;
                    157:                                which=sector[sectnum].lotag-temp;
                    158:                         }
                    159:                         //switch((unsigned short)sector[sectnum].lotag) {
                    160:                         switch (which) {
                    161:                         case 1:
                    162:                                        sprintf(lo,"ACTIVATE SECTOR");
                    163:                                        break;
                    164:                         case 2:
                    165:                                        sprintf(lo,"ACTIVATE ONCE");
                    166:                         case 4:
                    167:                         //
                    168:                         // need to fix
                    169:                                        sprintf(lo,"FLOOR PANNING");
                    170:                         case 6:
                    171:                                        sprintf(lo,"RISING DOOR");
                    172:                                        break;
                    173:                         case 7:
                    174:                                        sprintf(lo,"DROP DOOR");
                    175:                                        break;
                    176:                         case 8:
                    177:                                        sprintf(lo,"HOR SPLIT DOOR");
                    178:                                        break;
                    179:                         case 9:
                    180:                                        sprintf(lo,"VER SPLIT DOOR");
                    181:                                        break;
                    182:                         case 10:
                    183:                                        sprintf(lo,"TELEPORTER");
                    184:                                        break;
                    185:                         case 11:
                    186:                                        sprintf(lo,"XPANNING WALLS");
                    187:                         case 16:
                    188:                                        sprintf(lo,"BOX DOOR");
                    189:                                        break;
                    190:                         case 80:
                    191:                                        strcpy(destination,"PANNING ");
                    192:                         
                    193:                                        switch(temp) {
                    194:                                                case 0:
                    195:                                                        strcpy(string,"N");
                    196:                                                break;
                    197:                                                case 1:
                    198:                                                        strcpy(string,"NE");
                    199:                                                break;
                    200:                                                case 2:
                    201:                                                        strcpy(string,"E");
                    202:                                                break;
                    203:                                                case 3:
                    204:                                                        strcpy(string,"SE");
                    205:                                                break;
                    206:                                                case 4:
                    207:                                                        strcpy(string,"S");
                    208:                                                break;
                    209:                                                case 5:
                    210:                                                        strcpy(string,"SW");
                    211:                                                break;
                    212:                                                case 6:
                    213:                                                        strcpy(string,"W");
                    214:                                                break;
                    215:                                                case 7:
                    216:                                                        strcpy(string,"SW");
                    217:                                                break;
                    218:                                        }
                    219:                                        strcat(destination," ");
                    220:                                        strcat(destination,string);
                    221:                                        sprintf(lo,destination);
                    222:                                        break;
                    223:                         case 1000:
                    224:                                        sprintf(lo,"PLATFORM ELEVATOR");
                    225:                                        break;
                    226:                         case 1003:
                    227:                                        sprintf(lo,"BOX ELEVATOR");
                    228:                                        break;
                    229:                         case 1100:
                    230:                                        strcpy(destination,"DROP FLOOR ");
                    231:                                        strcat(destination,string);
                    232:                                        sprintf(lo,destination);
                    233:                                        break;
                    234:                         case 1200:
                    235:                                        strcpy(destination,"RAISE FLOOR ");
                    236:                                        strcat(destination,string);
                    237:                                        sprintf(lo,destination);
                    238:                                        break;
                    239:                         case 1300:
                    240:                                        strcpy(destination,"DROP CEILING ");
                    241:                                        strcat(destination,string);
                    242:                                        sprintf(lo,destination);
                    243:                                        break;
                    244:                         case 1400:
                    245:                                        strcpy(destination,"RAISE CEILING ");
                    246:                                        strcat(destination,string);
                    247:                                        sprintf(lo,destination);
                    248:                                        break;
                    249:                         case 1500:
                    250:                                        strcpy(destination,"DROP F&C ");
                    251:                                        strcat(destination,string);
                    252:                                        sprintf(lo,destination);
                    253:                                        break;
                    254:                         case 1600:
                    255:                                        strcpy(destination,"RAISE F&C ");
                    256:                                        strcat(destination,string);
                    257:                                        sprintf(lo,destination);
                    258:                                        break;
                    259:                         case 1800:
                    260:                                        sprintf(lo,"LIFT");
                    261:                                        break;
                    262:                         case 1900:
                    263:                                        sprintf(lo,"FLOOR DOOR");
                    264:                                        break;
                    265:                         default:
                    266:                                        sprintf(lo,"%hu",(unsigned short)sector[sectnum].lotag);
                    267:                                        break;
                    268:                         }
                    269:                         sprintf(tempbuf,"%hu,%s",(unsigned short)sector[sectnum].hitag,lo);
                    270:          }
                    271:          return(tempbuf);
                    272: }
                    273: 
                    274: const
                    275: char *ExtGetWallCaption(short wallnum)
                    276: {
                    277:          long i=0;
                    278: 
                    279:          if (keystatus[0x57] > 0) {    // f11   Grab pic 0x4e +
                    280:                         wallpicnum=wall[curwall].picnum;
                    281:                         sprintf(tempbuf,"Grabed Wall Picnum %ld",wallpicnum);
                    282:                         printmessage16(tempbuf);
                    283:          }
                    284:          if (keystatus[0x2b] > 0) {    // |
                    285:                         if (wallsprite == 1) {
                    286:                                        for (i=curwallnum ; i < MAXWALLS ; i++) {
                    287:                                                  if (wall[i].picnum == wall[curwall].picnum) {
                    288:                                                                 posx=(wall[i].x)-(((wall[i].x)-(wall[wall[i].point2].x))/2);
                    289:                                                                 posy=(wall[i].y)-(( (wall[i].y)-(wall[wall[i].point2].y))/2);
                    290:                                                                 printmessage16("Wall Found");
                    291:                                                                 curwallnum++;
                    292:                                                                 keystatus[0x2b]=0;
                    293:                                                                 return(tempbuf);
                    294:                                                  }
                    295:                                                  curwallnum++;
                    296:                                        }
                    297:                         }
                    298:                         if (wallsprite == 2) {
                    299:                                        for (i=curspritenum ; i < MAXSPRITES ; i++) {
                    300:                                                  if (sprite[i].picnum == sprite[cursprite].picnum && sprite[i].statnum == 0) {
                    301:                                                                 posx=sprite[i].x;
                    302:                                                                 posy=sprite[i].y;
                    303:                                                                 ang=sprite[i].ang;
                    304:                                                                 printmessage16("Sprite Found");
                    305:                                                                 curspritenum++;
                    306:                                                                 keystatus[0x2b]=0;
                    307:                                                                 return(tempbuf);
                    308:                                                  }
                    309:                                                  curspritenum++;
                    310:                                        }
                    311:                         }
                    312:          }
                    313:          if ((wall[wallnum].lotag|wall[wallnum].hitag) == 0) {
                    314:                         tempbuf[0]=0;
                    315:          }
                    316:          else {
                    317:                         sprintf(tempbuf,"%hu,%hu",(unsigned short)wall[wallnum].hitag,
                    318:                                                                                  (unsigned short)wall[wallnum].lotag);
                    319:          }
                    320:          return(tempbuf);
                    321: }
                    322: 
                    323: const
                    324: char *ExtGetSpriteCaption(short spritenum)
                    325: {
                    326:          char destination[20];
                    327:          int which;
                    328:          
                    329:          tempbuf[0]=0;
                    330: 
                    331:          if ((sprite[spritenum].lotag|sprite[spritenum].hitag) == 0) {
                    332:                         SpriteName(spritenum,lo);
                    333:                         if (lo[0] != 0) {
                    334:                                        sprintf(tempbuf,"%s",lo);
                    335:                         }
                    336:          }
                    337:          else if ((unsigned short)sprite[spritenum].picnum == 104) {
                    338:                         switch((unsigned short)sprite[spritenum].lotag) {
                    339:                         case 1000:
                    340:                                        sprintf(lo,"PULSING");
                    341:                                        break;
                    342:                         case 1001:
                    343:                                        sprintf(lo,"FLICKERING");
                    344:                                        break;
                    345:                         case 1002:
                    346:                                        sprintf(lo,"TIC DELAY");
                    347:                                        break;
                    348:                         default:
                    349:                                        sprintf(lo,"%hu",(unsigned short)sprite[spritenum].lotag);
                    350:                                        break;
                    351:                         }
                    352:                         sprintf(tempbuf,"%hu,%s",(unsigned short)sprite[spritenum].hitag,lo);
                    353:          }
                    354:          else if(sprite[spritenum].hitag >= 90 && sprite[spritenum].hitag <= 99) {     
                    355:                         which=sprite[spritenum].lotag;
                    356:                         strcpy(destination,"GRATE ");
                    357:                                        switch(which){
                    358:                                                case 1:
                    359:                                                        strcat(destination,"OUT");
                    360:                                                break;
                    361:                                                case 2:
                    362:                                                        strcat(destination,"IN");
                    363:                                                break;
                    364:                                                case 3:
                    365:                                                        strcat(destination,"UP");
                    366:                                                break;
                    367:                                                case 4:
                    368:                                                        strcat(destination,"DN");
                    369:                                                break;
                    370:                                        }
                    371:          sprintf(lo,destination);
                    372:          }          
                    373:          else {
                    374:                         SpriteName(spritenum,lo);
                    375:                         sprintf(tempbuf,"%hu,%hu %s",(unsigned short)sprite[spritenum].hitag,
                    376:                                                                                          (unsigned short)sprite[spritenum].lotag,lo);
                    377:          }
                    378:          return(tempbuf);
                    379: }
                    380: 
                    381: //printext16 parameters:
                    382: //printext16(long xpos, long ypos, short col, short backcol,
                    383: //           char name[82], char fontsize)
                    384: //  xpos 0-639   (top left)
                    385: //  ypos 0-479   (top left)
                    386: //  col 0-15
                    387: //  backcol 0-15, -1 is transparent background
                    388: //  name
                    389: //  fontsize 0=8*8, 1=3*5
                    390: 
                    391: //drawline16 parameters:
                    392: // drawline16(long x1, long y1, long x2, long y2, char col)
                    393: //  x1, x2  0-639
                    394: //  y1, y2  0-143  (status bar is 144 high, origin is top-left of STATUS BAR)
                    395: //  col     0-15
                    396: 
                    397: void
                    398: ExtShowSectorData(short sectnum)   //F5
                    399: {
                    400:          int  i,c=0;
                    401: 
                    402:          for (i=0 ; i < 2000 ; i++) {
                    403:                         numsprite[i]=0;
                    404:          }
                    405:          for (i=0 ; i < MAXSPRITES ; i++) {
                    406:                         if (sprite[i].statnum == 0) {
                    407:                                        numsprite[sprite[i].picnum]++;
                    408:                         }
                    409:          }
                    410:          clearmidstatbar16();          //Clear middle of status bar
                    411:          sprintf(tempbuf,"Level %s",levelname);
                    412:          printmessage16(tempbuf);
                    413: }
                    414: 
                    415: void
                    416: ExtShowWallData(short wallnum)       //F6
                    417: {
                    418:          int  i,nexti,bls,ouls,ss,rss,smss,tss,es,drs,music=0;
                    419: 
                    420:          bls=ouls=ss=rss=smss=tss=es=drs=0;
                    421:          for(i=0 ; i < MAXSPRITES ; i++) {
                    422:                         if (sprite[i].picnum == 51 && sprite[i].statnum == 0) {
                    423:                                        if(sprite[i].lotag > drs) {
                    424:                                                  drs=sprite[i].lotag;
                    425:                                        }
                    426:                         }
                    427:                         if (sprite[i].picnum == 175 && sprite[i].statnum == 0) {
                    428:                                        switch(sprite[i].lotag) {
                    429:                                        case 1:
                    430:                                                  if (sprite[i].hitag > rss) {
                    431:                                                                 rss=sprite[i].hitag;
                    432:                                                  }
                    433:                                                  break;
                    434:                                        case 3:
                    435:                                        case 4:
                    436:                                                  if (sprite[i].hitag > bls) {
                    437:                                                                 bls=sprite[i].hitag;
                    438:                                                  }
                    439:                                                  break;
                    440:                                        case 7:
                    441:                                                  if (sprite[i].hitag > tss) {
                    442:                                                                 tss=sprite[i].hitag;
                    443:                                                  }
                    444:                                                  break;
                    445:                                        case 8:
                    446:                                                  if (sprite[i].hitag > ouls) {
                    447:                                                                 ouls=sprite[i].hitag;
                    448:                                                  }
                    449:                                                  break;
                    450:                                        case 13:
                    451:                                                  if (sprite[i].hitag > es) {
                    452:                                                                 es=sprite[i].hitag;
                    453:                                                  }
                    454:                                                  break;
                    455:                                        }
                    456:                         }
                    457:          }
                    458:          clearmidstatbar16();
                    459:          sprintf(tempbuf,"Level %s",levelname);
                    460:          printmessage16(tempbuf);
                    461:          printext16(1*8,4*8,11,-1,"Sector Effector Status",0);
                    462:          PrintStatus("Breaking Lights       =",bls,2,6,11);
                    463:          PrintStatus("Open Up Lights        =",ouls,2,7,11);
                    464:          PrintStatus("Switches              =",ss,2,8,11);
                    465:          PrintStatus("Rotating Sectors      =",rss,2,9,11);
                    466:          PrintStatus("Subway Moving Sectors =",smss,2,10,11);
                    467:          PrintStatus("Transporting Sectors  =",tss,2,11,11);
                    468:          PrintStatus("Exploding Sectors     =",es,32,6,11);
                    469:          PrintStatus("Delay Reactions       =",drs,32,7,11);
                    470: }
                    471: 
                    472: void
                    473: ExtShowSpriteData(short spritenum)   //F6
                    474: {
                    475:          FILE *fp;
                    476:          int  i,t;
                    477:          char x=0,y=4,xmax=0,xx=0,col=0;
                    478: 
                    479:          clearmidstatbar16();
                    480:          if ((fp=fopen("sehelp.hlp","rb")) == NULL) {
                    481:                         printext16(1*4,4*8,11,-1,"ERROR: file <SEHELP.HLP> not found.",0);
                    482:                         return;
                    483:          }
                    484:          t=65;
                    485:          while (t != EOF && col < 5) {
                    486:                         t=getc(fp);
                    487:                         while (t != EOF && t != '\n' && x < 250) {
                    488:                                        tempbuf[x]=t;
                    489:                                        t=getc(fp);
                    490:                                        x++;
                    491:                                        if (x > xmax) {
                    492:                                                  xmax=x;
                    493:                                        }
                    494:                         }
                    495:                         tempbuf[x]=0;
                    496:                         printext16(xx*4,(y*6)+2,11,-1,tempbuf,1);
                    497:                         x=0;
                    498:                         y++;
                    499:                         if (y > 18) {
                    500:                                        col++;
                    501:                                        y=6;
                    502:                                        xx+=xmax;
                    503:                                        xmax=0;
                    504:                         }
                    505:          }
                    506: }
                    507: 
                    508: void
                    509: ExtEditSectorData(short sectnum)    //F7
                    510: {
                    511:          FILE *fp;
                    512:          int  i,t;
                    513:          char x=0,y=4,xmax=0,xx=0,col=0;
                    514: 
                    515:          clearmidstatbar16();
                    516:          if ((fp=fopen("sthelp.hlp","rb")) == NULL) {
                    517:                         printext16(1*4,4*8,11,-1,"ERROR: file <STHELP.HLP> not found.",0);
                    518:                         return;
                    519:          }
                    520:          t=65;
                    521:          while (t != EOF && col < 5) {
                    522:                         t=getc(fp);
                    523:                         while (t != EOF && t != '\n' && x < 250) {
                    524:                                        tempbuf[x]=t;
                    525:                                        t=getc(fp);
                    526:                                        x++;
                    527:                                        if (x > xmax) {
                    528:                                                  xmax=x;
                    529:                                        }
                    530:                         }
                    531:                         tempbuf[x]=0;
                    532:                         printext16(xx*4,(y*6)+2,11,-1,tempbuf,1);
                    533:                         x=0;
                    534:                         y++;
                    535:                         if (y > 18) {
                    536:                                        col++;
                    537:                                        y=6;
                    538:                                        xx+=xmax;
                    539:                                        xmax=0;
                    540:                         }
                    541:          }
                    542: }
                    543: 
                    544: void
                    545: ExtEditWallData(short wallnum)       //F8
                    546: {
                    547:          wallsprite=1;
                    548:          curwall=wallnum;
                    549:          curwallnum=0;
                    550:          sprintf(tempbuf,"Current Wall %ld",curwall);
                    551:          printmessage16(tempbuf);
                    552: }
                    553: 
                    554: void
                    555: ExtEditSpriteData(short spritenum)   //F8
                    556: {
                    557:          wallsprite=2;
                    558:          cursprite=spritenum;
                    559:          curspritenum=0;
                    560:          sprintf(tempbuf,"Current Sprite %ld",cursprite);
                    561:          printmessage16(tempbuf);
                    562: }
                    563: 
                    564:         //Just thought you might want my getnumber16 code
                    565: /*
                    566: getnumber16(char namestart[80], short num, long maxnumber)
                    567: {
                    568:        char buffer[80];
                    569:        long j, k, n, danum, oldnum;
                    570: 
                    571:        danum = (long)num;
                    572:        oldnum = danum;
                    573:        while ((keystatus[0x1c] != 2) && (keystatus[0x1] == 0))  //Enter, ESC
                    574:        {
                    575:                sprintf(&buffer,"%s%ld_ ",namestart,danum);
                    576:                printmessage16(buffer);
                    577: 
                    578:                for(j=2;j<=11;j++)                //Scan numbers 0-9
                    579:                        if (keystatus[j] > 0)
                    580:                        {
                    581:                                keystatus[j] = 0;
                    582:                                k = j-1;
                    583:                                if (k == 10) k = 0;
                    584:                                n = (danum*10)+k;
                    585:                                if (n < maxnumber) danum = n;
                    586:                        }
                    587:                if (keystatus[0xe] > 0)    // backspace
                    588:                {
                    589:                        danum /= 10;
                    590:                        keystatus[0xe] = 0;
                    591:                }
                    592:                if (keystatus[0x1c] == 1)   //L. enter
                    593:                {
                    594:                        oldnum = danum;
                    595:                        keystatus[0x1c] = 2;
                    596:                        asksave = 1;
                    597:                }
                    598:        }
                    599:        keystatus[0x1c] = 0;
                    600:        keystatus[0x1] = 0;
                    601:        return((short)oldnum);
                    602: }
                    603: */
                    604: 
                    605: void
                    606: PrintStatus(char *string,int num,char x,char y,char color)
                    607: {
                    608:          sprintf(tempbuf,"%s %d",string,num);
                    609:          printext16(x*8,y*8,color,-1,tempbuf,0);
                    610: }
                    611: 
                    612: void
                    613: SpriteName(short spritenum, char *lo2)
                    614: {
                    615:          sprintf(lo2,names[sprite[spritenum].picnum]);
                    616: /*
                    617:  switch((unsigned short)sprite[spritenum].picnum)
                    618:  {
                    619:   case APLAYER : sprintf(lo2,"GRONDOVAL"); break;
                    620:   case KOBOLD : sprintf(lo2,"KOBOLD"); break;
                    621:   case JUDY : sprintf(lo2,"JUDY"); break;
                    622:   case MANDROID : sprintf(lo2,"MANDROID"); break;
                    623:   case TROOP1 : sprintf(lo2,"TROOPER"); break;
                    624:   case SEENINE : sprintf(lo2,"C-9"); break;
                    625:   case BAT : sprintf(lo2,"BAT"); break;
                    626:   case REACTOR : sprintf(lo2,"REACTOR"); break;
                    627:   case EXPLODINGBARREL : sprintf(lo2,"EBARREL"); break;
                    628: 
                    629:   case COKE : sprintf(lo2,"COKE"); break;
                    630:   case SIXPAK : sprintf(lo2,"SIXPAK"); break;
                    631:   case STEROIDS : sprintf(lo2,"STEROIDS"); break;
                    632:   case SHIELD : sprintf(lo2,"SHIELD"); break;
                    633:   case AIRTANK : sprintf(lo2,"AIRTANK"); break;
                    634:   case JETPACK : sprintf(lo2,"JETPACK"); break;
                    635:   case HOLODUKE : sprintf(lo2,"HOLODUKE"); break;
                    636: 
                    637:   case FIRSTGUNSPRITE : sprintf(lo2,"PISTOL"); break;
                    638:   case GUN2ASPRITE : sprintf(lo2,"ELECTROGUN"); break;
                    639:   case RPGSPRITE : sprintf(lo2,"RPG"); break;
                    640: 
                    641:   case AMMO : sprintf(lo2,"AMMO"); break;
                    642:   case BATTERYAMMO : sprintf(lo2,"BATTERY"); break;
                    643:   case HEAVYHBOMB : sprintf(lo2,"H-BOMB"); break;
                    644:   case RPGAMMO : sprintf(lo2,"3-RPG"); break;
                    645: 
                    646:   default : lo2[0]=0;
                    647:  }
                    648: */
                    649: }
                    650: 
                    651: void
                    652: ReadPaletteTable()
                    653: {
                    654:          FILE *fp;
                    655:          int  i,j;
                    656:          char num_tables,lookup_num;
                    657: 
                    658:          if ((fp=fopen("lookup.dat","rb")) == NULL) {
                    659:                         return;
                    660:          }
                    661:          num_tables=getc(fp);
                    662:          for (j=0 ; j < num_tables ; j++) {
                    663:                         lookup_num=getc(fp);
                    664:                         for (i=0 ; i < 256 ; i++) {
                    665:                                        tempbuf[i]=getc(fp);
                    666:                         }
                    667:                         makepalookup(lookup_num,tempbuf,0,0,0);
                    668:          }
                    669:          fclose;
                    670: }
                    671: 
                    672: void
                    673: Keys3d(void)
                    674: {
                    675:          if (helpon == 1) {
                    676:                         printext256(0*8,0*8,15,0,"HELP SCREEN",0);
                    677:                         printext256(0*8,2*8,15,0," ' + H = Help",0);
                    678:                         printext256(0*8,3*8,15,0," ' + Enter = copy graphic Only",0);
                    679:          }
                    680:          if (keystatus[0x28] == 1 && keystatus[0x23] == 1) { // ' H
                    681:                         helpon=1;
                    682:          }
                    683:          if (keystatus[0x29] == 1) { // `
                    684:                         helpon=0;
                    685:          }
                    686:          if (keystatus[0x28] == 1 && keystatus[0x1c] == 1) { // ' ENTER
                    687:                         printext256(0,0,15,0,"Put Graphic ONLY",0);
                    688:                         keystatus[0x1c]=0;
                    689:                         switch(searchstat) {
                    690:                         case 0:
                    691:                                        wall[searchwall].picnum=temppicnum;
                    692:                                        break;
                    693:                         case 1:
                    694:                                        sector[searchsector].ceilingpicnum=temppicnum;
                    695:                                        break;
                    696:                         case 2:
                    697:                                        sector[searchsector].floorpicnum=temppicnum;
                    698:                                        break;
                    699:                         case 3:
                    700:                                        sprite[searchwall].picnum=temppicnum;
                    701:                                        break;
                    702:                         case 4:
                    703:                                        wall[searchwall].overpicnum=temppicnum;
                    704:                                        break;
                    705:                         }
                    706:          }
                    707:          if (keystatus[0x0f] == 1) { //TAB
                    708:                         switch (searchstat) {
                    709:                         case 0:
                    710:                                        temppicnum=wall[searchwall].picnum;
                    711:                                        tempshade=wall[searchwall].shade;
                    712:                                        tempxrepeat=wall[searchwall].xrepeat;
                    713:                                        tempyrepeat=wall[searchwall].yrepeat;
                    714:                                        tempcstat=wall[searchwall].cstat;
                    715:                                        break;
                    716:                         case 1:
                    717:                                        temppicnum=sector[searchsector].ceilingpicnum;
                    718:                                        tempshade=sector[searchsector].ceilingshade;
                    719:                                        tempxrepeat=sector[searchsector].ceilingxpanning;
                    720:                                        tempyrepeat=sector[searchsector].ceilingypanning;
                    721:                                        tempcstat=sector[searchsector].ceilingstat;
                    722:                                        break;
                    723:                         case 2:
                    724:                                        temppicnum=sector[searchsector].floorpicnum;
                    725:                                        tempshade=sector[searchsector].floorshade;
                    726:                                        tempxrepeat=sector[searchsector].floorxpanning;
                    727:                                        tempyrepeat=sector[searchsector].floorypanning;
                    728:                                        tempcstat=sector[searchsector].floorstat;
                    729:                                        break;
                    730:                         case 3:
                    731:                                        temppicnum=sprite[searchwall].picnum;
                    732:                                        tempshade=sprite[searchwall].shade;
                    733:                                        tempxrepeat=sprite[searchwall].xrepeat;
                    734:                                        tempyrepeat=sprite[searchwall].yrepeat;
                    735:                                        tempcstat=sprite[searchwall].cstat;
                    736:                                        break;
                    737:                         case 4:
                    738:                                        temppicnum=wall[searchwall].overpicnum;
                    739:                                        tempshade=wall[searchwall].shade;
                    740:                                        tempxrepeat=wall[searchwall].xrepeat;
                    741:                                        tempyrepeat=wall[searchwall].yrepeat;
                    742:                                        tempcstat=wall[searchwall].cstat;
                    743:                         }
                    744:          }
                    745: }
                    746: 
                    747: void
                    748: Keys2d(void)
                    749: {
                    750: 
                    751: }
                    752: 
                    753: void ExtInit(void)
                    754: {
                    755:        long i;
                    756: 
                    757:                //You can load your own palette lookup tables here if you just
                    758:                //copy the right code!
                    759:        for(i=0;i<256;i++)
                    760:                tempbuf[i] = ((i+32)&255);  //remap colors for screwy palette sectors
                    761:        makepalookup(16,tempbuf,0,0,0);
                    762: 
                    763:        kensplayerheight = 54;
                    764:        zmode = 0;
                    765:        
                    766: }
                    767: 
                    768: void ExtUnInit(void)
                    769: {
                    770: }
                    771: 
                    772: void ExtCheckKeys(void)
                    773: {
                    774:        long i;
                    775: 
                    776:        if (qsetmode == 200)    //In 3D mode
                    777:        {
                    778:                i = totalclock;
                    779:                if (i != frameval[framecnt])
                    780:                {
                    781:                        sprintf(tempbuf,"%ld",(120*AVERAGEFRAMES)/(i-frameval[framecnt]));
                    782:                        printext256(0L,0L,31,-1,tempbuf,1);
                    783:                        frameval[framecnt] = i;
                    784:                }
                    785:                framecnt = ((framecnt+1)&(AVERAGEFRAMES-1));
                    786:                
                    787:                editinput();
                    788:        }
                    789:        else
                    790:        {
                    791:        }
                    792: }
                    793: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.