Jump to content

Photo

Palettes and Subscreens and buttons.


  • Please log in to reply
46 replies to this topic

#31 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 28 July 2010 - 07:45 PM

Yeah, it's all buggy and strange. But I think I'd rather the input+cooldown method, so the player can hold the button and scroll through the items.

I'm not sure what I'm doing wrong with the color thing though... I'll toy with it. By the way... why did you put all of the functions in a chain like that, instead of writing all of it inside of one function?


#32 Joe123

Joe123

    Retired

  • Members

Posted 29 July 2010 - 04:07 AM

Oh right yeah, that makes sense. I haven't quite worked out how I'm going to do input selection yet, I'm still on making drawing a bit easier to understand at the moment.

I don't know either, just find a black colour in your palette and put the hex reference to that colour as the arg, should work fine =S

Because nice programming XD
A) It's easier to read, the functions explain what they're doing
B) When I want to cover the screen in a different function but not make it wavy, all I have to do is write 'CoverScreen(colour, andsub)' rather than writing 'Screen->Rectangle(blah,blah,blah)'.

#33 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 29 July 2010 - 05:50 PM

Alright so... no matter what I select, no colors show.


#34 Joe123

Joe123

    Retired

  • Members

Posted 30 July 2010 - 02:41 AM

Maybe I copied the functions into the thread wrong =S
I'll check them in a bit.

#35 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 30 July 2010 - 12:01 PM

QUOTE(Joe123 @ Jul 29 2010, 11:41 PM) View Post

Maybe I copied the functions into the thread wrong =S
I'll check them in a bit.

Could also be an issue with the opacity thing. I'm not sure if opacity works in 1266 or not. Ill check when I get home.


#36 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 01 August 2010 - 10:36 AM

Yeah, opacity is disabled in 1266 but yours doesnt do any other opacity than that...

Anyway, I'm at the point where I'm scripting my items now, scripting the functions when you use them.

I got the bomb. That one was easy. The boomerang, however, has me confused. This is what I have for the actions on button press for the boomerang:

CODE
        lweapon boom=Screen->CreateLWeapon(LW_BRANG);
        boom->Dir=Link->Dir;
        boom->X=Link->X;
        boom->Y=Link->Y;
        boom->Step=32;



Unfortunately, this does nothing...

Edited by Master Maniac, 01 August 2010 - 10:37 AM.


#37 Joe123

Joe123

    Retired

  • Members

Posted 01 August 2010 - 03:06 PM

Making a boomerang'll be a bit more complicated, something like
CODE
Create at (x,y)
Set 'Angular' to true
Work out angle using current dir/inputs (or however inbuilt one does it), and set boom->angle
Set the step


#38 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 01 August 2010 - 04:45 PM

QUOTE(Joe123 @ Aug 1 2010, 12:06 PM) View Post
Making a boomerang'll be a bit more complicated, something like
CODE
Create at (x,y)
Set 'Angular' to true
Work out angle using current dir/inputs (or however inbuilt one does it), and set boom->angle
Set the step


X and T are done... I'm not going to allow angles for it, so that's no big deal...

Will it automatically return to the player, regardless of its step?


#39 Joe123

Joe123

    Retired

  • Members

Posted 02 August 2010 - 04:15 AM

Should do, try chucking it at an enemy and see what happens when it hits it.
If you want it to return early (so if it hits a solid combo or something), there's a WDS_ constant in std.zh you can set it to, it's something like 'WDS_BOOMRETURN', but I can't remember exactly.

#40 Joe123

Joe123

    Retired

  • Members

Posted 08 August 2010 - 06:08 AM

Alright, so here's about half of what 'customsubscreen.zh' would be if I could be bothered to finish it and without any testing/going through the compiler.

If you want explanations of how anything's meant to work just ask.
The SUB_Selectable 'objects' kind of tack-on to the SUB_Objects because they need some of their information.
Just realised I forgot to add any drawing for the cursor, but as I said I'm lazy. I'd be like 'get info from SUB_Objects for current position on current pane, draw at that x,y with some selector graphics' or whatever.

CODE
//Drawing
const int SUB_NUMPANES        = 3; //Number of panes you're using
const int SUB_DEFAULTPANE    = 0; //Pane to open on

