Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pipboy.cc with full pagination #464

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

cambragol
Copy link

@cambragol cambragol commented Feb 24, 2025

Adds full pagination to Status, Data and Automaps main and sub pages to prevent overflow.

fixes #461 and makes #465 #466 redundant

Adds pagination to Automaps sub-location (elevation) pages to prevent overflow over the map display.

Prevents duplicate entries in main Automaps page list (Fallout Sonora)

fixes alexbatalov#461
removed the elimination of duplicated names as there could be a better solution, and it overlaps with other features
@cambragol cambragol changed the title Update pipboy.cc Update pipboy.cc with full pagination Mar 4, 2025
Full implementation of pagination for the pipboy. Status, Data, and Automaps, and their subpages can now paginate when entries exceed a range which fits in the page.

The 'Video Archives' page was not given pagination, as it seem unlikely it would be needed, and there currently is a limit to number of videos.
Small fix to add correct number of buttons when moving between automap pages.
src/pipboy.cc Outdated

// 0x664508
int gPipboyTab;

// 0x66450C
int _actcnt;

int _loccnt;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have readable names for any newly introduced symbols.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to follow existing naming conventions.

src/pipboy.cc Outdated
pipboyDrawText(text2, PIPBOY_TEXT_ALIGNMENT_RIGHT_COLUMN_CENTER, _colorTable[992]);
if ((gPipboyMouseX > 459 && a1 != 1027) || a1 == 1026) {
if (gPipboyHolodiskLastPage <= _view_page) {
if (a1 != 1026) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to deobfuscate/decypher variable names for any code that's being rewritten.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure what you mean.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean you keep using a1 name for the variable. Since the code is being rewritten, might as well name it properly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay. Clear now.
I guess I was just trying to be the least disruptive I could. I am not a coder, and this is the first C++ I have ever coded, and the first PRs I have done, so renaming a bunch of stuff seemed presumptive.

src/pipboy.cc Outdated
const int maxEntriesPerPage = PIPBOY_STATUS_QUESTLIST_LINES;

int index = 0;
int v13 = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above about deobfuscation. Looking at the diff it's hard to tell which code is new and which was just moved around, so it ended up in the diff. So I would treat any code in the diff as new code with some quality standards.

@cambragol
Copy link
Author

Trying to do some code improvements here, but ran into a bug/issue that bothers me.

Original code does a brief 'highlight' of selected buttons (locations, quests, holodisks etc) before switching to the relevant page.

However, Fallout 2 CE seems to load those pages so fast, or in a way, that prevents the highlight from being seen.

My code ran a little roughshod over this original feature, as I was not seeing it working. But now I realize that it is supposed to work. So I need to restore the code, and then figure out how to get it working.

Here is an example:

      if (gPipboyQuestLocationsCount != 0 && gPipboyWindowQuestsCurrentPageCount >= userInput && gPipboyMouseX < 429) {
         soundPlayFile("ib1p1xx1");
         blitBufferToBuffer(_pipboyFrmImages[PIPBOY_FRM_BACKGROUND].getData() + PIPBOY_WINDOW_WIDTH * PIPBOY_WINDOW_CONTENT_VIEW_Y + PIPBOY_WINDOW_CONTENT_VIEW_X,
            PIPBOY_WINDOW_CONTENT_VIEW_WIDTH,
            PIPBOY_WINDOW_CONTENT_VIEW_HEIGHT,
            PIPBOY_WINDOW_WIDTH,
            gPipboyWindowBuffer + PIPBOY_WINDOW_WIDTH * PIPBOY_WINDOW_CONTENT_VIEW_Y + PIPBOY_WINDOW_CONTENT_VIEW_X,
            PIPBOY_WINDOW_WIDTH);
         pipboyWindowRenderQuestLocationList(userInput);
         pipboyWindowRenderHolodiskList(-1);
         windowRefreshRect(gPipboyWindow, & gPipboyWindowContentRect);
         //inputPauseForTocks(200);
         //delay_ms(350);
         _stat_flag = 1;

pipboyWindowRenderQuestLocationList(userInput); re-reenders the quest location list, with the selected location (userInput) highlighted. However, no matter what I do, delay_ms, inputPause etc., _stat_flag = 1 renders the quest list page instantly and can't be delayed in any way to allow the brief 'highlight' to be seen.

- improved various variable names
- fixed small bug that allowed clicking through quests to quest locations list
- consolidated all bottom page navigation to handlePipboyPageNavigation()

navigation can be seen/tested by lowering these contstants:

// constants for setting lines per page in pagination functions
const int PIPBOY_STATUS_QUEST_LINES = 19;
const int PIPBOY_STATUS_HOLODISK_LINES = 19;
const int PIPBOY_AUTOMAP_LINES = 19;
const int PIPBOY_AUTOMAP_SUB_LINES = 5;
const int PIPBOY_STATUS_QUESTLIST_LINES = 12;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text overflow in Automaps
2 participants