Skip to content

Commit 459b4ff

Browse files
committed
Added a fast inventory mode option.
1 parent 73ba4b5 commit 459b4ff

File tree

13 files changed

+82
-35
lines changed

13 files changed

+82
-35
lines changed

game_data/base/gui/options_menu_controls.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,25 @@ hardcoded_items{
3030
description=Inventory item shortcuts menu button.
3131
}
3232
leader_cursor_mouse{
33-
center=50.0000 61.0000
34-
size=70.0000 10.0000
33+
center=50.0000 56.0000
34+
size=70.0000 8.0000
3535
description=Checkbox for whether the leader cursor is controlled with the mouse.
3636
}
3737
leader_cursor_speed{
38-
center=50.0000 73.0000
39-
size=70.0000 10.0000
38+
center=50.0000 66.0000
39+
size=70.0000 8.0000
4040
description=Leader cursor speed picker.
4141
}
4242
auto_throw{
43-
center=50.0000 85.0000
44-
size=70.0000 10.0000
43+
center=50.0000 76.0000
44+
size=70.0000 8.0000
4545
description=Auto-throw mode picker.
4646
}
47+
fast_inventory{
48+
center=50.0000 86.0000
49+
size=70.0000 8.0000
50+
description=Fast inventory mode checkbox.
51+
}
4752
tooltip{
4853
center=50.0000 96.0000
4954
size=96.0000 4.0000

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Depending on the area you select, you can either explore around freely without a
9595

9696
* Auditory features: [Multiple Volume Controls](https://accessiblegames.com/accessibility-tags/multiple-volume-controls/)
9797
* Input features: [Full Input Remapping](https://accessiblegames.com/accessibility-tags/full-remapping/), [Playable with Buttons Only](https://accessiblegames.com/accessibility-tags/buttons-only-option/), [Playable with Keyboard Only](https://accessiblegames.com/accessibility-tags/keyboard-only-option/), [Playable with Mouse Only](https://accessiblegames.com/accessibility-tags/mouse-only-option/), [Playable without Button Holds](https://accessiblegames.com/accessibility-tags/playable-without-button-holds/), [Stick Inversion](https://accessiblegames.com/accessibility-tags/stick-inversion/)
98-
* Visual features: [Camera Confort](https://accessiblegames.com/accessibility-tags/camera-comfort/)
98+
* Visual features: [Camera Comfort](https://accessiblegames.com/accessibility-tags/camera-comfort/)
9999

100100
## Get the latest version
101101

source/documents/todo.txt

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ Current tasks (tasks being worked on, but not yet committed)
66

77
Next tasks (roughly sorted most important first)
88
--- To fix ---
9+
Having a Pikmin follow a Snagret as a leader causes a crash
10+
If two keyframes have the same value, the visualizer in the editor will show a broken line
911
Binding the zoom button to the Deck's right trigger STILL causes a bunch of actions when pressed
1012
It's impossible to go on the inner triangle on DEV Lab at 1465, 370
1113

1214
--- 1.1.0 ---
15+
Dismiss sound should be a higher pitch when you press again to dismiss all
1316
Swarming jingle
14-
GUI things
15-
Spatial navigation
16-
Logic to remember where it came from
17-
Logic to check that, if you could get to this item from the current item more effectively (lesser score) with a different direction, then skip it
1817
Controls improvements
1918
Controls manager
2019
Implement sub-schemes, so a game can have a scheme for when you're driving, another for when you're on foot, etc.
@@ -39,8 +38,6 @@ Next tasks (roughly sorted most important first)
3938
If the selected control scheme uses controllers, the player can choose which controllers fill in the controller placeholders of that scheme
4039
Write the controller's names, given by Allegro
4140
An inventory system
42-
A menu speed option: "slow" means you press the button to open it, then press the confirm button to select (and the back button to cancel). "Fast" means you hold the button to keep it open, let go to select.
43-
When you select, should it set it as the aforementioned "standby" item, use it, or do both?
4441
Update the help menu
4542
Check the controller's name, and if it matches the "Switch Pro Controller" or whatever the name used for the Joy-Con is, the input icons should show the name of the button instead of a number
4643
If an action has multiple binds, the icon to show should prioritize controller inputs if the last player input was a controller (for analog sticks only if > 0.5), and keyboard/mouse otherwise
@@ -57,11 +54,13 @@ Next tasks (roughly sorted most important first)
5754
Logic to freeze all enemies in the water
5855
Logic to call the Pikmin out and thawing
5956
Ice hazard for Pikmin attacks, and ice hazard for enemy attacks
57+
Ice gates
6058
Glow Pikmin
6159
The ability for Pikmin to teleport to the current leader if they've been idling for a bit
6260
Onions should be able to specify they can't be interacted with, so Lumiknolls can be Onions under the hood
6361
Glow Pellets should be internally pellets, but only able to be received by Lumiknolls
6462
Glowmob?
63+
Puffstool and mushroom Pikmin
6564
Mob rotation should have acceleration too
6665
A way to start a timer after a random amount of time, based on the coordinates; this allows stuff like a group of fire geysers to start spitting fire at different times
6766
[NEEDS BRAINSTORMING] Re-think how missions work
@@ -74,7 +73,7 @@ Next tasks (roughly sorted most important first)
7473
Areas should be able to set their own rules, overwriting config.txt. This should be shown in the area details
7574
What upgrades are on
7675
Maximum Pikmin in field
77-
If Onions work automatically, by ejecting Pikmin whenever the amount on field is not at max (a la Bingo Battle)
76+
If Onions work automatically, by ejecting Pikmin whenever the amount on field is no longer at max (a la Bingo Battle)
7877
If Onions spit out fully grown Pikmin instead of seeds (a la Dandori Battle)
7978
If Onions should pop new seeds when an extinction happen or if they should let the extinction happen
8079
Floors-over-floors; mostly for bridges
@@ -509,23 +508,25 @@ Misc things (so I don't forget)
509508
Option to pause the game if the window is not focused
510509
An option that changes the font to something easier to read, and decreases the effect of GUI text juice grow
511510
Mechanics
512-
Lock-on
513-
Auto [PIKMIN 4]
514-
Makes the leader cursor snap to the nearest object (or hitbox?) in-game
515-
The mouse cursor, i.e. the spinning flower, should always show where the OS mouse cursor is. It's just the leader's cursor, i.e. the outer shell, that locks
516-
An option to set the radius in which auto lock-on applies
517-
An option to toggle this on or off
518-
Manual [PIKMIN 3][PIKMIN 4]
511+
Cursor
512+
The mouse cursor, i.e. the spinning flower, should always show where the OS mouse cursor is, 100% of the time.
513+
Cursor snap [PIKMIN 4]
514+
Off: normal behavior
515+
On: if the cursor is close to an object (or hitbox?), it automatically moves there. If that thing moves far enough away, the cursor unsnaps. There should be some indicator of the cursor's "real, under-the-hood" position and the cursor's "snapped, final" position; the line connecting to the leader should go to the snap position
516+
Options to set the radius
517+
Lock-on [PIKMIN 3] [PIKMIN 4]
519518
A button that locks the leader cursor in place
520519
If on the floor, it just locks the leader cursor there
521-
If on an enemy, it locks to that position (hitbox + offset) of the enemy, like its back
520+
If on an enemy, it locks to that position (hitbox + offset) of the enemy, like its back, and follows it
522521
While locked, movement on the mouse or gyro (if gyro is ever added) is ignored -- this allows the player to recenter their peripheral
523522
An option in the options for it to either lock with holding the button, or toggling
524-
Throwing or charging (or dismissing) Pikmin onto a locked-on target should make them work exclusively on that
523+
Throwing or charging (or dismissing) Pikmin onto a locked-on target should make them work exclusively on that
524+
Throw locking? [PIKMIN 4]
525+
When you're throwing Pikmin at something, the game momentarily stops you from throwing more if you already threw the required amount
525526
Charge
526-
Allow the player to pick between full-squad charging or standby type charging
527-
Allow the player to pick between placing only the minimum amount of Pikmin necessary onto the task (P4) or maximum (P3)
528-
Hitting charge again should use the maximum
527+
Allow the player to pick between full-squad charging or standby type charging; hitting the button again within a time limit charges the full squad however
528+
Make the second charge sound higher pitched to indicate this
529+
Allow the player to pick between placing only the minimum amount of Pikmin necessary onto the task (P4) or maximum (P3); hitting charge again should use the maximum
529530
Half-whistle
530531
Options for whether whistling workers brings them to you right away, brings the excess to you while keeping the bare minimum in the confirming state, or put all whistled Pikmin in the confirming state (whistling any Pikmin in the confirming state always brings them to you)
531532
Water depth (thanks ThyCheshireCat)
@@ -839,6 +840,7 @@ Tasks for later on (I might never implement these)
839840
When it is opened, it should fade into view, as well as zoom out, to give the impression that the camera is moving up to show a larger view, from the point the leader is. Maybe only for story mode, and only the first time you do it?
840841
Survey drone? It'd just be a way for the player to view the area with free-cam (same as if there are no players)
841842
The ability to place beacons?
843+
Buttons to disable the HUD and other niceties for players wanting to use it just to take photos
842844
Petrified enemies should break open when defeated
843845
Maybe define loot tables somewhere, like "standard", "boss", "weakling", etc. Enemy types use the "standard" one by default (which one is the default should be specified somewhere), but can choose a different one
844846
Maybe individual enemy instances in an area can also specify their own loot table?

source/source/content/other/gui.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ bool GuiManager::handlePlayerAction(const Inpution::Action& action) {
12741274

12751275
} case PLAYER_ACTION_TYPE_MENU_OK: {
12761276
if(focusedItem && isDown) {
1277-
focusedItem->activate(Point(LARGE_FLOAT));
1277+
focusedItem->activate();
12781278
autoRepeater.start();
12791279
} else if(!isDown) {
12801280
autoRepeater.stop();
@@ -1283,7 +1283,7 @@ bool GuiManager::handlePlayerAction(const Inpution::Action& action) {
12831283

12841284
} case PLAYER_ACTION_TYPE_MENU_BACK: {
12851285
if(backItem && isDown) {
1286-
backItem->activate(Point(LARGE_FLOAT));
1286+
backItem->activate();
12871287
}
12881288
break;
12891289

@@ -1593,7 +1593,7 @@ bool GuiManager::tick(float deltaT) {
15931593
focusedItem->canAutoRepeat && focusedItem->onActivate
15941594
) {
15951595
for(size_t r = 0; r < autoRepeatTriggers; r++) {
1596-
focusedItem->activate(Point(LARGE_FLOAT));
1596+
focusedItem->activate();
15971597
}
15981598
}
15991599

source/source/content/other/gui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ class GuiItem {
375375

376376
explicit GuiItem(bool focusable = false);
377377
virtual ~GuiItem() = default;
378-
bool activate(const Point& cursorPos);
378+
bool activate(const Point& cursorPos = Point());
379379
bool addChild(GuiItem* item);
380380
bool deleteAllChildren();
381381
float getChildrenSpan(bool horizontal = false) const;

source/source/content/other/mob_script.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ size_t fixStates(
491491
stateIdx = INVALID;
492492
game.errors.report(
493493
"State \"" + state->name +
494-
"\" of the mob category \"" + mt->category->name +
494+
"\" of the mob type \"" + mt->name +
495495
"\" has an action to switch to an "
496496
"unknown state: \"" + stateName + "\"!",
497497
nullptr

source/source/core/options.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ namespace CONTROLS_D {
138138
//Default value for the auto-throw mode.
139139
const AUTO_THROW_MODE AUTO_THROW = AUTO_THROW_MODE_OFF;
140140

141+
//Default value for the fast inventory mode.
142+
const bool FAST_INVENTORY = false;
143+
141144
//Default value for the leader cursor speed.
142145
const float LEADER_CURSOR_SPEED = 500.0f;
143146

@@ -403,6 +406,7 @@ void Options::loadFromDataNode(DataNode* file) {
403406
cRS.set("cursor_speed", controls.leaderCursorSpeed);
404407

405408
cRS.set("auto_throw_mode", autoThrowModeChar);
409+
cRS.set("fast_inventory", controls.fastInventory);
406410
cRS.set("leader_cursor_speed", controls.leaderCursorSpeed);
407411

408412
for(unsigned char p = 0; p < MAX_PLAYERS; p++) {
@@ -651,6 +655,7 @@ void Options::saveToDataNode(DataNode* file) const {
651655
GetterWriter cGW(file->addNew("controls"));
652656

653657
cGW.write("auto_throw_mode", controls.autoThrowMode);
658+
cGW.write("fast_inventory", controls.fastInventory);
654659
cGW.write("leader_cursor_speed", controls.leaderCursorSpeed);
655660

656661
for(unsigned char p = 0; p < MAX_PLAYERS; p++) {

source/source/core/options.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ extern const AreaEditor::VIEW_MODE VIEW_MODE;
111111

112112
namespace CONTROLS_D {
113113
extern const AUTO_THROW_MODE AUTO_THROW;
114+
extern const bool FAST_INVENTORY;
114115
extern const float LEADER_CURSOR_SPEED;
115116
extern const bool MOUSE_MOVES_LEADER_CURSOR[MAX_PLAYERS];
116117
extern const bool MOUSE_MOVES_LEADER[MAX_PLAYERS];
@@ -301,6 +302,9 @@ struct Options {
301302

302303
//Auto-throw mode.
303304
AUTO_THROW_MODE autoThrowMode = CONTROLS_D::AUTO_THROW;
305+
306+
//Fast inventory mode.
307+
bool fastInventory = CONTROLS_D::FAST_INVENTORY;
304308

305309
//Inventory item shortcuts.
306310
string inventoryShortcuts[MAX_PLAYERS][4];

source/source/game_state/gameplay/inventory.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,19 @@ bool Inventory::handleAllegroEvent(const ALLEGRO_EVENT& ev) {
128128
* @return Whether it got handled.
129129
*/
130130
bool Inventory::handlePlayerAction(const Inpution::Action& action) {
131+
if(
132+
action.actionTypeId == PLAYER_ACTION_TYPE_INVENTORY &&
133+
action.value < 0.5f &&
134+
game.options.controls.fastInventory
135+
) {
136+
GuiItem* focusedItem = gui.getFocusedItem();
137+
if(focusedItem) {
138+
focusedItem->activate();
139+
} else {
140+
close();
141+
}
142+
return true;
143+
}
131144
return gui.handlePlayerAction(action);
132145
}
133146

source/source/game_state/gameplay/onion_menu.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -799,17 +799,17 @@ void OnionMenu::handlePlayerAction(const Inpution::Action& action) {
799799
switch(action.actionTypeId) {
800800
case PLAYER_ACTION_TYPE_ONION_CHANGE_10: {
801801
if(action.value >= 0.5f) {
802-
changeTenButton->activate(Point());
802+
changeTenButton->activate();
803803
}
804804
break;
805805
} case PLAYER_ACTION_TYPE_ONION_SELECT_ALL: {
806806
if(action.value >= 0.5f) {
807-
selectAllButton->activate(Point());
807+
selectAllButton->activate();
808808
}
809809
break;
810810
} case PLAYER_ACTION_TYPE_MENU_OK: {
811811
if(action.value >= 0.5f) {
812-
okButton->activate(Point());
812+
okButton->activate();
813813
}
814814
break;
815815
}

0 commit comments

Comments
 (0)