//Object types
//DrawCombos are generaly preferable to DrawTiles because they can animate
//enum type =P
const int SUB_OBJ_END        = -1; //Ends declaration list
const int SUB_OBJ_NONE        = 0; //Empty object
const int SUB_OBJ_TILE        = 1; //Tile block,            Colour = CSet,            Data1 = tile
const int SUB_OBJ_COMBO        = 2; //Combo (can animate),    Colour = CSet,            Data2 = combo
const int SUB_OBJ_STRING    = 2; //String,                Colour = Single Colour, Data1 = string pointer,    Data2 = font
const int SUB_OBJ_ITEM        = 3; //Current Item,        Colour = CSet,            Data1 = item,            Data2 = combo
const int SUB_OBJ_ITEMCLASS    = 4; //Current Item Class,    Colour = CSet,            Data1 = itemclass,        Data2 = combo
const int SUB_OBJ_COUNTER    = 5; //Counter,                Colour = Single Colour,    Data1 = counter type,    Data2 = font
const int SUB_OBJ_HCPIECES    = 6; //HC Piece Display,    Colour = CSet,            Data1 = no HCPs tile
//Not implemented
const int SUB_OBJ_BTNITEM    = 7; //Button Item,            Colour = CSet,            Data1 = button
const int SUB_OBJ_TIME        = 8; //Game Time,            Colour = Single Colour, Data1 = font
const int SUB_OBJ_ITEMNAME    = 9; //Selected Item Name,    Colour = Single Colour, Data1 = font
const int SUB_OBJ_SELCNTR    = 10; //Selected Counter,    Colour = Single Colour, Data2 = font


//Object arguments
const int SUB_OBJ_Type        = 0;
const int SUB_OBJ_Pane        = 1; //If you pass -1 to a pane argument it'll be invisible on all panes
const int SUB_OBJ_Pos        = 2; //Non-selectable items are -1
const int SUB_OBJ_X            = 3;
const int SUB_OBJ_Y            = 4;
const int SUB_OBJ_W            = 5;
const int SUB_OBJ_H            = 6;
const int SUB_OBJ_Colour    = 7;
const int SUB_OBJ_Opacity    = 8;
const int SUB_OBJ_Data1        = 9;
const int SUB_OBJ_Data2        = 10;
const int SUB_OBJ_Data3        = 11;
const int SUB_OBJ_NUMARGS    = 12;

//Argument Accesor Functions
int SUB_OBJ_Type(int object)
{
    return SUB_Objects[object * SUB_OBJ_NUMARGS + SUB_OBJ_Type];
}
int SUB_OBJ_Pane(int object)
{
    return SUB_Objects[object * SUB_OBJ_NUMARGS + SUB_OBJ_Pane];
}
int SUB_OBJ_Pos(int object)
{
    return SUB_Objects[object * SUB_OBJ_NUMARGS + SUB_OBJ_Pos];
}
int SUB_OBJ_X(int object)
{
    return SUB_Objects[object * SUB_OBJ_NUMARGS + SUB_OBJ_X];
}
int SUB_OBJ_Y(int object)
{
    return SUB_Objects[object * SUB_OBJ_NUMARGS + SUB_OBJ_Y];
}
int SUB_OBJ_W(int object)
{
    return SUB_Objects[object * SUB_OBJ_NUMARGS + SUB_OBJ_W];
}
int SUB_OBJ_H(int object)
{
    return SUB_Objects[object * SUB_OBJ_NUMARGS + SUB_OBJ_H];
}
int SUB_OBJ_Opacity(int object)
{
    return SUB_Objects[object * SUB_OBJ_NUMARGS + SUB_OBJ_Opacity];
}
int SUB_OBJ_Data1(int object)
{
    return SUB_Objects[object * SUB_OBJ_NUMARGS + SUB_OBJ_Data1];
}
int SUB_OBJ_Data2(int object)
{
    return SUB_Objects[object * SUB_OBJ_NUMARGS + SUB_OBJ_Data2];
}
int SUB_OBJ_Data3(int object)
{
    return SUB_Objects[object * SUB_OBJ_NUMARGS + SUB_OBJ_Data3];
}

