예제 #1
0
void Msg(char *string, char color)
{
    clearmidstatbar16();

    printext16(1*4,ydim16+4*8,color,-1,string,1);

}
예제 #2
0
void TotalMem()
{
    char incache[8192];
    int i,j,tottiles,totsprites,totactors;

    for(i=0;i<4096;i++) incache[i] = 0;

    for(i=0;i<numsectors;i++)
    {
        incache[sector[i].ceilingpicnum] = 1;
        incache[sector[i].floorpicnum] = 1;
    }
    for(i=0;i<numwalls;i++)
    {
        incache[wall[i].picnum] = 1;
        if (wall[i].overpicnum >= 0)
            incache[wall[i].overpicnum] = 1;
    }

    tottiles = 0;
    for(i=0;i<4096;i++)
        if (incache[i] > 0)
            tottiles += tilesizx[i]*tilesizy[i];



    for(i=0;i<4096;i++) incache[i] = 0;

    for(i=0;i<MAXSPRITES;i++)
        if (sprite[i].statnum < MAXSTATUS)
            incache[sprite[i].picnum] = 1;
    totsprites = 0;


    for(i=0;i<4096;i++)
    {
        if (incache[i] > 0)
    {
     switch(i)
     {
        case LIZTROOP :
        case LIZTROOPRUNNING :
        case LIZTROOPSTAYPUT :
        case LIZTROOPSHOOT :
        case LIZTROOPJETPACK :
        case LIZTROOPONTOILET :
        case LIZTROOPDUCKING :
        totactors+=ActorMem(LIZTROOP);
        incache[LIZTROOP]=0;
        incache[LIZTROOPRUNNING]=0;
        incache[LIZTROOPSTAYPUT]=0;
        incache[LIZTROOPSHOOT]=0;
        incache[LIZTROOPJETPACK]=0;
        incache[LIZTROOPONTOILET]=0;
        incache[LIZTROOPDUCKING]=0;
        break;
        case OCTABRAIN :
        case OCTABRAINSTAYPUT:
        totactors+=ActorMem(OCTABRAIN);
        incache[OCTABRAIN]=0;
        incache[OCTABRAINSTAYPUT]=0;
        break;
         case DRONE :
        totactors+=ActorMem(DRONE);
        incache[DRONE]=0;
        break;
        case COMMANDER :
        totactors+=ActorMem(COMMANDER);
        incache[COMMANDER]=0;
        break;
        case RECON :
        totactors+=ActorMem(RECON);
        incache[RECON]=0;
        break;
        case PIGCOP :
        totactors+=ActorMem(COMMANDER);
        incache[PIGCOP]=0;
        break;
        case LIZMAN :
        case LIZMANSTAYPUT :
        case LIZMANSPITTING :
        case LIZMANFEEDING :
        case LIZMANJUMP :
        totactors+=ActorMem(LIZMAN);
        incache[LIZMAN]=0;
        incache[LIZMANSTAYPUT]=0;
        incache[LIZMANSPITTING]=0;
        incache[LIZMANFEEDING]=0;
        incache[LIZMANJUMP]=0;
        break;
        case BOSS1 :
        totactors+=ActorMem(BOSS1);
        incache[BOSS1]=0;
        break;
        case BOSS2 :
        totactors+=ActorMem(BOSS2);
        incache[BOSS2]=0;
        break;
        case BOSS3 :
        totactors+=ActorMem(BOSS3);
        incache[BOSS3]=0;
        break;

        default: totsprites += tilesizx[i]*tilesizy[i];
     }
    }
    }





    clearmidstatbar16();
    printext16(1*8,4*8,11,-1,"Memory Status",0);

    PrintStatus("Total Tiles   = ",tottiles,2,6,11);
    PrintStatus("Total Sprites = ",totsprites,2,7,11);
    PrintStatus("Total Actors  = ",totactors,2,8,11);

    PrintStatus("Total Memory  = ",(tottiles+totsprites+totactors),2,10,11);

    PrintStatus("Total W/Duke  = ",(tottiles+totsprites+totactors+ActorMem(APLAYER)),2,12,11);
    
}
예제 #3
0
void ContextHelp(short spritenum)
{
    int i,fp;
    char t,*tc;
    char x=0,y=4;
    char *name,*hightag;
    char *filebuffer;
    SPRITEp sp;
    short hitag=0;
    long size=0,tokresult=0;

    
    sp = &sprite[spritenum];

    clearmidstatbar16();

    if((fp=kopen4load("swbhelp.hlp",0)) == -1)
    {
        Msg("ERROR: Help file not found.",M_RED);
        return;
    }

    // Read in whole file
    size = kfilelength(fp);    
    filebuffer = (char *)malloc(size);
    if (filebuffer == NULL)
    {
        Msg("Not enough memory to load swhelp.hlp",M_RED);
        return;
    }

    if (kread(fp, filebuffer, size) != size)
    {
        Msg("Unexpected end of file while reading swhelp.hlp",M_RED);
        kclose(fp);
        return;
    }

    // close the file
    kclose(fp);

    // Conver filebuffer to all upper case
    //strupr(filebuffer);

    // Assign a token name to search for based on the sprite being pointed to.
    name = (char *)malloc(20);
    hightag = (char *)malloc(sizeof(short));

    // Make the token
    strcpy(name,"@TAG");
    // Make sure 500-600 SOBJ bounding tags all say the same thing.
    hitag = sp->hitag;
    if(hitag > 500 && hitag <= 600 ) hitag = 500;
    // Give help summary for unknown sprites.
    if((hitag == 0 || hitag > 1006) && sp->lotag == 0) hitag = 999;

    sprintf(hightag,"%d",hitag);
    //itoa(hitag,hightag,10);
    strcat(name,hightag);

    tc = filebuffer;
    
    if(!(tokresult = GetAToken(name,tc,size)))
    {
        // This message should never happen unless something is real wrong!
        Msg("No help available.",M_RED);
        return;
    }       

    tc += tokresult;

    do {
        tc++;
        t = *tc;
        while(t!='\n' && t!='@' && t!='#' && x<128)
        {
            tempbuf[x]=t;
            tc++;
            t = *tc;
            x++;
            if(x >= 128) break;
        }
        tempbuf[x]=0;
        x=0;
        printext16(x*4,ydim16+(y*6)+2,11,-1,tempbuf,1);
        y++;

        if(y>16)
        {
            y=18;
            printext16(x*4,ydim16+(y*6)+2,11,-1,"Hit any key to continue or Q to quit....",1);
            while (BKeyPressed() == NULL);
            if (keystatus[KEYSC_Q])
            {
                clearmidstatbar16();
                return;
            }
            ResetKeys();
            clearmidstatbar16();

            y=6;
        }

     } while(t!='@' && t!='#');
}