示例#1
0
void gamedata::set_dcounter(short change, byte c)
{
#ifdef DEBUG_GD_COUNTERS

    if(c==0)
        al_trace("Changing D counter %i from %i to %i\n", c, _dcounter[c], change);
        
#endif
        
    if(c>=32)  // Sanity check
        return;
        
    if(game!=NULL)
    {
        int ringID=current_item_id(itype_ring, true);
        _dcounter[c]=change;
        
        if(ringID!=current_item_id(itype_ring, true))
            ringcolor(false);
    }
    else
        _dcounter[c]=change;
        
    return;
}
示例#2
0
// Stops SFX played by Link's item of the given family
void stop_item_sfx(int family)
{
    int id=current_item_id(family);
    
    if(id<0)
        return;
        
    stop_sfx(itemsbuf[id].usesound);
}
示例#3
0
void dNayrusLoveShield::realdraw(BITMAP *dest, int draw_what)
{
    if(misc!=draw_what)
    {
        return;
    }

    ItemDefinitionRef nayruitem = current_item_id(itype_nayruslove);

    if (!curQuest->isValid(nayruitem))
        return;

    SpriteDefinitionRef nayrufront = curQuest->specialSprites().nayruShieldFront;
    SpriteDefinitionRef nayruback = curQuest->specialSprites().nayruShieldBack;
    
    SpriteDefinitionRef fb=(misc==0?
            ( curQuest->isValid(curQuest->getItemDefinition(nayruitem).wpns[4]) ?
                curQuest->getItemDefinition(nayruitem).wpns[4] :  nayrufront) :
                ( curQuest->isValid(curQuest->getItemDefinition(nayruitem).wpns[9]) ?
                    curQuest->getItemDefinition(nayruitem).wpns[9] : nayruback));
    if (curQuest->isValid(fb))
    {
        int t = curQuest->getSpriteDefinition(fb).tile;
        int fr = curQuest->getSpriteDefinition(fb).frames;
        int spd = curQuest->getSpriteDefinition(fb).speed;
        cs = curQuest->getSpriteDefinition(fb).csets & 15;
        flip = 0;
        bool flickering = (curQuest->getItemDefinition(nayruitem).flags & itemdata::IF_FLAG4) != 0;
        bool translucent = (curQuest->getItemDefinition(nayruitem).flags & itemdata::IF_FLAG3) != 0;

        if (((LinkNayrusLoveShieldClk() & 0x20) || (LinkNayrusLoveShieldClk() & 0xF00)) && (!flickering || ((misc == 1) ? (frame & 1) : (!(frame & 1)))))
        {
            drawstyle = translucent ? 1 : 0;
            x = LinkX() - 8;
            y = LinkY() - 8 - LinkZ();
            tile = t;

            if (fr > 0 && spd > 0)
            {
                tile += ((clk / spd) % fr);
            }

            decoration::draw(dest);
            x += 16;
            tile += fr;
            decoration::draw(dest);
            x -= 16;
            y += 16;
            tile += fr;
            decoration::draw(dest);
            x += 16;
            tile += fr;
            decoration::draw(dest);
        }
    }
}
示例#4
0
void gamedata::change_counter(short change, byte c)
{
#ifdef DEBUG_GD_COUNTERS
    al_trace("Changing counter %i from %i by %i\n", c, _counter[c], change);
#endif
    
    if(c>=32)  // Sanity check
        return;
        
    if(game!=NULL)
    {
        int ringID=current_item_id(itype_ring, true);
        _counter[c]=vbound(_counter[c]+change, 0, _maxcounter[c]);
        
        if(ringID!=current_item_id(itype_ring, true))
            ringcolor(false);
    }
    else
        _counter[c]=vbound(_counter[c]+change, 0, _maxcounter[c]);
        
    return;
}
示例#5
0
void gamedata::set_counter(word change, byte c)
{
#ifdef DEBUG_GD_COUNTERS
    al_trace("Changing counter %i from %i to %i\n", c, _counter[c], change);
#endif
    
    if(c>=32)  // Sanity check
        return;
        
    if(game!=NULL)
    {
        int ringID=current_item_id(itype_ring, true);
        _counter[c]=zc_max(change, 0);
        
        // ringcolor is very slow, so make sure the ring has actually changed
        if(ringID!=current_item_id(itype_ring, true))
            ringcolor(false);
    }
    else
        _counter[c]=zc_max(change, 0);
        
    return;
}
示例#6
0
dHammerSmack::dHammerSmack(fix X,fix Y,int Id,int Clk) : decoration(X,Y,Id,Clk)
{
    ox=X;
    oy=Y;
    id=Id;
    clk=Clk;
    
    static bool initialized=false;
    if(!initialized)
    {
        initialized=true;
        
        ft[0][0][0]=-5;
        ft[0][0][1]=-4;
        ft[0][0][2]=0;
        ft[0][1][0]=-4;
        ft[0][1][1]=-3;
        ft[0][1][2]=1;
        ft[0][2][0]=-5;
        ft[0][2][1]=-4;
        ft[0][2][2]=1;
        ft[0][3][0]=-8;
        ft[0][3][1]=-7;
        ft[0][3][2]=1;
        
        ft[1][0][0]=3;
        ft[1][0][1]=-4;
        ft[1][0][2]=0;
        ft[1][1][0]=5;
        ft[1][1][1]=-3;
        ft[1][1][2]=1;
        ft[1][2][0]=6;
        ft[1][2][1]=-4;
        ft[1][2][2]=1;
        ft[1][3][0]=9;
        ft[1][3][1]=-7;
        ft[1][3][2]=1;
    }
    
    wpnid=curQuest->getItemDefinition(current_item_id(itype_hammer)).wpns[1];
}
示例#7
0
void LinkHandler::addDecorations()
{
    fix x=Link.getX();
    fix y=Link.getY();
    fix z=Link.getZ();
    if(isGrassType(COMBOTYPE(x,y+15)) && isGrassType(COMBOTYPE(x+15,y+15))&& z<=8)
    {
        if(!tallGrassDeco)
        {
            tallGrassDeco.reset(new dTallGrass(x, y, dTALLGRASS, 0));
            decorations.add(tallGrassDeco.get());
        }
    }
    else if(tallGrassDeco)
        tallGrassDeco.del();

    if((COMBOTYPE(x,y+15)==cSHALLOWWATER)&&(COMBOTYPE(x+15,y+15)==cSHALLOWWATER) && z==0)
    {
        if(!ripplesDeco)
        {
            ripplesDeco.reset(new dRipples(x, y, dRIPPLES, 0));
            decorations.add(ripplesDeco.get());
        }
    }
    else if(ripplesDeco)
        ripplesDeco.del();

    if(Link.hoverclk>0)
    {
        if(!hoverDeco)
        {
            hoverDeco.reset(new dHover(x, y, dHOVER, 0));
            decorations.add(hoverDeco.get());
            sfx(itemsbuf[current_item_id(itype_hoverboots)].usesound,pan(int(x)));
        }
    }
    else if(hoverDeco)
        hoverDeco.del();
}
示例#8
0
dHover::dHover(fix X,fix Y,int Id,int Clk) : decoration(X,Y,Id,Clk)
{
    id=Id;
    clk=Clk;
    wpnid = curQuest->getItemDefinition(current_item_id(itype_hoverboots)).wpns[0];
}