Jump to content

Photo

Palettes and Subscreens and buttons.


  • Please log in to reply
46 replies to this topic

#1 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 22 July 2010 - 04:11 PM

Two questions.

1- How would you command an FFC to use the extra sprite pallettes? I need one to use set 2, but I'm not sure how to do it. Would I use the "CSet 2" box in the Combo Editor for this?

2- What's the best method of creating a "Custom Subscreen", scripts and all? Drawtiles, and all of that sounds good, but tedious. Actually, would anyone happen to have a custom subscreen script that I could look at?

3- I need a script to assign items to EX1, and EX2 (to use like X, and Y buttons). I know I saw one at some point, but I can't find it. I'll comb through AGN for it, but if anyone knows where to find it, or has it on hand, I'd love it if you could point me to it icon_wink.gif

Thank you!

Edited by Master Maniac, 22 July 2010 - 04:12 PM.


#2 Joe123

Joe123

    Retired

  • Members

Posted 23 July 2010 - 03:46 AM

1: You wouldn't. The only way would be to draw a tile that used ESP on top of it. The 'CSet 2' box is to do with colouring different parts of a single tile in different CSets, not ESP.

2: It'd be complex. Have a go and I'll help.

3: Doesn't really work like that, you'd have to script all of the items again to get it work properly really. Could do some kind of kludge with moving items on to buttons but it'd be really bad

#3 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 23 July 2010 - 05:57 PM

QUOTE(Joe123 @ Jul 23 2010, 12:46 AM) View Post
1: You wouldn't. The only way would be to draw a tile that used ESP on top of it. The 'CSet 2' box is to do with colouring different parts of a single tile in different CSets, not ESP.

2: It'd be complex. Have a go and I'll help.

3: Doesn't really work like that, you'd have to script all of the items again to get it work properly really. Could do some kind of kludge with moving items on to buttons but it'd be really bad


1- Well then... Looks like I need to change a CSet of one of my dungeon pallettes icon_razz.gif

2- Alright. I'll give it a shot.

3- Mmm... I don't understand the word "Kludge", but it doesn't sound fun. Then again, I'd like to add some functions to the current items, and I wouldn't need ALL of them re-scripted... Just the ones I'll be using. I may try it. Because it would fit in nicely with my *attempt* at a subscreen.

WAIT. Can we write to Link->GetEquipment again? or is it still disabled? (in build 1266)


#4 Joe123

Joe123

    Retired

  • Members

Posted 23 July 2010 - 06:02 PM

QUOTE(Master Maniac @ Jul 23 2010, 11:57 PM) View Post
3- Mmm... I don't understand the word "Kludge", but it doesn't sound fun. Then again, I'd like to add some functions to the current items, and I wouldn't need ALL of them re-scripted... Just the ones I'll be using. I may try it. Because it would fit in nicely with my *attempt* at a subscreen.

WAIT. Can we write to Link->GetEquipment again? or is it still disabled? (in build 1266)
Kludge

No it still doesn't work, otherwise it wouldn't be a kludge.


#5 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 23 July 2010 - 06:24 PM

QUOTE(Joe123 @ Jul 23 2010, 03:02 PM) View Post
Kludge

No it still doesn't work, otherwise it wouldn't be a kludge.


Hm...

Well, I could use variables, and not actually set Link->Inventory for it... Same way I'd do with EX1, and EX2.

And then B would be the sword, never-changing. That would be fine to keep Link->Inventory turned on for, since that one wouldn't change.

Would that work? Just changing Link->Inventory with the pickup scripts? Then, I could have a Bool say that the item has been picked up at some point.


#6 Joe123

Joe123

    Retired

  • Members

Posted 24 July 2010 - 01:51 AM

You've lost me.

#7 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 24 July 2010 - 09:09 AM

Er... It's hard to explain. I'll show you once I start writing it.

#8 Joe123

Joe123

    Retired

  • Members

Posted 24 July 2010 - 11:15 AM

