Skip to content

Commit 4837115

Browse files
Jeffieclaude
authored andcommitted
Port: Item page over the paused world with the live character (#27)
The town and dungeon main menus wait while the following camera frames the player: it swings to the player's front, settles against the scenery and holds a close framing with the player and shadow hidden and depth of field off. The Item page draws that frame at window resolution in place of its black fill and retail backdrop forms, and draws the menu character through the world camera at the player's spot. Other pages keep retail's grab of the world as it was when the menu was asked for. Closing the menu restores the camera and the player. The panels spread to the edges of a centred 16:9 area (UiAnchor::max_aspect); the selection frame and command popup move with their panel, a carried item is drawn at the pointer, and mouse hit tests map back to the retail layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 8b01c81 commit 4837115

18 files changed

Lines changed: 817 additions & 13 deletions

‎docs/PC.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,12 @@ outside the menu (1550). `item-menu-mouse-dungeon.input` reaches the dungeon's
870870
Item page and opens Bread's commands by frame 2850. These two scripts also use
871871
1280x720; scale `mouse:dx,dy` counts with the window dimensions for other sizes.
872872

873+
### Item page over the paused world
874+
875+
The town and dungeon main menus open over the paused world instead of the retail backdrop (`port/src/menu_world.cpp`). The request waits up to 20 ticks for the player to stop, swings the following camera to the player's front, where the next world tick's collision check keeps it clear of scenery, hides the player and its shadow, and holds the camera 89.7 units out and to the side so the player stands in the space the Item page leaves for the character. Depth of field is off from then until the menu closes. `MenuMainInit` then runs on that frame. Its `MenuCapture` keeps the frame at window resolution in a frame target of its own, while retail's half-size grab, which the other pages show, copies the world as it was when the menu was asked for, with the player and the walking camera. A subgame, the eye view, a fixed town camera, a non-following camera or the loop leaving its field mode leaves the menu as retail opens it.
876+
877+
On the Item page the picture replaces the black fill and the retail backdrop forms. The menu character is drawn through the world camera at the player's spot, facing it; the Ridepod is drawn at 0.6 scale and the monster form at 0.8. A looked-at weapon or rod keeps the menu's close-up. Panels left of the bag board are anchored to the left edge and the rest to the right, within a centred 16:9 area (`gfx::UiAnchor::max_aspect`); the selection frame and the command popup move with their panel, a carried item is drawn at the pointer, and mouse hit tests map the pointer back to the retail layout. Closing the menu restores the camera and the player.
878+
873879
### Make and Monster Transform mouse
874880

875881
On the Make menu, hovering an invention card or a cell of the item board moves

‎port/include/stubs/dng_main.hpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ class CActionChara;
1414
void PortRetailResetEyeView(CActionChara *) asm("DngMain_ResetEyeView");
1515
int PortRetailChangeSetUnit(int) asm("DngMain_ChangeSetUnit");
1616
int PortRetailDngMainKey() asm("DngMain_DngMainKey");
17+
void PortRetailDngMainDraw() asm("DngMain_DngMainDraw");

‎port/include/stubs/editloop.hpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ extern int PauseFlag asm("EditLoop_Pause");
88
extern int ActiveCharaNo asm("EditLoop_ActiveCharaNo");
99

1010
void PortRetailUpdateTrBoxFlag(int map_no) asm("EditLoop_UpdateTrBoxFlag");
11+
int PortRetailEditDraw() asm("EditLoop_EditDraw");

‎port/include/stubs/menudraw.hpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
extern short use_trans_rect asm("MenuDraw_IconSheet");
55
extern struct MENU_SHORT_RECT item_transtbl[2] asm("MenuDraw_IconUV");
66
extern float MenuWakuPutXY[2] asm("MenuDraw_WakuPosition");
7+
void PortRetailDrawMenuFillBox(int, int, int, int) asm("MenuDraw_DrawMenuFillBox");

‎port/include/stubs/menumain.hpp‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
#pragma once
22
#include <menumain.hpp>
33
extern CMenuInter *CMenuInterPt asm("MenuMouse_Inter");
4+
int PortRetailMenuMainInit(MENU_INIT_ARG *) asm("MenuMain_MenuMainInit");
5+
int PortRetailMenuMainExit() asm("MenuMain_MenuMainExit");
6+
void PortRetailMenuWorldTrans() asm("MenuMain_MenuWorldTrans");

‎port/include/stubs/menusys.hpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ extern CItemSelect *ItemSelectPtr asm("MenuMouse_ItemSelect");
44
extern ITEMCMD_RET_PARA MenuItemCmdRet asm("QuickLoadout_ItemCmdRet");
55
void PortRetailMenuItemSelectInit(mgCMemory *stack, int *tex_block, int mode) asm("MenuSys_MenuItemSelectInit");
66
void PortRetailMenuItemSelectDraw() asm("MenuSys_MenuItemSelectDraw");
7+
void PortRetailMenuItemDraw() asm("MenuSys_MenuItemDraw");

‎port/src/dng_main.cpp‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
#include "common.h"
22

33
#include "charasetup.hpp"
4+
#include "menu_world.hpp"
45
#include "mg_memory.hpp"
56

7+
// dng_main.hpp declares BaseCharacter with retail's six elements.
8+
void DngMainDraw();
9+
void PortRetailDngMainDraw() asm("DngMain_DngMainDraw");
10+
611
// The seventh element is retail's BuffTempData, which SetupMainUnit reaches as stacks[6] by link adjacency on the PS2.
712
PORT_OVERRIDE mgCMemory BaseCharacter[CHARA_MEM_STACK_NUM];
13+
14+
PORT_OVERRIDE void DngMainDraw() {
15+
PortRetailDngMainDraw();
16+
menuworld::AfterWorldDraw();
17+
}

‎port/src/editloop.cpp‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
#include "common.h"
22

33
#include "bounded_text.hpp"
4+
#include "editloop.hpp"
45
#include "mainloop.hpp"
56
#include "map_port.hpp"
67
#include "mapselect.hpp"
8+
#include "menu_world.hpp"
79
#include "scene.hpp"
810

911
void UpdateTrBoxFlag(int map_no);
1012
void PortRetailUpdateTrBoxFlag(int map_no) asm("EditLoop_UpdateTrBoxFlag");
13+
int PortRetailEditDraw() asm("EditLoop_EditDraw");
1114

1215
// Retail's update, after chests that share another chest's opened flag get their own.
1316
PORT_OVERRIDE void UpdateTrBoxFlag(int map_no) {
1417
CScene *scene = GetMainScene();
1518
PortSplitTreasureBoxFlags(*scene->GetMap(scene->active_map), bounded_text::View(GetMapName(map_no, nullptr)));
1619
PortRetailUpdateTrBoxFlag(map_no);
1720
}
21+
22+
PORT_OVERRIDE int EditDraw() {
23+
const int drawn = PortRetailEditDraw();
24+
menuworld::AfterWorldDraw();
25+
return drawn;
26+
}

‎port/src/menu_mouse_item.cpp‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "gamepad.hpp"
88
#include "gfx/gfx.hpp"
99
#include "mainloop.hpp"
10+
#include "menu_world.hpp"
1011
#include "menuaqua.hpp"
1112
#include "menuchr.hpp"
1213
#include "menucls1.hpp"
@@ -327,7 +328,8 @@ Point Start(CMenuItemInfo &menu, CMenuKeyFunc &keys) {
327328

328329
Take TakePointer() {
329330
const auto &sample = MenuMouseTake();
330-
pointer.pos = {.x = sample.x, .y = sample.y};
331+
// Hit tests use the retail layout, so the pointer moves back the way its spread panel moved.
332+
pointer.pos = {.x = menuworld::RetailPointerX(sample.x), .y = sample.y};
331333
pointer.pointing = sample.pointing;
332334
return {.pointing = sample.pointing, .moved = sample.moved || sample.clicked != 0 || sample.wheel != 0, .pressed = sample.clicked, .released = sample.released, .held = sample.held, .wheel = sample.wheel};
333335
}
@@ -457,12 +459,25 @@ void MenuMousePadTick() {
457459

458460
bool MenuMouseItemActive() { return ItemPage(); }
459461

462+
bool MenuMouseHeldItemAt(float &x, float &y) {
463+
if (!ItemPage() || MenuCommonInfo->have_item.item_no <= 0) {
464+
return false;
465+
}
466+
const MenuMouseSample sample = MenuMouseDisplaySample();
467+
if (!sample.pointing) {
468+
return false;
469+
}
470+
x = sample.x;
471+
y = sample.y;
472+
return true;
473+
}
474+
460475
void MenuMouseItemOrigin(float &x, float &y) {
461476
if (!ItemPage()) {
462477
return;
463478
}
464479
const Point start = Start(class_menu_item_info, *MenuCommonInfo);
465-
x = start.x;
480+
x = menuworld::SpreadX(start.x);
466481
y = start.y;
467482
}
468483

‎port/src/menu_mouse_item.hpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,5 @@ void MenuMouseClose();
7777

7878
bool MenuMouseItemActive();
7979
void MenuMouseItemOrigin(float &x, float &y);
80+
// Where the pointer is on screen while it carries an item on the item page.
81+
bool MenuMouseHeldItemAt(float &x, float &y);

0 commit comments

Comments
 (0)