News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: FF1 MMC5 Disassembly Updates  (Read 76200 times)

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #240 on: April 28, 2019, 03:49:52 am »
Somehow... Stealing is 90% done. I can steal a sword from an Ogre, at least. Right now I'm stuck on trying to get the messaging just right for failure. Then I need to test items, magic scrolls, and gold theft. Once those all work, all that's left is to give enemies things to steal!

Right now, I have no check for enemies being dead... When I do have that check in place, I intend to change the messaging to imply the thief is looting the dead body.

No real plans on making items show up after battle yet... But we'll see. I'm very surprised I got this far in just a few hours.

Quick Update: Weapons (and therefore I assume armors), items, and magic spells work. Gold needs some... extra work. Gotta split the table into two.... aaaand, that's a waste of space, but its working now so I'm gonna push it.

I've animated the stealing, and sometimes there's like... some kind of delay on showing the pixel location for the top half, so the thief looks like they're running all bent backwards, its hilarious.  :D

So, to play around with it, open up Bank Z. The last byte of the enemy data tables is the thing to steal. Then below it is a list. A byte of $00 means they have nothing to steal, so in the version I uploaded, only Ogres have something to steal (330 gold.) So go nuts and put a $04 at the end of the IMPs data and test it out...!
« Last Edit: April 28, 2019, 04:46:36 am by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #241 on: April 28, 2019, 01:09:19 pm »
...knowledge bomb...

Thanks a lot Disch! That really helped me out. :)



Somehow... Stealing is 90% done. I can steal a sword from an Ogre, at least. Right now I'm stuck on trying to get the messaging just right for failure. Then I need to test items, magic scrolls, and gold theft. Once those all work, all that's left is to give enemies things to steal!

Right now, I have no check for enemies being dead... When I do have that check in place, I intend to change the messaging to imply the thief is looting the dead body.

No real plans on making items show up after battle yet... But we'll see. I'm very surprised I got this far in just a few hours.

Quick Update: Weapons (and therefore I assume armors), items, and magic spells work. Gold needs some... extra work. Gotta split the table into two.... aaaand, that's a waste of space, but its working now so I'm gonna push it.

I've animated the stealing, and sometimes there's like... some kind of delay on showing the pixel location for the top half, so the thief looks like they're running all bent backwards, its hilarious.  :D

So, to play around with it, open up Bank Z. The last byte of the enemy data tables is the thing to steal. Then below it is a list. A byte of $00 means they have nothing to steal, so in the version I uploaded, only Ogres have something to steal (330 gold.) So go nuts and put a $04 at the end of the IMPs data and test it out...!

Sweet googlie-mooglie! I'm gonna try that out right away!

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #242 on: April 28, 2019, 03:51:32 pm »
Any thoughts on this?

I figure beast-like enemies and bugs and stuff wouldn't have anything. Its really hard to balance this out, when 50% of the gear is junk and the other 50% needs to be rare enough to be worth something...