OK, I'm interested to see what you come up with.

#9 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 24 July 2010 - 12:19 PM

QUOTE(Joe123 @ Jul 24 2010, 08:15 AM) View Post
OK, I'm interested to see what you come up with.


:O

YAY I R MAKING JOE INTERESTED! >.>

Alright, so I thought of a way to clarify what I was trying to say.

CODE
bool hasitem[30];

item script mayhaveitem{
    void run(int item, int arrnum){
        hasitem[arrnum]=true;
        Link->Inventory[item]=false;
    }
}


So. This is going to be my pickup script on almost every item (except heart containers, rupees, etc)

This will make it so that link doesn't actually have the item, so it won't assign it automatically to my B button. BUT, it will set the bool value for that item to True, which will make me able to custom script it. icon_razz.gif I R SMRT!

Haven't tested it out yet though.


#10 Joe123

Joe123

    Retired

  • Members

Posted 24 July 2010 - 12:56 PM

Oh yeah, that was roughly what I meant when I said you could do a kludge. Your idea is better than what I had in mind though.
If I'm perfectly honest though, if you're going to the effort of scripting your subscreen you might as well script the items too, none of them would be particularly hard.

#11 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 24 July 2010 - 01:32 PM

QUOTE(Joe123 @ Jul 24 2010, 09:56 AM) View Post
Oh yeah, that was roughly what I meant when I said you could do a kludge. Your idea is better than what I had in mind though.
If I'm perfectly honest though, if you're going to the effort of scripting your subscreen you might as well script the items too, none of them would be particularly hard.


Agreed. I'd like for the custom scripted items to work hand-in-hand with the subscreen , which is cool.

In reality though, it wouldn't be the actual items on the subscreen. It would just be DrawTile's, and such. Or FFC's...

Only things I'm worried about are making the actual subscreen not pop up when start is pressed, and making EVERYTHING freeze on the screen.


#12 Joe123

Joe123

    Retired

  • Members

Posted 25 July 2010 - 06:12 AM

I've had issues with Link->InputStart = false; in the past actually, I think there might be some ZC-related bug. Freezing the screen isn't too hard.

#13 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 25 July 2010 - 07:59 AM

QUOTE(Joe123 @ Jul 25 2010, 03:12 AM) View Post
I've had issues with Link->InputStart = false; in the past actually, I think there might be some ZC-related bug. Freezing the screen isn't too hard.


Can you tell me how to do it? I have no idea where to start. And Link->InputStart=false is working just fine for me, as long as it's inside of a while(); loop.

Also, I have no idea how to make a nice opening effect with DrawTile's... >.>

One more question. If I loaded an LWeapon (like LW_BOMBS or LW_BRANG), would they act like they would if used by normal items, instead of being triggered with a button press? And would they still trigger secrets/flags?

EDIT: By the way, this is what it will look like when empty:
http://img809.images...screenzors.png/

EDIT2: HEY JOE!

I've got everything done (almost) aside from scripting the items. It's a very long script though.

CODE
                //EX1 is X, EX2 is Y buttons.

                //constants for custom subscreen

bool hasitem[30];

item script mayhaveitem{
    void run(int itemnum, int arrnum){
        hasitem[arrnum]=true;
        Link->Item[itemnum]=false;
    }
}

bool subscreen;

const int subscreentile=28080;
const int subscreenoverlay=28340;
int tiletile;
int tiletile2;
const int blanktile=259;

const int noitem=0;
const int boomerang=1;
const int bombs=2;
const int icewand=3;
const int sbombs=5;
const int bow=4;
const int hookshot=6;
const int hammer=7;
const int arrow1=10;
const int arrow2=11;
const int arrow3=12;

const int boomerangtile=924;
const int icewandtile=490;
const int bombtile=409;
const int sbombtile=429;
const int bowtile=1152;
const int hookshottile=616;
const int hammertile=1180;
const int pointertile=25060;
const int sword1tile=12101;
const int sword2tile=12121;
const int sword3tile=12161;
const int sword4tile=10752;
int hcpiecetile;
int xassign;
int yassign;
int bassign;
int xpos;
int ypos;
int position;
int poschange;