//Declare the objects.
//Objects further down the list are drawn after objects near the top
int SUB_Objects [] =
{   //Type,            Pane,    Pos,    X,         Y,         W,        H,        Colour,    Opacity,    Data1,            Data2,            Data3
    SUB_OBJ_TILE,    0,        -1,        0,        -56,    16,        11,        11,        128,        T_BACKGROUND,    -1,                -1,
    SUB_OBJ_ITEM,    0,        0,        40,        20,        1,        1,        7,        128,        CMB_SWORD,        I_SWORD1,        -1,
    SUB_OBJ_ITEM,    0,        1,        60,        20,        1,        1,        7,        128,        CMB_BOOMERANG,    I_BOOMERANG1,    -1,
    SUB_OBJ_ITEM,    0,        2,        40,        40,        1,        1,        7,        128,        CMB_ARROW,        I_ARROW,        -1,
    SUB_OBJ_ITEM,    0,        3,        60,        40,        1,        1,        7,        128,        CMB_BOMB,        I_BOMB,            -1,
    SUB_OBJ_TILE,    1,        -1,        0,        -56,    16,        11,        11,        128,        T_BACKGROUND2,    -1,                -1,
    SUB_OBJ_END        -1,        -1,        0,        0,        0,        0,        0,        0,            -1,                -1,                -1
};

//
const int SUB_SEL_Pos        = 0;
const int SUB_SEL_Up        = 1;
const int SUB_SEL_Down        = 2;
const int SUB_SEL_Left        = 3;
const int SUB_SEL_Right        = 4;
const int SUB_SEL_Action    = 5;
const int SUB_SEL_NUMARGS    = 6;

int SUB_SEL_Pos(int pane, int object)
{
    return pane[object * SUB_SEL_NUMARGS + SUB_SEL_Pos];
}

int SUB_SEL_Up(int pane, int object)
{
    return pane[object * SUB_SEL_NUMARGS + SUB_SEL_Up];
}

int SUB_SEL_Down(int pane, int object)
{
    return pane[object * SUB_SEL_NUMARGS + SUB_SEL_Down];
}

int SUB_SEL_Left(int pane, int object)
{
    return pane[object * SUB_SEL_NUMARGS + SUB_SEL_Left];
}

int SUB_SEL_Right(int pane, int object)
{
    return pane[object * SUB_SEL_NUMARGS + SUB_SEL_Right];
}

int SUB_SEL_Action(int pane, int object)
{
    return pane[object * SUB_SEL_NUMARGS + SUB_SEL_Action];
}


//So you might want it to make a textbox come up or do a toggle or something
const int SUB_ACT_NONE        = -1;
const int SUB_ACT_SELECT    = 0;    //Implemented for SUB_OBJ_ITEM && SUB_OBJ_ITEMCLASS

int SUB_SelectablePane1 [] =
{    //Pos,    Up,        Down,    Left,    Right,    Action,            Name
    0,        0,        2,        0,        1,        SUB_ACT_SELECT,    //I_SWORD1
    1,        1,        3,        0,        1,        SUB_ACT_SELECT,    //I_BOOMERANG1
    2,        0,        2,        2,        3,        SUB_ACT_SELECT,    //I_ARROW
    3,        1,        3,        2,        3,        SUB_ACT_SELECT,    //I_BOMB
    -1,        -1,        -1,        -1,        -1,        SUB_ACT_NONE
};

int SUB_SelectablePane2 [] =
{    //Pos,    Up,        Down,    Left,    Right,    Action,            Name
    -1,        -1,        -1,        -1,        -1,        SUB_ACT_NONE    //etc;
};

int SUB_NumObjects()
{
    return SizeOfArray(Sub_Objects) / SUB_OBJ_NUMARGS;
}

int SUB_NumSelectable()
{
    return SizeOfArray(Sub_Objects) / SUB_SEL_NUMARGS;
}


void SUB_OBJ_Draw()
{
    bool reachedend = false;
    while(!reachedend)
    {
        int type = SUB_OBJ_Type(i);
        if(type <= SUB_OBJ_END)
            reachedend = true;
        
        if(SUB_OBJ_Pane(i) != SUB_CTRL_GetPane())
            continue;
        
        //switch(type) =P
        if(type == SUB_OBJ_TILE)            SUB_OBJ_DrawTile(i);
        else if(type == SUB_OBJ_COMBO)        SUB_OBJ_DrawCombo(i);
        else if(type == SUB_OBJ_STRING)        SUB_OBJ_DrawString(i);
        else if(type == SUB_OBJ_ITEM)        SUB_OBJ_DrawItem(i);
        else if(type == SUB_OBJ_ITEMCLASS)    SUB_OBJ_DrawItemClass(i);
        else if(type == SUB_OBJ_COUNTER)    SUB_OBJ_DrawCounter(i);
        else if(type == SUB_OBJ_HCPIECES)    SUB_OBJ_DrawHCPieces(i);
    }
}