Code: [Select]
IMP         ; 10 gold
GrIMP         ; Cap               
WOLF         ; *
GrWolf         ; *
WrWolf          ; *
FrWOLF          ; *
IGUANA          ; *
AGAMA           ; *
SAURIA          ; *
GIANT           ; Copper bracelet
FrGIANT         ; Silver bracelet
R`GIANT         ; X_Heal
SAHAG           ; Heal
R`SAHAG         ; Pure
WzSAHAG         ; X_Heal
PIRATE          ; Scimitar
KYZOKU          ; Falchion
SHARK           ; *
GrSHARK         ; *
OddEYE          ; *
BigEYE          ; *
BONE            ; Wooden staff
R`BONE          ; Iron staff
CREEP           ; *
CRAWL           ; *
HYENA           ; *
CEREBUS         ; *
OGRE            ; Iron hammer
GrOGRE          ; Silver hammer
WzOGRE          ; Ice 2 scroll
ASP             ; *
COBRA           ; *
SeaSNAKE        ; *
SCORPION        ; *
LOBSTER         ; *
BULL            ; 240 gold
ZomBULL         ; AICE scroll
TROLL           ; 255 gold
SeaTROLL        ; 880 gold
SHADOW          ; *
IMAGE           ; *
WRAITH          ; *
GHOST           ; *
ZOMBIE          ; Cloth T
GHOUL           ; 55 gold
GEIST           ; 85 gold
SPECTER         ; 180 gold
WORM            ; *
Sand W          ; *
Grey W          ; *
EYE             ; *
PHANTOM         ; *
MEDUSA          ; Soft
GrMEDUSA        ; Soft
CATMAN          ; Pure
MANCAT          ; Fire 2 scroll
PEDE            ; *
GrPEDE          ; *
TIGER           ; *
Saber T         ; *
VAMPIRE         ; X_Heal
WzVAMP          ; Ether
GARGOYLE        ; *
R`GOYLE         ; *
EARTH           ; Soft
FIRE            ; Smokebomb
Frost D         ; 2750 gold
Red D           ; 2750 gold
ZombieD         ; 5000 gold
SCUM            ; *
MUCK            ; *
OOZE            ; *
SLIME           ; *
SPIDER          ; *
ARACHNID        ; *
MANTICOR        ; 1250 gold
SPHINX          ; 1760 gold
R`ANKYLO        ; *
ANKYLO          ; *
MUMMY           ; Wakeup Bell
WzMUMMY         ; Wakeup Bell
COCTRICE        ; *
PERILISK        ; *
WYVERN          ; 1020 gold
WYRM            ; 1250 gold
TYRO            ; *
T REX           ; *
CARIBE          ; *
R`CARIBE        ; *
GATOR           ; *
FrGATOR         ; *
OCHO            ; *
NAOCHO          ; *
HYDRA           ; *
R`HYDRA         ; *
GAURD           ; Smokebomb
SENTRY          ; Smokebomb
WATER           ; *
AIR             ; *
NAGA            ; *
GrNAGA          ; *
CHIMERA         ; *
JIMERA          ; *
WIZARD          ; Bolt 2 scroll
SORCERER        ; Ether
GARLAND         ; Short sword
Gas D           ; 6720 gold
Blue D          ; 7690 gold
MudGOL          ; Fast scroll
RockGOL         ; Slow scroll
IronGOL         ; Iron armor
BADMAN          ; Silver armor
EVILMAN         ; Silver sword
ASTOS           ; Rub scroll
MAGE            ; Ether
FIGHTER         ; Fog 2 scroll
MADPONY         ; *
NITEMARE        ; *
WarMECH         ; ELIXIR
LICH            ; Phoenix Down
LICH (reprise)  ; Aegis Shield
KARY            ; Fire 3 scroll
KARY (reprise)  ; Ribbon
KRAKEN          ; Opal bracelet
KRAKEN (reprise); ELIXIR
TIAMAT          ; Dragon armor
TIAMAT (reprise); Masamune
CHAOS           ; ELIXIR
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #243 on: April 28, 2019, 10:28:54 pm »
Looks good!
In my notes for my hypothetical remake of Final Fantasy 1, I have planned out only getting gold and equipment from monsters that make sense to have them.
Beasts should only have natural items that you can sell for gil, like fur, fangs, and petals.
And I mean to the point that I'd make it so beast enemies wouldn't even drop gil from normal battle.

Anyway, you might want to think about starting to add new pieces of equipment to help pad things out not that the game supports up to 64 weapons and armors.

Speaking of new stuff, is it viable to expand the number of spells, too?

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #244 on: April 29, 2019, 12:08:42 am »
I'm gonna say... yeah, I could probably double the number of spells. I don't know about just adding a few extras, though. Might be a double or nothing type thing. The main issue is how to store them on each character, but there would be 64 bytes still free for that, if necessary. An idea would be to make one character stat byte be a switch for white/black or summon/time or something-- say a Red Mage knows Fire, Ice, and Cure, but then switch their magic toggle and the spells they know turn into Chocobo, Sylph, and Demi... Or I guess have it where so long as you've bought the spell at all, any class that can cast it, can. But I think that's kind of boring and less personal.

The other issue is... why add more spells when half the spells in the game are already pretty useless? Do we really need two versions of Lock, Slow, and so on? The whole start of this was an idea I had where lighting orbs boosted spells, so Fire would become as strong as Fire 2, then as strong as Fire 3, then almost as strong as Nuke by the end.

There's 2 unused consumable item slots... Pelt and Tooth? XD I can picture loading up on those and taking them to an NPC somewhere to exchange for new gear...

And yeah, I want to make some new equipment. I think this project is at the point where I can let it go. I'm going to add the Kick command for Black Belts and try to think of something for Fighters, MAYBE Red mages. Then bugfixes, bugfixes, bugfixes! Once its uploaded on the main site as an IPS, I'm going to break off and start working on my own... everything. Worry less about making Final Fantasy changes and just make the changes I want to see in an RPG.

I'll probably still be around to help code things other people come up with though, 'cos its kinda fun!
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #245 on: April 29, 2019, 02:39:28 am »
I'm gonna say... yeah, I could probably double the number of spells. I don't know about just adding a few extras, though. Might be a double or nothing type thing. The main issue is how to store them on each character, but there would be 64 bytes still free for that, if necessary. An idea would be to make one character stat byte be a switch for white/black or summon/time or something-- say a Red Mage knows Fire, Ice, and Cure, but then switch their magic toggle and the spells they know turn into Chocobo, Sylph, and Demi... Or I guess have it where so long as you've bought the spell at all, any class that can cast it, can. But I think that's kind of boring and less personal.

I'd say if it's double or nothing, then that's fine.
Even if all the extra spells aren't created right away, it still leaves a good space for those who want to get creative with it.

I think having it continue to work the way it currently does but with 2 more categories of spells would be ideal.
But, I agree that having spell learning be less personal would not be a good thing.



The other issue is... why add more spells when half the spells in the game are already pretty useless? Do we really need two versions of Lock, Slow, and so on? The whole start of this was an idea I had where lighting orbs boosted spells, so Fire would become as strong as Fire 2, then as strong as Fire 3, then almost as strong as Nuke by the end.

For my purposes, I'm planning to replace some existing spell effects and likely creating some entirely new ones as well.
I want to replace the White and Black Wizards with the Green Mage and Time Mage, so having more slots to work with will make things easier.
Right now I'd have to share too many spells between the various casters than I'd like.



There's 2 unused consumable item slots... Pelt and Tooth? XD I can picture loading up on those and taking them to an NPC somewhere to exchange for new gear...

That would be pretty cool.
Wish there was room for a few more.
If only 2, then I think Skin and Claw could more easily be associated with more types of creatures.



And yeah, I want to make some new equipment.

I was thinking that you could make most of the new equipment exclusively available through the Steal command.
That would give the command greater purpose without having to fully rebalance all the shops and chests.



I think this project is at the point where I can let it go. I'm going to add the Kick command for Black Belts and try to think of something for Fighters, MAYBE Red mages. Then bugfixes, bugfixes, bugfixes! Once its uploaded on the main site as an IPS, I'm going to break off and start working on my own... everything. Worry less about making Final Fantasy changes and just make the changes I want to see in an RPG.

Cool. I was kinda waiting for the master branch to get to that point before diving deeper in myself.
I still want to integrate all of Anomie and AstralEsper's work into the game.
And I look forward to seeing how your project develops! :D



I'll probably still be around to help code things other people come up with though, 'cos its kinda fun!

Awesome of you to do so!
If I can ask for one thing right off the bat, could you make sure that there is a slot for all 12 classes in the code for the Skill command? Being able to code new commands and just plug them in would be a great help. :)



PS-
Did you ever look into that thing I mentioned about the Battle Item slots only being tied to the weapon inventory and how that prevents some classes from being able to use certain armor-type items to cast spells because they can't normally equip them?

I figure the simplest thing would be to have one of the slots use the weapon inventory, and the other use the armor inventory.

Another way would be to let both slots access both inventories.
Either you could add in a menu like in the Magic screen that lets you switch between weapons and armor, or allow the select button to switch between the two inventories.

Or... you could do away with traditional item casting equipment and replace them with Relics.
All the equipment that used to cast spells would have those spells removed with these items being renamed or altered as needed.
Maybe even create new effects for them like stat bonuses or other enhancements.
Meanwhile, there would be one relic for each spell that used to be cast by regular equipment.
And maybe a few relics based on ones from FF6.
Yeah, crazy. :P
« Last Edit: April 29, 2019, 09:08:54 pm by Vanya »

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #246 on: April 30, 2019, 10:51:15 pm »
If only 2, then I think Skin and Claw could more easily be associated with more types of creatures.

Squeezing every last drop out of each chunk of save RAM... there's a fair bit more. Might require re-arranging key items and consumables again. Or just leaving those 2 consumable slots open and using key item slots. OR one of the 8-9 bytes of space just after one of the extra music stuff...? There's actually a lot of free save RAM for it, its just kind of spread all over...

If I can ask for one thing right off the bat, could you make sure that there is a slot for all 12 classes in the code for the Skill command? Being able to code new commands and just plug them in would be a great help. :)

How many skills do you think each class needs? Just the one? If so; done already on my end. If two or more, that's gonna change it up a bit...

Did you ever look into that thing I mentioned about the Battle Item slots only being tied to the weapon inventory and how that prevents some classes from being able to use certain armor-type items to cast spells because they can't normally equip them?

Whoops, I forgot. I wonder how easy it will be with the changes I made so armour isn't stored as $1-$40 now... At least shops won't have to try to guess which slot is holding which!

Did you see the icons I added to the equip menu screen? Wonder if they can be used instead of the "Right hand", etc, text. Did I miss if you uploaded your idea for the screen's layout?



Could maybe make room for a menu if it were arranged more like this... Then have each battle item have like a switch beneath it or something...

Relic idea is neat; but definitely something for a "this is no longer your grandma's FF1" branch XD



So I read that Kick is calculated by dividing attack by the amount of enemies alive... There's just the problem again of division and how.

I altered this bit from the code that divides EXP among the living party members:

Code: [Select]
   @Divide:
   ;; divide damage among all existing enemies; number stored in Y
   ;; tmp holds ch_damage, tmp+1 is 0
          @divisor =    $84
          @remainder =  $85
     
    STY @divisor                ; Y (the number of living enemies) is the divisor
    LDA #$00
    STA @remainder              ; zero remainder
   
    LDX #8                      ; loop 8 times, one for each bit of the dividend
   
    ROL tmp                     ; roll out the high bit of the sum into C
    ROL tmp+1
  @DivLoop:
    ROL @remainder              ; roll bit into remainder
   
    LDA @remainder
    CMP @divisor
    BCC :+                      ; once the remainder >= divisor
      SBC @divisor              ;  ... subtract divisor
      STA @remainder
  : ROL tmp                     ; roll 1 into result (if subtracted)
    ROL tmp+1                   ; or 0 into result (if didn't subtract)
    DEX
    BNE @DivLoop

But tmp does not need to be 2 bytes... so how would I make this shorter? Just... remove the ROL tmp+1s?
I know exactly what I'm doing. I just don't know what effect it's going to have.

Disch

  • Hero Member
  • *****
  • Posts: 2723
  • NES Junkie
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #247 on: April 30, 2019, 11:14:33 pm »
Quote
But tmp does not need to be 2 bytes

.... are you sure?  If tmp is one byte that caps TOTAL (pre-division) damage at 255.  That would make this pretty useless about 1/3rd of the way through the game.

But yeah if you are okay with that, then removing the ROL tmp+1 lines will shave 4 bytes.

Also, CMP is basically a glorified SBC so you can trim off another byte by combining those:

Code: [Select]
...
    LDA @remainder
    ; OLD CODE
;    CMP @divisor
;    BCC :+                      ; once the remainder >= divisor
;      SBC @divisor              ;  ... subtract divisor
;      STA @remainder

    ; REPLACE WITH (1 byte shorter)
    SEC
    SBC @divisor
    BCC :+
      STA @remainder
     
  : ROL tmp                     ; roll 1 into result (if subtracted)
...

Also there appears to be an existing division routine in Bank C -- which looks almost exactly like this one (see DoDivision and YXDivideA).

Maybe just rip this code out entirely and call that?

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #248 on: May 01, 2019, 12:17:02 am »
Ohhhhhh... right, battle stuff DOES have division routines already there!

How does this look?

Code: [Select]
    LDX #9                      ; max amount of enemies
   @Loop:
    LDA btl_enemyIDs, Y         ; check each slot
    CMP #$FF                    ; if its $FF, decrease X
    BNE @EnemyExists
   
   @NoEnemy:
    DEX
   
   @EnemyExists:                ; go through all 9 slots
    INY
    CPY #9
    BNE @Loop
   
    LDY #ch_level - ch_stats    ; backup character level
    LDA (CharStatsPointer), Y
    STA tmp+1
   
    LDY #ch_damage - ch_stats   ; get character damage
    LDA (CharStatsPointer), Y
    STA tmp                     ; store in tmp
   
    TXA                         ; put living enemy amount in A
    LDY #0                       
    LDX tmp                     ; and damage in X
    JSR YXDivideA
   
    ; A = result... should be damage / enemy count
    CLC
    ADC tmp+1                   ; add level
    STA btlmag_effectivity      ; that's the kick's effectivity!
   
    JSR Battle_PlayerMagic_CastOnTarget     ; And actually cast the spell
    JMP Battle_EndMagicTurn                 ; End the turn


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;  YXDivideA  [$AA1B :: 0x32A2B]
;;
;;  A = YX / A
;;  X = YX % A
;;
;;  divHi has the high byte of the division result (but it's never used)
;;
;;    As with 'DoDivision', you'd think this routine would be used more, but it's only used
;;  for formatting HP for printing.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

YXDivideA:
    STA btltmp_divV
    STX btltmp_divLo
    STY btltmp_divHi
    JSR DoDivision
    LDA btltmp_divLo
    LDX btltmp_divV
    RTS

I'm not sure what divV and all that means. Or if I want the output to be the percentage or... what.

I basically hijacked the magic casting code to have the Kick command attack all enemies. So I want to try to get the damage effectivity to work the same as damage would for a physical attack. I'm pretty sure I'm the least qualified for balancing this kind of thing!

Edit: Seems to work! Damage of $26 against 5 enemies comes out to $07. +level is a bit much maybe, so now its +level/2. So at level 12, that comes to an effectivity of $0D, which is still more than enough to kick all the sahagin butt. Except maybe kicks should somehow miss sometimes...? >.< Or maybe use MP...

And what should the formula be for steal success? Something to do with thief speed vs. enemy evasion? But I don't really know how to smash the two numbers together and decide what creates a win state.
« Last Edit: May 01, 2019, 12:53:12 am by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #249 on: May 01, 2019, 03:53:18 am »
Except maybe kicks should somehow miss sometimes...? >.<

Yes! Definitely, yes!


Or maybe use MP...

No! Definitely, no!


And what should the formula be for steal success? Something to do with thief speed vs. enemy evasion? But I don't really know how to smash the two numbers together and decide what creates a win state.

I can help with that actually. I have compiled a lot of research into the mechanics of many of the FF games. Let me look through my notes and I'll get back to you on this tomorrow at a more decent hour.


About the number of skill commands.
One each is what I was thinking as far as staying in line with the early FF games.
Ultimately, and ideally, I'd like it to function more like FF3.
It would definitely be useful to others to be able to have unconventional set ups for each job; like how the Black Mage in FFX-2 has no FIGHT command and instead must rely on magic entirely.

Hmmm... I do have one criticism of the current set up, though.
Having a command that just contains another single command is a redundant.
It's basically just an extra step.

Taking into consideration the goal of this project and our own personal goals, with regards to what we want to do with it in our own branches, I recommend updating the command window to support command configurations on a per class basis.
And instead of having a skill command, each class can have it's own command that can either have a single direct use or pull up a short list of individual skills (Maybe 4 skills max to allow for longer names).


About the equipment screen...

Yeah! I saw the icons.
They're pretty cool, but I don't think I prefer them replacing the slot text.

Actually, I just noticed that the item names are still the same length as in the original game.
Can these be expanded to 10 characters?
The shops would have to be modified a bit, but everything should fit.
The Gear command window would definitely need to be widened.




EDIT:

OK.
I looked through all the documents I have on the mechanics of the first 6 FF games in reference to the Steal command's workings.
Except for FF5 they all pretty much work based on the thief's level vs the target's level.
FF5 is different because it is a Hit% check with a flat 40% chance of success (or 80% if using the Thief Glove).

Before I give a recommendation, let's talk about the relevant stats in FF1.

Agility is used For exactly 2 things.
It factors directly into Evade%.
And it factors into the chance's of getting Ambushed or a Preemptive Strike.

Luck was originally only factored into FLEE and Ambush/Preemptive.
The chance to run is bugged.
IIRC you used Luck as a factor in turn order and that is why you renamed it Speed, correct?

The way Ambush/Preemptive works is based partially on the lead character's Agility and Luck/Speed.
The document I use calls this Initiative.
Initiative = (Agility + Luck)/8.
It might better to have this value displayed on the status screen and to use it for turn order instead of just using Luck/Speed.

I recommend a bit of an overhaul to how these starts are used and what they are named:

Agility -> Dexterity
- Instead of directly factoring into Evade%, it should factor into Hit%.
(This will probably require that each class's fixed increase to Hit% be reduced.)
- It might be a good idea to have it factor into spell Hit% as well.

Luck/Speed -> Agility
- Have it factor into M.Evade% (aka Magic Defense).
(This will probably require that each class's fixed increase to M.Evade% be reduced.)
- Fix bug and have it properly factor into the Run command.
- Have it factor into Evade% instead of the old Agility stat.

N/A -> Initiative
- Use the same formula as in the Ambush/Preemptive calculations.
- Use it as a factor in turn order instead of Luck/Speed.
- Use it in the Ambush/Preemptive calculation.


Now as for the Steal command, I recommend using the existing Accuracy calculation.
- If the target has no item, end the routine and show the 'has no item' message.
- If the target has an item, make an accuracy check to see if the thief can get passed the target's defenses.
(Use the standard accuracy calculation; Attacker Hit% vs Target Evade%.)
- If the accuracy check fails, end the routine and show the 'failed to steal' message.
- If the accuracy check succeeds, then do a skill check to see if the theft succeeds based on the attacker's level and or thief level.
- If the skill check fails, end the routine and show the 'failed to steal' message.
- If the skill check succeeds, add the item to inventory and show the 'stole X item' message.

The skill check itself would be based on either character level*2 or (character level + thief job level) vs a random [0...99] roll. If skill check < random roll, steal succeeds.

There are probably quite a few things that could be done in the battle code to modernize and probably simplify how certain things work. Status immunity for example.

Here is a link to the reference document I use for FF1:
https://gamefaqs.gamespot.com/nes/522595-final-fantasy/faqs/57009
« Last Edit: May 01, 2019, 06:58:06 pm by Vanya »

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #250 on: May 01, 2019, 09:23:28 pm »
That's a lot to process! Quick question... what's "clamped" mean? The link mentions it too, under the Bugs list:

Quote
*Hit% should be applied even if asleep, and not clamped until after evade is
 subtracted.

I know I fiddled with that part in the physical attack code... regarding the asleep part, maybe. Gah. That whole section is such a mess. It really needs to be spliced up into some smaller routines that can be re-used.

Right now I can't really change how Kick works. Making it a 65th spell is so much easier than writing a whole new attack routine that does all those calculations but prints messages differently... >.< Just another Big Ol' Project to tackle someday.



Edit: This is a list of the bugs on that link, and if I smushed 'em or not:

Code: [Select]
*The Ribbon's name has an extra space

Fixed.


*The Airship can land on the caravan.

Not Fixed.


*There are two Canoe items. One shows up in the menu but doesn't do anything,
 and the other works, but doesn't show up in the menu.
 
Fixed.
 
 
*House saves before restoring MP. Also needs message corrected.

Fixed.
 
 
*BB Armor bug, it looks at whether a weapon is equipped instead of checking
 armor.
 
Fixed.
 
 
*The game never actually calculates Damage Rating from STR, it just
 adds/subtracts weapon damage as you equip/unequip things. For the BB/MA, it
 does recalculated Damage based on STR when the BB/MA has a weapon equipped,
 but rounds *up* instead of *down* when adding STR/2 to the Weapon's Damage.
 
Not sure if bug? Not sure if there's a way to change how doing "LSR A" on
ch_strength rounds up or down. If this is a bug, what would the fix be?
 
 
*BB Magic Defense Growth is +4, while MA Magic Defense Growth is +1. Several
 other values are suspect and there is evidence others may be bugged.
 
Fixed by giving Masters a +4. Reasoning is that I view these classes as
"anti-magic"; they're the only one not to learn magic on job advancement,
and defending against it seems a very monk thing as well.
 
 
*The RM/RW gains a tenth L1 spell charge at Level 35. The bug is probably an
 erroneous gained L1 spell charge at Level 22.

Fixed: removed L1 spell charge at level 35.
 
 
*The "swap" function used when character order is rearranged after battle is
 passed the original slot numbers rather than the current slot numbers, causing
 incorrect ordering in 106 of the 256 possible combinations of statuses.

Fixed, 90% sure.
 
 
*A phantom door will appear if you exit the menu while standing in a doorway
 and then walk down.

Not fixed.

 
*NPCs can walk through you under certain circumstances.

Fixed on exiting shops; which was an issue of my own creation. Not sure what
other circumstances there are... (Exiting the submarine?)


*The data from the last enemy domain area you were in is used when you get into
 a battle (on the Overworld?). 

Not fixed.
 
 
*The Peninsula North East of Pravoka (PNEOP) is the result of overworld
 mapping, whereby the monsters from the zone primarily overlaying the area
 around Lufein overlaps on a few tiles. There isn't really any fix other than
 remapping the terrain.
 
Not fixed.
 
 
*Target-dark should not be applied when the target is asleep/stopped.

Not fixed?


*Hit% should be applied even if asleep, and not clamped until after evade is
 subtracted.
 
Not sure how to tell if fixed.
 
 
*Weapon category/element attack values are never loaded.

Fixed.


*Weapon index is used for critical value.

Fixed.


*Enemies use their category/element as a category/element attack, and the
 warrior's category/element attack as the category/element to attack.
 
Not sure what this is saying exactly... But...
Enemies use their elemental RESISTANCE as their attack element now. (For now.)
Players use their weapon's element.
 
 
*The player class is used as the creature type when magic is cast. Fortunately,
 only HARM uses it and no class has bit 4 set.

Seems not to be an issue and may be fixed anyway (player magic defender
category is set to 0.)
 
 
*Weapon elemental attack is used as elemental weakness when magic is cast.

Fixed? Players have elemental reistance and weakness set to 0 every time
equipment is updated.


*Running looks in the in-battle data instead of the permanent data.

Fixed.


*MUTE status prevents Item and Drink as well. This is likely a bug, as
 preventing drink makes no real sense. Whether it should also prevent Item
 usage is uncertain.
 
Fixed. Items and Equipment can be used while muted.
 
 
*If you gain enough experience in one battle for one of your characters to gain
 2 or more levels, you only gain one level at a time even if you get enough exp
 for 8 levels, and your "For Level Up" value is all wrong until you manage to
 gain levels up to your exp.
 
Not fixed. Tried to once and got the game messed up. Might work now if we try.
 
 
*Status attacks are attempted on misses after the first successful hit

Fixed.


*Enemies always wake from sleep.

Fixed.


*Enemy-cast all-allies spells (e.g. AFIR) don't hit the caster.

Fixed.


*Poison doesn't work on enemies.

There is no spell that poisons enemies. A whole new routine would need to be
written for it.


*In the 2-large-6-small enemy formation the third enemy type will use the
 palette set for the second enemy type rather than the palette set for itself.
 
Fixed.
 
 
*If an enemy kills itself (because it was Confused), the battle won't actually
 end until either one of your warriors tries to attack or cast magic on an
 enemy or the round of battle ends.
 
Fixed.
 
 
*INT is never used.

Not fixed.


*HEL2 effectivity should be 0x18.

Fixed.


*LOK2 should use effect 0E instead of 10.

Fixed.


*LOCK (and fixed LOK2) always misses.

Fixed.


*TMPR should probably be using effect 0B instead of 0D.

Fixed.


*For PC targets, Damage and Hit% are never loaded/saved for use by magic. Thus,
 TMPR and SABR are bugged.

Fixed.

 
*Absorb for enemy targets is loaded from ROM instead of RAM for magic, making
 FOG not work.

Fixed.

 
*For enemy targets, Hit% is never loaded/saved for use by magic.

Fixed.


*Enemy elemental resistance is not stored in the in-RAM data, so spells like
 AFIR and XFER don't work.
 
Fixed? I'm still confused about how this should work; I mention it all over the
place where elemental weakness and resistance is used.

 
*Several caster bytes are loaded for magic, with wrong values. But none are
 actually used.
 
Fixed.
 
 
*Spells causing multiple status ailments will claim "Ineffective" if the target
 has any of the ailments (all will still be applied though).
 
Might be fixed, but probably not!
 
 
*There is an invisible lady in Coneria Castle. Her sprite is set to be visible
 inside rooms, when it should be set to visible outside rooms.
 
Not fixed.
 
 
*There is a Bat in the Waterfall that starts on a wall, leading it move into
 the wall area half of the time.
 
Not fixed.


*There is a Fairy sprite in the black area of the Ice Cave (though this is not
 noticeable during normal gameplay).
 
Not fixed.
 
 
*The old man next to the submarine in Onrac uses "Wind Orb Lit" as a condition
 for changing dialogue when it should probably be "Water Orb Lit"

Not fixed.
 
 
*The Sage at 3:00 in the Circle of Sages in Crescent Lake is supposed to use
 Text 9D, but lacks a condition. This should probably be "All Orbs Lit"
 
Not fixed.

 
*The routine that looks at the tile data and determines whether to use the
 second byte as a message index or not says "not" for far too many values. The
 effect is that you can talk to the Earth and Water Altars, but not the Fire
 and Wind.
 
Not fixed.
 

*The Gaia Spring Tile is unused.

Not fixed. Is it a bug or just something unused?


*There is an unused Warp Tile in the ToFR Tileset that looks like the Time Warp
 in the ToF Tileset. Its absence may or may not be a bug.
 
That's a thing!

« Last Edit: May 02, 2019, 12:09:35 am by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

Disch

  • Hero Member
  • *****
  • Posts: 2723
  • NES Junkie
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #251 on: May 01, 2019, 09:32:12 pm »
IMO  Sleep/Stun should be a guaranteed hit unless you're Dark/Blind.  Even the most incompetent fighter can land a blow on a stationary target.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #252 on: May 02, 2019, 03:09:04 am »
@Disch: I agree.

@Jiggers: Thanks for that list! It helps a lot.

Clamped means that you check a value to see if it is above a given maximum and if it is above that maximum you set the value to the value of the maximum you checked for.

It usually works like this.
Code: [Select]
If (x > 10)
{ x=10;
}

Thus if x in the above example was previously set to 20, then this code would clamp it at 10 by setting it to 10.

So what is happening in the original code is that it is doing this clamping earlier than it rightly should.
And that can lead to some unintentional penalties to attackers with higher hit rates when fighting targets with lower evade rates.

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #253 on: May 03, 2019, 02:53:25 am »
Ohhh, just capping then. I get that.

Code: [Select]
Having a command that just contains another single command is a redundant.
It's basically just an extra step.

Yeah, but I figured it was safer to experiment with a new box than the command box. XD Also the command box is called at various points... So the code to figure out what text to draw in that spot would need to be in the fixed bank, which is low on space. Need to find routines in there that can be moved out. Looks like 123 bytes left.

Quote
IIRC you used Luck as a factor in turn order and that is why you renamed it Speed, correct?
Yep. I'm also pretty sure my new turn order thing is screwy. Just a feeling I get while play testing...

I'm having kind of a mental block right now trying to parse the skill check stuff in your other post. I don't really know what it is... like I'm psyching myself out of understanding it. See my "update" to Bank C for instance. I look at my fix to the running away code and... it seems to me like the higher your level, the harder it is to run?? Am I understanding it right and catching a dumb mistake I made back then, or is it right and I'm just confusing myself looking over it again? But its like that with all the stat vs. stat stuff I see lately. I think I might be better off leaving you to it with the battle code!

I wanted to make stealing be a whole system that contains every item in the game, but I think I'll re-do it from nearly scratch. Instead of the list being in order of items, it would be in order of enemies. Imp would be 0, GrImp would be 1, and so on. That way there's only $7F entries, and even if most of them are the same (no item listed) it would be simpler to edit. Rather than changing the byte in the enemy table, you'd just change the byte in the stealing table, the way I have treasure chests set up.

One thing with enemies... I really wish I could figure out how to expand their RAM use past $100. They have 28 bytes of stats each now, and I love the idea that every single one of those can be changed, but a few of them have no need to be changed, I guess? Experience, gold, AI... I don't know which would be easier, to take them out of RAM or make their RAM space bigger. I want to add a proper speed stat for turn order, a steal difficulty/rarity stat...

Rambling now, but I want to make it so an enemy has 2 possible things to steal, and getting a crit-steal gets the rare item. That would be a 1/256 chance pretty much, and rather than having the item byte be the item ID it'd just be an off/on trigger. $10 for rare items, $01 for normal.

So anyway--one of these days I'll try harder to power through and organize the physical attack stat vs. stat stuff better, maybe. Meanwhile, battle items can be weapons or armor! That is live.
I know exactly what I'm doing. I just don't know what effect it's going to have.

daman.tm

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #254 on: May 03, 2019, 06:59:08 am »
I just want to let you guys know what you're doing is absolutely amazing! This is literally the only thread I check daily because the changes you guys are making are awesome, and seeing the code is beyond fascinating!

Keep up the amazing work!

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #255 on: May 03, 2019, 10:16:29 pm »
Thank you! That's really nice to hear; it really helps to know there's more people looking forward to this getting done!

And an update:
I fixed spell messages not displaying right (I changed the variable, but the code was using the raw address and not the variable name)

Aaaand, enemy gold and experience is now in its own spot in memory, so that's 4 more bytes of enemy RAM stats. I went ahead and added speed and stealing difficulty to their data, but they're all 0 so far and not loaded up in battle yet.

Quick update: I set speed stats for all the enemies and adjusted the turn order randomization routine. It may need more tweaking. Gotta get like a spreadsheet of player luck/speed numbers for each level and figure out where the enemies show up and adjust their speed based on that... maybe.
« Last Edit: May 03, 2019, 10:36:52 pm by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #256 on: May 04, 2019, 03:24:58 am »
Hey all. Just popping in to let you guys know I'm going to be without internet for a few days.
I got the latest zip from the github page and I'll mess with it and see if I find any bugs while I wait for my service to be back up.

I'll be back to give proper replies soon.

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #257 on: May 06, 2019, 02:18:58 am »
No worries!

I coded in the Fiend Battle music, but there's a few things...

* I'm still not happy with the triangle channel bassline in the beginning...

* Due to the way tracks are loaded, we're already at the maximum number of songs? Every song's 5 tracks are loaded by multiplying the song's ID by #10. $19 * $0A is $FA. I don't know what will happen if that goes over $FF.

* I thought this was why the music wasn't working in battle, so I removed the unused tracks. So in the sound test menu (B+Select in towns, dungeons, etc) the new song is still listed as "Healing (Unused)"

* "Treasure (Unused)" now plays some wicked death metal or something. I just realised I messed up counting the tracks so the new song can be ID $19 after all. So I'll fix up the sound test menu stuff later and put the unused tracks back in place.

* Lastly... Math is REALLY HARD SOMETIMES. So track 5 of the boss battle music--square channel 4--is not playing properly. After 2 loops its noticeably off. I'm just not sure how or where. I can't even really tell if its late or early. AND I JUST FOUND IT. There's a part where it goes $79, $78, $79... And its supposed to be $79, $89, $79!  :banghead: And I was wondering why that part sounded off, but I thought it was just the duty of the square or something...


And an MP3 here! https://cdn.discordapp.com/attachments/527351555779723266/574840396576980997/FiendBattle.mp3
I know exactly what I'm doing. I just don't know what effect it's going to have.

Disch

  • Hero Member
  • *****
  • Posts: 2723
  • NES Junkie
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #258 on: May 06, 2019, 02:39:29 am »
* Due to the way tracks are loaded, we're already at the maximum number of songs? Every song's 5 tracks are loaded by multiplying the song's ID by #10. $19 * $0A is $FA. I don't know what will happen if that goes over $FF.

This really shouldn't be an issue.  Multiplication gives you a two byte product, right?

Untested pseudo-code:
Code: [Select]
LDA song_id
LDX #10
JSR MultiplyXA
CLC
ADC #<song_pointer_table
STA tmp
TXA
ADC #>song_pointer_table
STA tmp+1

LDY #0
@Loop:
  LDA (tmp),Y
  ; ... read the channel pointers from (tmp), using Y as index

daman.tm

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #259 on: May 06, 2019, 04:10:37 am »
Holy moly I'm loving the fiend battle track!
Nice work!