Annotation of src/bstub.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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