void SUB_OBJ_DrawTile(int object)
{
    Screen->DrawTile(6, SUB_OBJ_X(object), SUB_OBJ_Y(object), SUB_OBJ_Data1(object),
                        SUB_OBJ_W(object), SUB_OBJ_H(object), SUB_OBJ_Colour(object),
                        -1, -1, 0, 0, 0, 0, true, SUB_OBJ_Opacity(object));
}

void SUB_OBJ_DrawCombo(int object)
{
    Screen->DrawCombo(6, SUB_OBJ_X(object), SUB_OBJ_Y(object), SUB_OBJ_Data1(object),
                         SUB_OBJ_W(object), SUB_OBJ_H(object), SUB_OBJ_Colour(object),
                         -1, -1, 0, 0, 0, -1, 0, true, SUB_OBJ_Opacity(object));
}

void SUB_OBJ_DrawString(int object)
{
    Screen->DrawString(6, SUB_OBJ_X(object), SUB_OBJ_Y(object), SUB_OBJ_Data2(object),
                          SUB_OBJ_Colour(object), -1, 0, SUB_OBJ_Opacity(object),
                          SUB_OBJ_Data1(object));
}

void SUB_OBJ_DrawItem(int object)
{
    if(!Link->Item[SUB_OBJ_Data1(object)])
        return;
    
    Screen->DrawCombo(6, SUB_OBJ_X(object), SUB_OBJ_Y(object), SUB_OBJ_Data2(object),
                         SUB_OBJ_W(object), SUB_OBJ_H(object), 1, SUB_OBJ_Colour(object),
                         -1, -1, 0, 0, 0, -1, 0, true, SUB_OBJ_Opacity(object));
}

void SUB_OBJ_DrawItemClass(int object)
{
    int itm = GetHighestLevelItem(SUB_OBJ_Data1(object));
    if(itm == -1)
        return;
    
    itemdata it = Game->LoadItemData(itm);
    
    int combo = SUB_OBJ_Data2(object) + SUB_OBJ_W(object) * it->Level;
    Screen->DrawCombo(6, SUB_OBJ_X(object), SUB_OBJ_Y(object), combo,
                         SUB_OBJ_W(object), SUB_OBJ_H(object), 1, SUB_OBJ_Colour(object),
                         -1, -1, 0, 0, 0, -1, 0, true, SUB_OBJ_Opacity(object));
}

void SUB_OBJ_DrawCounter(int object)
{
    Screen->DrawInteger(6, SUB_OBJ_X(object), SUB_OBJ_Y(object), SUB_OBJ_Data2(object),
                           SUB_OBJ_Colour(object), -1, -1, -1, Game->Counter[SUB_OBJ_Data1(object)],
                           0, SUB_OBJ_Opacity(object));
}

void SUB_OBJ_DrawHCPieces(int object)
{
    int combo = SUB_OBJ_Data1(object) + Game->Generic[GEN_HEARTPIECES];
    Screen->DrawCombo(6, SUB_OBJ_X(object), SUB_OBJ_Y(object), combo,
                         SUB_OBJ_W(object), SUB_OBJ_H(object), 1, SUB_OBJ_Colour(object),
                         -1, -1, 0, 0, 0, -1, 0, true, SUB_OBJ_Opacity(object));
}



//Control
int SUB_CTRL_SelectorPos;
int SUB_CTRL_AWpn;
int SUB_CTRL_BWpn;
//int SUB_CTRL_EX1Wpn;

//Selectable items go on these buttons
const int SUB_BTN_A        = 0;
const int SUB_BTN_B        = 1;
//const int SUB_BTN_EX1    = 2; etc.

void SUB_CTRL_SetButtonItem(int btn)
{
    if(btn == SUB_BTN_A)
        SUB_CTRL_AWpn = SUB_OBJ_Data1(SUB_GetObjFromSelPos(SUB_CTRL_SelectorPos));
        //Would want to be slightly different for an itemclass but I'm lazy

    if(btn == SUB_BTN_B)
        SUB_CTRL_BWpn = SUB_OBJ_Data1(SUB_GetObjFromSelPos(SUB_CTRL_SelectorPos));
        
    //etc.
}

