lantus / devilution-nx

Diablo for the Nintendo Switch
The Unlicense
859 stars 61 forks source link

Left stick click for quest log, Y in inventory to read books, fix infinite stats #16

Closed rsn8887 closed 5 years ago

rsn8887 commented 5 years ago

Closes #12 Closes #13 Closes #14

erfg12 commented 5 years ago

Doesn't compile. Remove the || charflag


SourceX/miniwin/misc_msg.cpp:193:20: error: 'charflag' was not declared in this scope
     if (invflag || charflag) {
                    ^~~~~~~~
SourceX/miniwin/misc_msg.cpp:193:20: note: suggested alternative: 'chrflag'
     if (invflag || charflag) {
                    ^~~~~~~~
                    chrflag
make: *** [makefile:302: obj/misc_msg.o] Error 1
erfg12 commented 5 years ago

Also, I just noticed that if the d-pad buttons are pressed while the quest log is open, it will move your character around.

We will need to add another conditional check for if the quest log flag is true (questlog) to return in the walkInDir function.

rsn8887 commented 5 years ago

Thanks.

When in a dialog with a townsperson, the dpad moves dialog selection but also moves the character by the way. So there are more controls fixes required than just this.

rsn8887 commented 5 years ago

Should be fixed now, thanks again.

erfg12 commented 5 years ago

In plrctrls.cpp at line 574 try changing

} else if (chrflag) {
            if (ticks - statuptimer >= 400) {
                statuptimer = ticks;
                for (int i = 0; i < 4; i++) {
                    if (MouseX >= attribute_inc_rects2[i][0]
                        && MouseX <= attribute_inc_rects2[i][0] + attribute_inc_rects2[i][2]
                        && MouseY >= attribute_inc_rects2[i][1]
                        && MouseY <= attribute_inc_rects2[i][3] + attribute_inc_rects2[i][1]) {
                        chrbtn[i] = 1;
                        chrbtnactive = TRUE;
                        ReleaseChrBtns();
                    }
                }
            }
        }

to

} else if (chrflag) {
            if (ticks - statuptimer >= 400) {
                statuptimer = ticks;
                CheckChrBtns();
            }
        }

This needs to be tested, I am only guessing.

rsn8887 commented 5 years ago

Ok I made the change (needs testing).

erfg12 commented 5 years ago

Please wait on the merge till testing is done. I will test this later tonight.

erfg12 commented 5 years ago

@rsn8887 In the file plrctrls.cpp in function keyboardExpansion() line 571 this section needs to be replaced:

} else if (chrflag) {
            if (ticks - statuptimer >= 400) {
                statuptimer = ticks;
                if (!chrbtnactive && plr[myplr]._pStatPts) {
                    CheckChrBtns();
                    for (int i = 0; i < 4; i++) {
                        if (MouseX >= attribute_inc_rects2[i][0]
                            && MouseX <= attribute_inc_rects2[i][0] + attribute_inc_rects2[i][2]
                            && MouseY >= attribute_inc_rects2[i][1]
                            && MouseY <= attribute_inc_rects2[i][3] + attribute_inc_rects2[i][1]) {
                            chrbtn[i] = 1;
                            chrbtnactive = TRUE;
                            ReleaseChrBtns();
                        }
                    }
                }
                if (plr[myplr]._pStatPts == 0)
                    HideCursor();
            }
        }

In the diablo.cpp file on line 1361 case 'c': this section needs to be replaced with

if(!stextflag) {
            questlog = FALSE;
            chrflag = chrflag == 0;

            if (newCurHidden) {
                SetCursor_(CURSOR_HAND);
                newCurHidden = false;
            }

            if(!chrflag || invflag) {
                if(MouseX > 160 && MouseY < VIEWPORT_HEIGHT) {
                    SetCursorPos(MouseX - 160, MouseY);
                    MouseX = MouseX - 160;
                    MouseY = MouseY;
                }
            } else {
                if (!chrbtnactive && plr[myplr]._pStatPts) {
                    int x = attribute_inc_rects2[0][0] + (attribute_inc_rects2[0][2] / 2);
                    int y = attribute_inc_rects2[0][1] + (attribute_inc_rects2[0][3] / 2);
                    SetCursorPos(x, y);
                    MouseX = x;
                    MouseY = y;
                } else {
                    if(MouseX < 480 && MouseY < VIEWPORT_HEIGHT) {
                        SetCursorPos(MouseX + 160, MouseY);
                        MouseX = MouseX + 160;
                        MouseY = MouseY;
                    }
                }
            }
        }
        return;

This should make it so that when you open char info it will automatically snap to the first button, when you use up all the skill points the cursor will disappear and the "+LEVEL UP" icon will disappear as well. I tested this on my end and it worked, so when you make the commit let me know and I'll test it on your code.

rsn8887 commented 5 years ago

Ok I made the changes. Ready to test. I will test it now.

rsn8887 commented 5 years ago

Ok I fixed the right click action in inventory, too.

rsn8887 commented 5 years ago

All seems to work now.

lantus commented 5 years ago

looks good here too. merged