bool xbutton;
bool ybutton;

int savelinkx;
int savelinky;
int thescreen;


                         //counters, etc...
            if(poschange>0){
                poschange--;
            }

            if(Link->InputEx1){
                xbutton=true;
            }
            else xbutton=false;

            if(Link->InputEx2){
                ybutton=true;
            }
            else ybutton=false;

            // Subscreen functions
                //item assignment graphics

            if(xassign==boomerang){
                Screen->FastTile(6,176,-40,boomerangtile,6,128);
                if(!subscreen && xbutton){

                }
            }
            if(yassign==boomerang){
                Screen->FastTile(6,192,-56,boomerangtile,6,128);
            }
            if(bassign==boomerang){
                Screen->FastTile(6,208,-40,boomerangtile,6,128);
            }
            if(xassign==icewand){
                Screen->FastTile(6,176,-40,icewandtile,7,128);
            }
            if(yassign==icewand){
                Screen->FastTile(6,192,-56,icewandtile,7,128);
            }
            if(bassign==icewand){
                Screen->FastTile(6,208,-40,icewandtile,7,128);
            }
            if(xassign==bombs){
                Screen->FastTile(6,176,-40,bombtile,7,128);
                if(xbutton && Game->Counter[CR_BOMBS]!=0){
                    Game->Counter[CR_BOMBS]--;
                    lweapon bomb=Screen->CreateLWeapon(LW_BOMB);
                    bomb->UseSprite(7);
                    if(Link->Dir==DIR_UP){
                        bomb->X=Link->X;
                        bomb->Y=Link->Y-16;
                    }
                    if(Link->Dir==DIR_DOWN){
                        bomb->X=Link->X;
                        bomb->Y=Link->Y+16;
                    }
                    if(Link->Dir==DIR_LEFT){
                        bomb->X=Link->X-16;
                        bomb->Y=Link->Y;
                    }
                    if(Link->Dir==DIR_RIGHT){
                        bomb->X=Link->X+16;
                        bomb->Y=Link->Y;
                    }
                    Waitframes(10);
                }
            }
            if(yassign==bombs){
                Screen->FastTile(6,192,-56,bombtile,7,128);
                if(ybutton && Game->Counter[CR_BOMBS]!=0){
                    Game->Counter[CR_BOMBS]--;
                    lweapon bomb=Screen->CreateLWeapon(LW_BOMB);
                    bomb->UseSprite(7);
                    if(Link->Dir==DIR_UP){
                        bomb->X=Link->X;
                        bomb->Y=Link->Y-16;
                    }
                    if(Link->Dir==DIR_DOWN){
                        bomb->X=Link->X;
                        bomb->Y=Link->Y+16;
                    }
                    if(Link->Dir==DIR_LEFT){
                        bomb->X=Link->X-16;
                        bomb->Y=Link->Y;
                    }
                    if(Link->Dir==DIR_RIGHT){
                        bomb->X=Link->X+16;
                        bomb->Y=Link->Y;
                    }
                    Waitframes(10);
                }
            }
            if(bassign==bombs){
                Screen->FastTile(6,208,-40,bombtile,7,128);
                if(Link->InputB && Game->Counter[CR_BOMBS]!=0){
                    Game->Counter[CR_BOMBS]--;
                    lweapon bomb=Screen->CreateLWeapon(LW_BOMB);
                    bomb->UseSprite(7);
                    if(Link->Dir==DIR_UP){
                        bomb->X=Link->X;
                        bomb->Y=Link->Y-16;
                    }
                    if(Link->Dir==DIR_DOWN){
                        bomb->X=Link->X;
                        bomb->Y=Link->Y+16;
                    }
                    if(Link->Dir==DIR_LEFT){
                        bomb->X=Link->X-16;
                        bomb->Y=Link->Y;
                    }
                    if(Link->Dir==DIR_RIGHT){
                        bomb->X=Link->X+16;
                        bomb->Y=Link->Y;
                    }
                    Waitframes(10);
            }
            if(xassign==bow){
                Screen->FastTile(6,176,-40,bowtile,6,128);
            }
            if(yassign==bow){
                Screen->FastTile(6,192,-56,bowtile,6,128);
            }
            if(bassign==bow){
                Screen->FastTile(6,208,-40,bowtile,6,128);
            }
            if(xassign==sbombs){
                Screen->FastTile(6,176,-40,sbombtile,8,128);
            }
            if(yassign==sbombs){
                Screen->FastTile(6,192,-56,sbombtile,8,128);
            }
            if(bassign==sbombs){
                Screen->FastTile(6,208,-40,sbombtile,8,128);
            }


            Link->InputStart=false;

            if(!subscreen){
                if(Link->InputR){
                    Link->InputRight=false;
                    Link->InputLeft=false;
                    Link->InputUp=false;
                    Link->InputDown=false;
                    Game->PlaySound(5);
                    subscreen=true;
                    savelinkx=Link->X;
                    savelinky=Link->Y;
                    Waitframes(15);
                }
                ffc cursor=Screen->LoadFFC(31);
                cursor->Data=0;
            }

            if(subscreen){


                if(xbutton && hasitem[position]){
                    if(yassign==position) yassign=noitem;
                    if(bassign==position) bassign=noitem;
                    xassign=position;
                }
                if(ybutton && hasitem[position]){
                    if(xassign==position) xassign=noitem;
                    if(bassign==position) bassign=noitem;
                    yassign=position;
                }
                if(Link->InputB && hasitem[position]){
                    if(yassign==position) yassign=noitem;
                    if(xassign==position) xassign=noitem;
                    bassign=position;
                }


                if(position==1){
                    xpos=136;
                    ypos=24;


                    if(Link->InputRight&& poschange == 0){
                        position=2;
                        poschange=10;
                    }
                    if(Link->InputLeft&& poschange == 0){
                        position=3;
                        poschange=10;
                    }
                    if(Link->InputDown&& poschange == 0){
                        position=4;
                        poschange=10;
                    }
                    if(Link->InputUp&& poschange == 0){
                        position=7;
                        poschange=10;
                    }
                }
                if(position==2){
                    xpos=168;
                    ypos=24;
                    if(Link->InputRight&& poschange == 0){
                        position=3;
                        poschange=10;
                    }
                    if(Link->InputLeft&& poschange == 0){
                        position=1;
                        poschange=10;
                    }
                    if(Link->InputDown&& poschange == 0){
                        position=5;
                        poschange=10;
                    }
                    if(Link->InputUp&& poschange==0){
                        position=8;
                        poschange=10;
                    }
                }
                if(position==3){
                    xpos=200;
                    ypos=24;
                    if(Link->InputRight&&poschange==0){
                        position=1;
                        poschange=10;
                    }
                    if(Link->InputLeft&&poschange==0){
                        position=2;
                        poschange=10;
                    }
                    if(Link->InputDown&&poschange==0){
                        position=6;
                        poschange=10;
                    }
                    if(Link->InputUp&&poschange==0){
                        position=9;
                        poschange=10;
                    }
                }
                if(position==4){
                    xpos=136;
                    ypos=56;
                    if(Link->InputRight&&poschange==0){
                        position=5;
                        poschange=10;
                    }
                    if(Link->InputLeft&&poschange==0){
                        position=6;
                        poschange=10;
                    }
                    if(Link->InputDown&&poschange==0){
                        position=7;
                        poschange=10;
                    }
                    if(Link->InputUp&&poschange==0){
                        position=1;
                        poschange=10;
                    }
                }
                if(position==5){
                    xpos=168;
                    ypos=56;
                    if(Link->InputRight&&poschange==0){
                        position=6;
                        poschange=10;
                    }
                    if(Link->InputLeft&&poschange==0){
                        position=4;
                        poschange=10;
                    }
                    if(Link->InputDown&&poschange==0){
                        position=8;
                        poschange=10;
                    }
                    if(Link->InputUp&&poschange==0){
                        position=2;
                        poschange=10;
                    }
                }
                if(position==6){
                    xpos=200;
                    ypos=56;
                    if(Link->InputRight&&poschange==0){
                        position=4;
                        poschange=10;
                    }
                    if(Link->InputLeft&&poschange==0){
                        position=5;
                        poschange=10;
                    }
                    if(Link->InputDown&&poschange==0){
                        position=9;
                        poschange=10;
                    }
                    if(Link->InputUp&&poschange==0){
                        position=3;
                        poschange=10;
                    }
                }
                if(position==7){
                    xpos=136;
                    ypos=88;
                    if(Link->InputRight&&poschange==0){
                        position=8;
                        poschange=10;
                    }
                    if(Link->InputLeft&&poschange==0){
                        position=9;
                        poschange=10;
                    }
                    if(Link->InputDown&&poschange==0){
                        position=1;
                        poschange=10;
                    }
                    if(Link->InputUp&&poschange==0){
                        position=4;
                        poschange=10;
                    }
                }
                if(position==8){
                    xpos=168;
                    ypos=88;
                    if(Link->InputRight&&poschange==0){
                        position=9;
                        poschange=10;
                    }
                    if(Link->InputLeft&&poschange==0){
                        position=7;
                        poschange=10;
                    }
                    if(Link->InputDown&&poschange==0){
                        position=2;
                        poschange=10;
                    }
                    if(Link->InputUp&&poschange==0){
                        position=5;
                        poschange=10;
                    }
                }
                if(position==9){
                    xpos=200;
                    ypos=88;
                    if(Link->InputRight&&poschange==0){
                        position=7;
                        poschange=10;
                    }
                    if(Link->InputLeft&&poschange==0){
                        position=8;
                        poschange=10;
                    }
                    if(Link->InputDown&&poschange==0){
                        position=3;
                        poschange=10;
                    }
                    if(Link->InputUp&&poschange==0){
                        position=6;
                        poschange=10;
                    }
                }

                    

                hcpiecetile=35329+ Game->Generic[GEN_HEARTPIECES];
                Link->InputStart=false;
                ffc cursor=Screen->LoadFFC(31);
                cursor->Data=141;

                cursor->X=xpos;
                cursor->Y=ypos;

                Screen->DrawTile(5,0,0,subscreentile,16,11,6,-1,-1,0,0,0,0,false,128);
                Screen->FastTile(6,cursor->X,cursor->Y,pointertile,11,128);
                Screen->FastTile(6,64,48,hcpiecetile,8,128);
                    //Item placement on subscreens, depending on whether link currently has the item or not.
                    //also, item assigning control codes.

                //non-selectables. These are NOT custom scripted.

                if(Link->Item[I_SWORD1]){
                    Screen->FastTile(6,41,105,sword1tile,5,128);
                }
                if(Link->Item[I_SWORD2]){
                    Screen->FastTile(6,41,105,sword2tile,5,128);
                }
                if(Link->Item[I_SWORD3]){
                    Screen->FastTile(6,41,105,sword3tile,7,128);
                }
                if(Link->Item[I_SWORD4]){
                    Screen->FastTile(6,41,105,sword4tile,11,128);
                }
                if(Link->Item[I_SHIELD1]){
                    Screen->FastTile(6,57,105,343,6,128);
                }
                if(Link->Item[I_SHIELD2]){
                    Screen->FastTile(6,57,105,453,11,128);
                }
                if(Link->Item[I_SHIELD3]){
                    Screen->FastTile(6,57,105,456,8,128);
                }
                if(Link->Item[I_FLIPPERS]){
                    Screen->FastTile(6,73,105,912,7,128);
                }
                if(Link->Item[I_RING1]){
                    Screen->FastTile(6,89,105,714,7,128);
                }
                if(Link->Item[I_RING2]){
                    Screen->FastTile(6,89,105,714,8,128);
                }
                if(Link->Item[I_RING3]){
                    Screen->FastTile(6,89,105,715,10,128);
                }
                if(Link->Item[I_BOMBBAG1]){
                    Screen->FastTile(6,105,105,13340,7,128);
                }
                if(Link->Item[I_BOMBBAG2]){
                    Screen->FastTile(6,105,105,13341,7,128);
                }
                if(Link->Item[I_BOMBBAG3]){
                    Screen->FastTile(6,105,105,13342,7,128);
                }
                if(Link->Item[I_QUIVER1]){
                    Screen->FastTile(6,41,121,13440,7,128);
                }
                if(Link->Item[I_QUIVER2]){
                    Screen->FastTile(6,41,121,13441,7,128);
                }
                if(Link->Item[I_QUIVER3]){
                    Screen->FastTile(6,41,121,13442,8,128);
                }
                if(Link->Item[I_COMPASS]){
                    Screen->FastTile(6,57,121,376,7,128);
                }
                if(Link->Item[I_MAP]){
                    Screen->FastTile(6,73,121,397,6,128);
                }

                //Selectables. These are custom scripted.

                if(hasitem[boomerang]){
                    Screen->FastTile(6,144,32,boomerangtile,6,128);
                }


                if(hasitem[icewand]){
                    Screen->FastTile(6,208,32,icewandtile,7,128);
                }

                if(hasitem[bombs]){
                    Screen->FastTile(6,176,32,bombtile,7,128);

                }
                if(hasitem[sbombs]){
                    Screen->FastTile(6,176,64,sbombtile,8,128);

                }
                if(hasitem[bow]){
                    Screen->FastTile(6,144,64,bowtile,6,128);

                }
                if(hasitem[hookshot]){
                    Screen->FastTile(6,144,82,hookshottile,7,128);

                }
                if(hasitem[hammer]){
                    Screen->FastTile(6,208,64,hammertile,7,128);

                }


#14 Joe123

Joe123

    Retired

  • Members

Posted 25 July 2010 - 04:21 PM

OK, I'll come to your code in a minute. If you want to make something as complicated as a subscreen though you are going to have to learn how functions work otherwise it'll be completely futile.

QUOTE(Joe123 @ Jul 25 2010, 03:12 AM) View Post
Can you tell me how to do it? I have no idea where to start. And Link->InputStart=false is working just fine for me, as long as it's inside of a while(); loop.

Also, I have no idea how to make a nice opening effect with DrawTile's... >.>
"DrawTiles" is plural not possive, it doesn't have an apostrophe.

Ok, so here's a little bit of subscreen template which does freezing and a nice graphical effect:
CODE
global script Slot2
{
    void run()
    {
        while(true)
        {
            Subscreen(); //Get it out of the main while loop otherwise we have a great big mess
            Waitframe();
        }
    }
    void Subscreen()
    {
        Link->InputStart = false; //Don't allow normal sub
        if(!Link->PressR) //If Link didn't press R this frame we don't want to open the sub
            return;
        
        FreezeScreen(); //Just using the function I wrote
        WaveOut(pickacolour, true); //Wave out to subscreen, looks nice. Functions further down script.
        
        while(!Link->PressR) //While R's not being pressed we draw the subscreen
        {
            //All of subscreen stuff goes in here
        }
        
        WaveIn(pickacolour, true); //Effect back in
        UnFreeze(); //And return to gameplay
    }
}

int FreezeID = 0;
void FreezeScreen()
{
    FreezeID = Screen->ComboT[0];
    Screen->ComboT[0] = CT_SCREENFREEZE;
}

void UnFreeze()
{
    Screen->ComboT[0] = FreezeID;
    FreezeID = 0;
}

bool isFrozen()
{
    return FreezeID != 0;
}

void WaveOut(int colour,bool andsub)
{
    for(int i=0;i<30;i++)
    {
        for(int j=Ceiling(i/6);j>0;j--) CoverScreen(colour,64,andsub);
        Screen->Wavy = 3;
        Waitframe();
    }
    Screen->Wavy = 0;
}

void WaveIn(int colour,bool andsub)
{
    for(int i=0;i<30;i++)
    {
        for(int j=Ceiling((30-i)/6);j>0;j--) CoverScreen(colour,64,andsub);
        Screen->Wavy = 3;
        Waitframe();
    }
    Screen->Wavy = 0;
}

void CoverScreen(int colour,int opac)
{
    CoverScreen(colour,opac,false);
}

void CoverScreen(int colour,int opac,bool andsub)
{
    Rectangle(Cond(andsub,7,6),0,Cond(andsub,-56,0),256,168,colour,true,opac);
}

void Rectangle(int l, int x1, int y1, int x2, int y2, int c, bool fill, int o)
{
    Screen->Rectangle(l,x1,y1,x2,y2,c,1,0,0,0,fill,o);
}
If you want me to explain how functions work I will do.

QUOTE(Joe123 @ Jul 25 2010, 03:12 AM) View Post
One more question. If I loaded an LWeapon (like LW_BOMBS or LW_BRANG), would they act like they would if used by normal items, instead of being triggered with a button press? And would they still trigger secrets/flags?
Yeah. Not loaded though, created.

QUOTE(Joe123 @ Jul 25 2010, 03:12 AM) View Post
EDIT: By the way, this is what it will look like when empty:
http://img809.images...screenzors.png/

Nice, I like it =)


QUOTE(Joe123 @ Jul 25 2010, 03:12 AM) View Post
EDIT2: HEY JOE!

I've got everything done (almost) aside from scripting the items. It's a very long script though.

CODE
code was here
OK, this is a pretty good start but it's a bit of a mess at the moment.

Firstly:
CODE
item script mayhaveitem{
    void run(int itemnum, int arrnum){
        hasitem[arrnum]=true;
        Link->Item[itemnum]=false;
    }
}
You can write this like this instead:
CODE
item script MayHaveItem
{
    void run(int arrnum)
    {
        hasitem[arrnum] = true;
        Link->Item[this->ID] = false;
    }
}
Save putting in an unnecessary argument.

Then we can handle drawing each item much better like this. We store the information in a few global arrays, then we can draw them with a for loop.
CODE
int SUB_HasItem[30]; //Store if you have each item here
int SUB_ItemTile[30] = //This stores each item's tile to draw on the sub
    { firstitemstile, second itemstile, ...
        ..., lastitemstile };
int SUB_ItemX[30] = //This has the x-coord
    { firstitemx, second etc, };
int SUB_ItemY[30] = { }; //and y;
int SUB_ItemCSet[30] = { }; //CSets

void DrawSubscreenItems()
{
    for(int i = 0; i < 30; i++)
        if(SUB_HasItem[i])
            Screen->FastTile(6, SUB_ItemX[i], Sub_ItemY[i], Sub_ItemTile[i], Sub_ItemCSet[i], 128);
}
Then you can call 'DrawSubscreenItems' inside the loop that handles the subscreen and they'll all appear nice.

Have a go with what's there so far, work through it and make sure you understand it and I'll have a look at the rest of the code when I get some more time.

#15 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 27 July 2010 - 03:58 PM

Alright. I see what you're driving at now. I haven't had a chance to try, but I'll attempt to do this your way.

By the way, what about upgraded items? Such as the magical and fire boomerang, which will go in the same slot?

Also, would I place my item action functions on the first scope of the Subscreen() function?

EDIT: and inside of the Subscreen() function, what keeps the subscreen up? Looks almost like it would close only while R is pressed... Then again, I've never used PressR or any of those.

Edited by Master Maniac, 27 July 2010 - 04:01 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users