void SUB_CTRL_SelectorAction()
{

    int objdata = SUB_GetObjFromSelPos(SUB_CTRL_SelectorPos);
    if(SUB_SEL_Action(SUB_CTRL_SelectorPos) == SUB_ACT_SELECT)
    {
        if(Link->PressA)
            SUB_CTRL_SetButtonItem(SUB_BTN_A);
        else if(Link->PressB)
            SUB_CTRL_SetButtonItem(SUB_BTN_B);
        //etc.
    }
    //More actions could go
}

//This might be hideously slow, if it is I'll have to rethink things. Hoping it's not though!
void SUB_CTRL_MoveSelector()
{
    if(SUB_CTRL_CurPane == 0)
        SUB_CTRL_MoveSelector(SUB_SelectablePane1);
    else if(SUB_CTRL_CurPane == 1)
        SUB_CTRL_MoveSelector(SUB_SelectablePane2);
    //else if( more panes etc. )
}

//That missing algorithm's fairly important, but I don't much fancy writing it XD
void SUB_CTRL_MoveSelector(int panedata)
{
    if(Link->PressUp)
    {
        int newpos = SUB_SEL_Up(panedata, SUB_CTRL_SelectorPos);    
        if(SUB_CTRL_CanReachPos(panedata, newpos));
            SUB_CTRL_CurSelectorPos = newpos;
        else;
            //Insert algorithm for finding next selectable position here ^^
    }
    else if(Link->PressDown)
    {
        int newpos = SUB_SEL_Down(panedata, SUB_CTRL_SelectorPos);    
        if(SUB_CTRL_CanReachPos(panedata, newpos));
            SUB_CTRL_CurSelectorPos = newpos;
        else;
    }
    else if(Link->PressLeft)
    {
        int newpos = SUB_SEL_Left(panedata, SUB_CTRL_SelectorPos);    
        if(SUB_CTRL_CanReachPos(panedata, newpos));
            SUB_CTRL_CurSelectorPos = newpos;
        else;
    }
    else if(Link->PressRight)
    {
        int newpos = SUB_SEL_Right(panedata, SUB_CTRL_SelectorPos);    
        if(SUB_CTRL_CanReachPos(panedata, newpos));
            SUB_CTRL_CurSelectorPos = newpos;
        else;
    }
}

//Currently just for items and itemclasses, could add support for other positions which are only reachable
//under certain conditions too
bool SUB_CTRL_CanReachPos(int panedata, int pos)
{
    int objpos = SUB_GetObjFromSelPos(pos);
    
    if(SUB_OBJ_Type(objpos) == SUB_OBJ_ITEM)
    {
        return Link->Item[SUB_OBJ_Data1(objpos)];
    }
    else if(SUB_OBJ_Type(objpos) == SUB_OBJ_ITEMCLASS)
    {
        return GetHighestLevelItem(SUB_OBJ_Data1(object)) != -1;
    }
    
    return true; //Everything else is reachable by default
}

int SUB_GetObjFromSelPos(int pos)
{
    int objdata = 0;
    for(; !(SUB_OBJ_Pane(objdata) == SUB_CTRL_CurPane && SUB_OBJ_Pos(objdata) == pos); objdata++);
    return objdata;
}


int SUB_CTRL_CurPane; //Holds the current pane
void SUB_CTRL_Pane() //Changes with L and R, obviously could use Select instead (or anything)
{
    if(Link->PressL)
        if(SUB_CTRL_CurPane-- <= 0)
            SUB_CTRL_CurPane = SUB_NUMPANES - 1;
    
    if(Link->PressR)
        if(SUB_CTRL_CurPane++ >= SUB_NUMPANES - 1)
            SUB_CTRL_CurPane = 0;
}
void SUB_CTRL_SetDefaultPane()
{
    SUB_CTRL_CurPane = SUB_DEFAULTPANE;
}
int SUB_CTRL_GetPane()
{
    return SUB_CTRL_CurPane;
}

//When you're writing your custom weapon code, you'll want like 'if(Link->PressA) DoWeapon(GetAWeapon);' or similar
int GetAWeapon()
{
    return SUB_CTRL_AWpn;
}


