Exemplo n.º 1
0
static int convert_16x16_tiles_to_mono_font(FONT_GLYPH** gl, int start, int num)
{
  int w = 8, h = 8, i;

  for(i = 0; i < 32; i++)
  {
    int sx = ((w + 7) / 8), j;
    gl[i] = _al_malloc(sizeof(FONT_GLYPH) + sx * h);
    gl[i]->w = w;
    gl[i]->h = h;

    for(j = 0; j < sx * h; j++) gl[i]->dat[j] = 0;
  }
  for(i = 32; i < num+32; i++)
  {
    int tile=(((i-32)/16)*20)+((i-32)%16);

    int sx = ((w + 7) / 8), j, k;

    unpack_tile(start+tile);
    gl[i] = _al_malloc(sizeof(FONT_GLYPH) + sx * h);
    gl[i]->w = w;
    gl[i]->h = h;

    for(j = 0; j < sx * h; j++) gl[i]->dat[j] = 0;

    for(j = 0; j < h; j++)
    {
      for(k = 0; k < w; k++)
      {
        if(unpackbuf[j*16+k])
        {
          gl[i]->dat[(j * sx) + (k / 8)] |= 0x80 >> (k & 7);
        }
      }
    }
  }
  return 0;
}
Exemplo n.º 2
0
void FaroresWindAction::update()
{
    if(timer>0)
    {
        timer--;
        if(phase!=1) // Whatever
            return;
    }
    
    int ltile=0;
    int lflip=0;
    
    switch(phase)
    {
    //if(timer==0)
    case 0:
        {
            linktile(&ltile, &lflip, ls_stab, down, zinit.linkanimationstyle);
            unpack_tile(newtilebuf, ltile, lflip, true);
            memcpy(linkTile, unpackbuf, 256);
            
            if(get_bit(quest_rules,qr_EXPANDEDLTM))
                ltile+=item_tile_mod();
            
            linktile(&link.tile, &link.flip, &link.extend, ls_pound, down, zinit.linkanimationstyle);
            
            if(get_bit(quest_rules,qr_EXPANDEDLTM))
            {
                link.tile+=item_tile_mod();
            }
        }
        phase=1;
        timer=64;
        // Fall though
        
    case 1:
        link.setX(fix(baseX+((rand()%3)-1)));
        link.setY(fix(baseY+((rand()%3)-1)));
        if(timer==0)
            phase=2;
        break;
        
    case 2:
        link.setX(fix(baseX));
        link.setY(fix(baseY));
        linktile(&link.tile, &link.flip, &link.extend, ls_stab, down, zinit.linkanimationstyle);
        
        if(get_bit(quest_rules,qr_EXPANDEDLTM))
            link.tile+=item_tile_mod();
        
        phase=3;
        timer=32;
        break;
    
    case 3:
        if(get_bit(quest_rules,qr_MORESOUNDS))
            sfx(itemsbuf[magicitem].usesound,pan(int(link.getX())));
            
        link.setDontDraw(true);
        
        for(int i=0; i<16; ++i)
        {
            for(int j=0; j<16; ++j)
            {
                if(linkTile[i*16+j])
                {
                    if(itemsbuf[magicitem].misc1==1)  // Twilight
                    {
                        particles.add(new pTwilight(link.getX()+j, link.getY()-link.getZ()+i, 5, 0, 0, (rand()%8)+i*4));
                        int k=particles.Count()-1;
                        particle *p = (particle*)(particles.spr(k));
                        p->step=3;
                    }
                    else if(itemsbuf[magicitem].misc1==2)  // Sands of Hours
                    {
                        particles.add(new pTwilight(link.getX()+j, link.getY()-link.getZ()+i, 5, 1, 2, (rand()%16)+i*2));
                        int k=particles.Count()-1;
                        particle *p = (particle*)(particles.spr(k));
                        p->step=4;
                        
                        if(rand()%10 < 2)
                        {
                            p->color=1;
                            p->cset=0;
                        }
                    }
                    else
                    {
                        particles.add(new pFaroresWindDust(link.getX()+j, link.getY()-link.getZ()+i, 5, 6, linkTile[i*16+j], rand()%96));
                        
                        int k=particles.Count()-1;
                        particle *p = (particle*)(particles.spr(k));
                        p->angular=true;
                        p->angle=rand();
                        p->step=(((double)j)/8);
                        p->yofs=link.getYOfs();
                    }
                }
            }
        }
        phase=4;
        timer=130;
        break;
    
    case 4:
        restart_level();
        magicitem=-1;
        link.setDontDraw(false);
        link.currentItemAction=this; // This won't do...
        phase=5;
        
        break;
    }
}