25 users online: AttentionDeficitDad, Bonobi, brickblock369, codfish1002, Darkanine,  Devazure, GrandMasterLynx, keaks, Knetog, kurtistrydiz, lincolnic,  LMNtals, Lyfah, MarsAmpere, NGB, Nowieso, Pink Gold Peach, RetroGamingSweden, Ringo, RPG Hacker, Samie Zuccati, ShUriK KiD, smwln, TheClassicOne88, underway - Guests: 116 - Bots: 171
Users: 55,665 (2,411 active)
Latest user: lincolnic

Item Box Time Cost

SMW Patches → Item Box Time Cost

Submission Details

Name: Item Box Time Cost
Author: Maarfy
Tool: Asar
Requires Free Space: Yes
Bug Fix: No
Featured: No
Description: This patch deducts a configurable amount of time from the timer when dropping the item box item with Select. There are three possible outcomes depending on the time cost and how much time remains on the timer (all three outcomes will drop the item box item):

- If the timer is greater than twice the time cost, the cost will be deducted from the timer
- If the timer is between the cost and twice the cost, the timer will be set to the cost value itself
- If the timer is less than the cost, the item will be dropped with no time deduction

This patch also allows enabling a nearby debug function that is otherwise overwritten. All code is fully commented.

Requested by Ondore's Lies.
Tags: item item box items lorom sa-1 time timer
Comments: 2 (jump to comments)
Download 2.07 KiB | 119 downloads


Comments (2)

 Major Flare Link
Remoderation tag removed, since the patch according to the section's standards.
 Telinc1 Link
This is a nice and small patch for those who want the item box to be harder to abuse. During the moderation, I fixed a small oversight which caused the debug code to never get called, even if it's enabled; the debug code isn't the main purpose of the patch and is unlikely to be used, which is why I decided it'd be quicker to just fix the oversight, especially considering how minor the fix is.

The routine which converts the timer to hexadecimal is very unoptimized. The dependency on $00, which is read and written during each iteration of the three loops, can be very easily removed because the accumulator is not used at all during the conversion. The positioning of the Item_Box_Time_Cost_SetAtCost label is also a little odd as it's in the middle of Item_Box_Time_Cost_ConvertTens but I assume that's due to branch distance. Finally, the hijacked routine returns to $00C592; $00C58F would be a better return address as it wouldn't skip an STZ instruction unrelated to the item box. I didn't manage to break anything because of the missed STZ and the new code isn't called often, so I didn't consider any of these rejection reasons.