//Example
global script Slot2
{
    void run()
    {
        while(true)
        {
            Subscreen();
            Waitframe();
        }
    }
    void Subscreen()
    {
        if(Link->PressStart)
            Link->InputStart = false;
        else
            return;
        
        FreezeScreen();
        WaveOut(pickacolour, true);
        
        SUB_CTRL_SetDefaultPane();
        while(!Link->PressStart)
        {
            SUB_CTRL_Pane();
            SUB_CTRL_MoveSelector();
            SUB_CTRL_SelectorAction();
            SUB_OBJ_Draw();
            Waitframe();
        }
        Link->InputStart = false;
        
        WaveIn(pickacolour, true);
        UnFreeze();
    }
}


EDIT:
OK thinking about this I am going to go back through and add some more organisation to it, it's a bit of a mess.

#41 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 08 August 2010 - 09:17 AM

CODE
                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;                        

                    }

                }



This is what I use for the position of the cursor. It's all copy/paste-able too.

I guess it could be written into a function though. If you'll give me a minute, I'll do that.


#42 Joe123

Joe123

    Retired

  • Members

Posted 08 August 2010 - 09:23 AM

That doesn't take into account if you don't have a certain item and can't select that position though.

#43 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 08 August 2010 - 09:30 AM

CODE
// USAGE: //int xpos: The current X position of the cursor

//int ypos: The curent Y position

//int rightpos, etc: If link presses one of these,

//the cursor's position changes to that.

   //example:

  if(position == 1){

    SUB_OBJ_CursorControl(16,16,2,3,4,7);

}

//Here, the cursor's X and Y are set to 16, and if you press

//right, the variable "position" is changed to 2, etc.

// Have one if() for each position(item slot or otherwise) that you

//need on your subscreen. Cuts down a LOT of space. Trust me.

   void SUB_OBJ_CursorControl(int xpos, int ypos, int rightpos, int leftpos, int downpos, int uppos){

    Cursor->X=xpos;  //not sure what you use to control the x and y for the cursor

    Cursor->Y=ypos;

      if(Link->PressRight){

        position=rightpos;

    }

    if(Link->PressLeft){

        position=leftpos;

    }

    if(Link->PressDown ){

        position=downpos;                        

    }

    if(Link->PressUp){

        position=uppos;                    

    }

}




Yeah, but I don't mind my cursors going over a spot if there's no item there. Not like it's a huge spoiler or anything...

Besides, you'd have to write a function to get the "ItemAtInputPosition", and see if Link currently has it. I don't see what the problem is with the cursor going over items that haven't been acquired yet, as long as you can't assign them, of course.

EDIT: Actually, I could try writing that part up as well...

EDIT2: looks like you already have that -_- One sec and I'll add it in.

Edited by Master Maniac, 08 August 2010 - 09:50 AM.


#44 Joe123

Joe123

    Retired

  • Members

Posted 08 August 2010 - 09:37 AM

Ohhh, I didn't even think of that! That'd make life so much easier, just make the 'ACT_SELCT' only possible if Link has the item but let the cursor move there anyway. Thanks!

OK, that was the main thing that was keeping me from working more on it because I didn't want to have to work it out. I'll work on a more updated version soonish.
Thinking I might separate the objects into different arrays for each pane, it'd be faster...

#45 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 08 August 2010 - 09:41 AM

Well, either way, here you go...
CODE
void SUB_OBJ_CursorControlItem(int xpos, int ypos, int rightpos, int leftpos, int downpos, int uppos){
    Cursor->X=xpos;  //not sure what you use to control the x and y for the cursor

    Cursor->Y=ypos;

      if(Link->PressRight && SUB_GetObjFromSelPos(rightpos) > 0){

        position=rightpos;

    }

    if(Link->PressLeft && SUB_GetObjFromSelPos(leftpos) > 0){

        position=leftpos;

    }

    if(Link->PressDown && SUB_GetObjFromSelPos(downpos) > 0){

        position=downpos;                        

    }

    if(Link->PressUp && SUB_GetObjFromSelPos(uppos) > 0){

        position=uppos;                    

    }

}



Was a tad easier than I thought XD

Edited by Master Maniac, 08 August 2010 - 09:43 AM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users