Romhacking.net

Romhacking => ROM Hacking Discussion => Topic started by: Jiggers on January 04, 2019, 05:36:47 am

Title: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 04, 2019, 05:36:47 am
Hi! This is a project I've been working on for... I think 2 years now? It upgrades Final Fantasy 1 to use the MMC5 mapper... then goes crazy with what I hope are improvements to the game. It's based of Disch's FF1 Disassembly. He did a bunch of things to help get me started with it. I've done my best to credit a few other people as well.

https://github.com/JiggeryPonkery/FF1-MMC5 - Here is the newest versions maybe.

Everything below this line is kinda old and not updated.



Here is a zip file with the entire project.
https://drive.google.com/open?id=1G699Vc47Qr5he4zcBEi2JPTdc0a9h14n

Updated 15/01/2019

(I don't know what other emulators will work besides Mesen by the way...)

This is far from finished, but I've hit a wall and need help again. Before I get into that... I should apologize for how long this is. Wow. Sorry!

General Changes

Battle Changes

Audio Changes

ASM Changes

Changes I'd Like To Make

Known Bugs

Maybe Bugs

Why?
I've had a lot of fun tinkering with ASM doing this project. FF1 is a simple, classic game that's surprisingly easy to tweak and full of incomprehensible coding choices that make it frustrating to impliment those fun tweaks. Originally I was going to use FF1 as a base for a whole other RPG world--but, you know, fitting a whole cat person sprite into 16x16 pixels is hard when you have no idea what you're doing.

So I abandoned my original goal and focused on doing little quality of life upgrades. I see a lot of people wanting to get into hacking by doing pure hex editing or using FFHackster, and I want to provide an alternative, to give people a deeper understanding of how the game really works. The switch to MMC5 allows for experimentation that simply wasn't possible in the crammed MMC3 format. I want other people to experience this! My code can be as hopelessly messy as it takes to get my ideas down before I have the skills to trim it down and speed it up. Your code can be that, too! Using this project as a base for your own ideas, you too can learn Assembly and put together all those "wouldn't it be nice if FF1 had..." ideas!


And again... many thanks to Disch, Gil Galad, Lenophis, anomie, and everyone else whose helped out by trailblazing this silly game's code and data jungles and providing little (and huge) improvements!
Title: Re: FF1 MMC5 Updates
Post by: Bregalad on January 04, 2019, 05:47:40 am
Nice ! At first I tought this would be yet another shitty uninteresting mapper hack, but no you really planned to use the MMC5 so this is great. Perhaps a better name than "FF1 MMC5" would make up for the concept a little bit better. Keep up the good work !!

EDIT: Also please PLEASE use a patch, not a ROM ! This is very important !
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 04, 2019, 03:49:34 pm
WHOOPS. Forgot about that. Deleted the rom from the zip file now. Thanks for the reminder!

I'm not good with names. But since it is an "upgrade" from Disch's disassembly, I guess throwing that word in there would help? Its not really meant to be a patch, just the source code and the tools needed to piece it together. Is that still legal...?
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Mari42 on January 04, 2019, 04:49:08 pm
This is a fantastic way to make alot of improvements even better. I'm looking forward on this one despite the fact that this is for beta (I believe, if its unfinished). So does the ATB. That is WAY better of what it should've been for all future FF games. Im saying this, because im a fan of FF. So, this massive improvement does very well done.  :thumbsup:
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Orochi Kusanagi on January 04, 2019, 05:15:36 pm
This is some amazing work!
Title: Re: FF1 MMC5 Disassembly Updates
Post by: A.D.R.I.A.N on January 04, 2019, 08:39:34 pm
Guess my idea of a gil-stealing Thief finally became reality. Truly, well done!
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 06, 2019, 12:36:10 am
Aw, thanks!

I did some more work on the hiding stuff. As far as I can tell, all hiding bugs are FIXED! The stat boosts are now in effect. I mean, I think they are. I haven't actually super tested it yet...

I tracked down the "everyone uses character 4's items" bug to this area:

Code: [Select]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;  BattleDrawLoadSubSrcPtr  [$FC00 :: 0x3FC10]
;;
;;  input:       XA = 16-bit pointer to the start of a pointer table
;;
;;  output:  btldraw_subsrc
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

BattleDrawLoadSubSrcPtr:
    STA $97             ; high byte of pointer table
   
    JSR DrawBattle_IncSrcPtr
    LDA ($90), Y        ; get the desired index
   
    ASL A               ; multiply by 2 (2 bytes per pointer)
    PHP                 ; backup the carry
    STA $96             ; use as low byte
   
    TXA                 ; get X (low byte of pointer table)
    CLC
    ADC $96             ; add with low byte of index
    STA $96             ; use as final low byte
   
    LDA #$00            ; add the carry from the X addition
    ADC $97
    PLP                 ; also add the carry from the above *2
    ADC #$00
    STA $97             ; use as final high byte
   
    LDY #$00            ; get the pointer, store in btldraw_subsrc
    LDA ($96), Y
    STA btldraw_subsrc
    INY
    LDA ($96), Y
    STA btldraw_subsrc+1
   
    RTS

I'll need to go over this a bunch more to see just what's causing it, but once it gets out of here it starts drawing up the text for the "Small @Knife" my black mage has...

I also got distracted and made magic sprites move towards enemies! So that was a fun 5 minutes where nothing went wrong.

There was a bug I forgot about where you could choose a blank spot under Hide and Flee and crash the game. That's been fixed.

For testing purposes, the random roll when doing a critical hit to see if you do the special attack has been removed--every time you do a critical hit, it should do the special attack. If it doesn't, then something's broken. Note that fighters are OP and have no special attacks (unless you go enable the Cleric thing in Bank Z, which should let them mow down undead and were creatures...)

Um... at the moment stealing gold crashes the game. I'm sure it has to do with undrawing battle blocks. I only changed a $02 to a $03...? I'll try to fix it tomorrow. This now works. All special attack messaging should draw properly!

I also fixed up the battle message and enemy name LUTs to be editable. Was going to expand the level up data for 12 classes, but there's not enough room in Bank B for that. Will look into moving that data safely to another bank.

.zip file in main post is updated with changes!
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on January 07, 2019, 05:52:49 am
This is pretty awesome.
It could be a very good basis for a more complete battle system overhaul to bring it up to par with FF3.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 09, 2019, 03:24:15 am
Updated the Enemy Regeneration routine and Player poison routine! Players take 1/8 max HP in damage from poison, making it actually scary in battle. 8 turns to cure it or dead!

Enemies... Enemies do this. I am not sure if it works, but if it does, I think it should regenerate a little under 1/10th their max HP per turn. So... WarMech real scary. Anything much lower than that and common enemies are push-overs. (It's still better than 2 HP per turn.)

Code: [Select]
LDY #ENROMSTAT_HPMAX
    LDA (@rom), Y
    STA math_basedamage
    STA btl_mathbuf+2
    INY
    LDA (@rom), Y
    STA math_basedamage+1
    STA btl_mathbuf+3
   
    LSR math_basedamage+1   ; divide by 2
    ROR math_basedamage
    LSR math_basedamage+1   ; divide by 2
    ROR math_basedamage
   
    LDA math_basedamage
    STA tmp
    LDA math_basedamage+1
    STA tmp+1               ; tmp is now 25% max HP
   
    LSR math_basedamage+1   ; divide by 2 again
    ROR math_basedamage     ; math_basedamage is now 12.5% max HP
       
    LDA math_basedamage+1   
    CLC
    ADC tmp+1
    STA math_basedamage+1
    LDA math_basedamage
    CLC
    ADC tmp                 ; math_basedamage is now 37.5% max HP?
    STA math_basedamage
   
    LSR math_basedamage+1   ; divide by 2 again
    ROR math_basedamage     ; math_basedamage is now
    LSR math_basedamage+1   ; divide by 2 again
    ROR math_basedamage     ; math_basedamage is now 9.??% ? 

Both poison and regeneration will now message between turns.

I also fixed a bug where poison would be displayed by the stone icon out of battle, because for some reason they thought it best to shift poison from $04 to $03??? Rather than worry about why they did that, I just added a few more bytes to my code that draws the proper icon.

Currently working on buying more than 1 item at a time.

Question: Using the MMC5's multiplication registers, how would you multiply a 24-bit number by an 8-bit number? I'm completely stumped. I would prefer it if it could do it on the fly, so to say. I have room for a stupidly large LUT, so that's an option, but people would have to change the LUT if they change an item price... And you can't buy more than 21 houses without going over the 16-bit limit for how the game handles buying. Hell the price for 99 houses won't even display correctly in the main menu...

I guess since no item is over 16-bits to start with, I only have to multiply so that the result FILLS 3 bytes... Still no idea how to do that.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Bregalad on January 09, 2019, 08:26:29 am
Question: Using the MMC5's multiplication registers, how would you multiply a 24-bit number by an 8-bit number? I'm completely stumped. I would prefer it if it could do it on the fly, so to say.
You do it like you multiply a 3-digit number by a single-digit number in real life. This requires 3 multiplications and 3 additions.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 09, 2019, 10:58:33 pm
I need a bit more help. I spent all day on this. I just don't understand the logic... What am I missing?

Code: [Select]
BuyLotsPrice:
    LDA #0
    STA MMC5_tmp+6 ; clear this first
    LDA shop_curitem
    JSR LoadPrice ; gets the price of the item you're trying to buy
    ; tmp, tmp+1, and tmp+2 now carry the price...
    ; MMC5_tmp carries the amount
    ; when using MultiplyXA
    ; A = lower 8 bits (automatically saved to MMC5_multiplyA)
    ; X = higher 8 bits (automatically saved to MMC5_multiplyX)
    LDX MMC5_tmp        ; quantity
    LDA tmp             ; low byte of price
    JSR MultiplyXA
    STA MMC5_tmp+2      ; low byte of combined price
    STX MMC5_tmp+3
   
    LDX MMC5_tmp        ; quantity
    LDA tmp+1           ; middle byte of price
    JSR MultiplyXA
    STA MMC5_tmp+4      ; middle byte of combined price
    STX MMC5_tmp+5
   
    LDA MMC5_tmp+4       
    CLC
    ADC MMC5_tmp+3
    STA MMC5_tmp+4
   
    LDA MMC5_tmp+5
    ;CLC                ; do I need this?
    ADC MMC5_tmp+4
    STA MMC5_tmp+5
   
    LDA MMC5_tmp+6      ; saving carry from last addition
    ADC #0
    STA MMC5_tmp+6
   
    RTS

Code: [Select]
            high mid  low
99 x 3000 = $04, $88, $28
98 x 3000 = $04, $7C, $70
^ my tests...

https://imgur.com/a/RUS2lad - I arranged the things so I can see what's going on with the numbers in memory. Should I be using the high bits of the second multiply for the high byte of the combined price? That would work to make those two tests work, but then at 93 houses, it comes to: $04, $41, $D8 -- except then the high bits from the last multiply are $03...

I just really confused... I'm not a math person. I don't know the steps. I lucked into getting this close by trying stupid things until it got close with a few difficult patterns.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on January 09, 2019, 11:48:04 pm
Rather than debug your code I just wrote my own routine to do it.  I commented and drew a little diagram to show how it works so hopefully you can follow what it's doing.  Note it is completely untested:

Code: [Select]
; SUPPORT ROUTINE
; This routine may or may not be necessary depending on how MultiplyXA works.
;   The important bit here is that C needs to be
;   unchanged by the call.  The PHP/PLP here assure that.  If MultiplyXA preseves
;   C then this routine is not needed and MultiplyXA can be called directly
MultiplyXA_Safe:
    PHP
    JSR MultiplyXA
    PLP
    RTS
   
; The actual multiplication routine
;
;   Goal:  $AABBCC * $EE   (24 bit value * 8 bit value)
;   Visualization:
;
;       AA BB CC
; x           EE
; --------------
;          BD A8   (EE * CC = BDA8)
;       AD DA ..   (EE * BB = ADDA)     (dots are effectively zeros)
; +  9E 0C .. ..   (EE * AA = 9E0C)     (note that all addition must include carry)
; --------------
;    9E BA 97 A8   <-  End result, $AABBCC * $EE = $9EBA97A8

Multiply_24x8:
    @in_24  =   ; low byte of 24-bit value (assume +1 and +2 are med/high bytes)
    @in_8   =   ; low byte of 8-bit value
    @out_32 =   ; output (32-bit value)
    @temp   =   ; some area of temp ram (only 1 byte needed for this code)
   
    CLC                     ; start with C clear
   
    ; low byte (EE * CC)
    LDA @in_8
    LDX @in_24
    JSR MultiplyXA_Safe
    STA @out_32             ; no addition needed for low byte
    STX @temp               ; addition needed for high byte, stuff it for later
   
    ; middle byte (EE * BB)
    LDA @in_8
    LDX @in_24+1
    JSR MultiplyXA_Safe
    ADC $temp               ; add with previous high byte
    STA $out_32+1
    STX $temp               ; for future addition
   
    ; high byte (EE * AA)
    LDA @in_8
    LDX @in_24+2
    JSR MultiplyXA_Safe
    ADC @temp
    STA @out_32+2
   
    ; high byte currently in X.  It does not need full addition, but we do need to add to it
    ;  any carry from the previous addition
    BCC :+
       INX
    :
    STX @out_32+3
   
    ; Done!
    RTS



EDIT:

I should also mention I'm assuming MultiplyXA outputs high byte in X and low byte in A -- since that's the most logical/useful way for that function to work.

EDIT 2:

Typo in code, had a STA instead of a STX
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 10, 2019, 11:16:21 pm
Oooohh my gosh. It works. Thank you. I still don't get HOW it works... but it does! I actually thought I could trim it down a bit, because the base item price is only ever going to be 2 bytes--so, 2 bytes into 3 bytes. But it only works with all 4 bytes? THEN I thought I could save space by having it output to tmp AND shop_curprice, but somehow doing two STAs in a row was corrupting the second one. So just had to do LDA tmp, STA shop_curprice for all the parts...

I'm close to updating the main file again with all this stuff. Its looking really good. But then I had a thought: I can trim down the hiding code even MORE if I don't have to deal with the IB/OB stats being loaded different during magical and physical attacks.

Code: [Select]
  @Hide:
  LDA CurrentCharacter ; ($00, $01, $02, $03)
  JSR PrepHide
  LDA #01           ; toggle hiding byte
  STA (tmp+12), Y   ; trouble spot
  RTS 
 
PrepHide:
    ASL A
    TAX
    LDA HideTable, X         
    STA tmp+12           ; these two bytes of tmp are either not used in battle
    LDA HideTable+1, X
    STA tmp+13           ; or not used during a player's turn. So they should be safe to tamper with?
    RTS   
   
HideTable:
  .WORD Character1Hidden ; $5D1F
  .WORD Character2Hidden ; $5D3F
  .WORD Character3Hidden ; $5D5F
  .WORD Character4Hidden ; $5D7F

So I'm debugging this and its working fine. PrepHide loads tmp+12 and tmp+13 with $5D and $xF. But that "STA (tmp+12), Y"... its saving a little bit past there. Screenshot to explain better... Red box: where its saving to. Blue box: Where it should be saving to.

https://imgur.com/a/Dkxeeua

I'll keep fiddling with it...

Edit: I got it. I forgot to set Y.  :P Like a total idiot.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on January 11, 2019, 12:01:47 am
I still don't get HOW it works

The code?  Or the mathematical concept?

The mathematical concept is the same as what is used in standard multiplication:

123 * 5 = (100 * 5) + (20 * 5) + (3 * 5)


Which can be determined with some basic algebra:

Code: [Select]
123 * 5                   (original)
(100 + 20 + 3) * 5        (separate digits)
5*100 + 5*20 + 5*3        (distribute the 5)


I'm effectively doing the exact same thing, only rather that separating digits, I'm separating bytes:

Code: [Select]
$112233 * $44                      (original)
($110000 + $2200 + $33) * $44      (separate bytes)
$44*$110000 + $44*$2200 + $44*$33  (distribute)
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 12, 2019, 05:27:27 am
The math concept, I think, is where I get lost. I'd need step by step, line diagram drawings showing every single change, with an explanation of why and how. Probably with Elmo and Big Bird. I had someone try explaining how to multiply without a calculator and after a while I just went "But that CAN'T work with a NES! The numbers aren't connected at all! 256 times 2 doesn't make 512, it makes 256+256!"

After staring a bit, I think I can sense how it works. The distribute line makes the most sense. That's how I handled math in school. Break larger numbers down into easier ones, then re-build the final number. Kind of what I was trying to do--which was correct except for where to add in the high bits?

Anyway, just glad that's all over! Time for another update!



* Added sequence data to restore default Duty settings to all original songs, since my new Marsh Cave song changes it but there was nothing to change it back for other songs.
* Battle and Prologue music's Square 2 channel is now played by the MMC5's SQ2 channel so its not interrupted by SFX.
* Re-wrote Hiding code to be even more space-efficient!
* Wrote some un-space-efficient code to allow buying 1-99 items in Item shops only.
* Re-organized Character Stat data storage. Now have 24 continuous free bytes for each character.
* Re-organized my new MMC5 variables to share space where possible.
* Did a few more spots of data cleanup. Enemy stats now ready for direct editing thanks to the FFbytes docs by Dienyddiwr Da - http://www.romhacking.net/documents/81/

To-Do:
* Figure out how ChaosDeath erases the battle background, because the background is now smaller and it will erase the boxes...?
* Go through the zero-page RAM wossits to find any unused spots and see if I can shift things around to put more audio channel stuff there instead of in MMC5 RAM. Might not be worth the effort.
* Use 24 leftover ch_stat bytes to index spells. 3 spells, 8 levels, 24 bytes!
* Combine ch_class and ch_sprite into high/low bytes. 1 more byte to use.
* ch_exptonext probably doesn't have to be saved. If it can be calculated and saved, it can be calculated and printed each time the status screen is looked at. 2 more bytes saved.
* ch_hidden doesn't need to be in the 64 bytes per character. 4 bytes saved in total!
* Character level can be used to index max MP. Current MP can be squeezed into 4 bytes possibly. First byte high: level 1. First byte low: level 2, and so on.
* This would free up 256 bytes for more game_flags (chests, npcs, events?). Possibly makes room to save more than 1 game at a time??



Question: Is it normal for an MMC5 rom's save file to be 64kb (using Mesen)? First $400 bytes is the "unsram" stuff, which I figured was UNSaved RAM. Second $400 bytes is a copy; the saved RAM. Then $1200 bytes of other stuff (I see its map data) and then like $8000 of 0s. So uh. Do I even need to be making space to make more save game slots??

Even the original game's save file is 8kb...

I suppose I could make a "Save and quit" feature that over-writes the map data, and be more vigilant about the original variables while moving them over to the work RAM in $5C00--freeing up another $400 for save data. Makes 2 save games and a third save file that gets clobbered on load and clobbers map data when saving and shutting down...?
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on January 12, 2019, 02:32:34 pm
Even the original game's save file is 8kb

There's a single RAM chip and the entire thing gets saved.  So the whole 8K chunk is saved -- but the game doesn't actually USE all of it for saved data.  Most of it is just used for additional workspace RAM and doesn't NEED to be saved, even though it still is.

Quote
Is it normal for an MMC5 rom's save file to be 64kb (using Mesen)?

Yes, that's normal.  Determining how much SRAM an MMC5 game has is difficult/unreliable, so the easiest way for an emu is to assume it's just using the most possible (which for the MMC5 is 64K) and just save all of it.

Realistically, I think the typical setup is to only have one of the SRAM chips battery backed, so it would probably make more sense to only save 32K --- but saving 64K is easier and safer for the emulator.  If you're worried about which SRAM would actually get saved on a real cartridge, that's a slightly trickier question that I don't immediately have the answer to.  I *think* it's the 2nd chip (so the second block of 32K, not the first) that has the battery on most carts.  But don't quote me on that.

Quote
Do I even need to be making space to make more save game slots??

Probably.  Whatever RAM you're using for save data can't be used by anything else in the game ever -- it has to exclusively hold the save data (unless you want the save data to get clobbered for some reason).  And FF uses most of the RAM for things like map data and whatnot.

Quote
I suppose I could make a "Save and quit" feature that over-writes the map data,

If you do that, the save data will be clobbered as soon as you resume the game and map data overwrites your save game.  I wouldn't recommend it.  And what happens when someone tries to resume a game that wasn't saved this way, and you just end up "resuming" a trash game that gets built out of arbitrary map data that happened to be in memory at the time?

Quote
moving them over to the work RAM in $5C00

It'd probably be a lot easier to just swap to a different RAM page and put your saved games there.  Remember, even without ExRAM MMC5 gives you a full 64K to work with.  You just have to swap to it.

Quote
a third save file that gets clobbered on load and clobbers map data when saving and shutting down...?

You can try that if you want, but personally I don't think that's a very good idea.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 12, 2019, 04:30:40 pm
It'd probably be a lot easier to just swap to a different RAM page and put your saved games there.  Remember, even without ExRAM MMC5 gives you a full 64K to work with.  You just have to swap to it.

O...oh. Well... I think I'll just do that, then.

Was a nice thought experiment to cram magic and MP into 28 bytes anyway though. XD
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Bregalad on January 12, 2019, 04:54:21 pm
The math concept, I think, is where I get lost.
Did you learn how to do multiplications by hand in columns back you when at primary scool ? I learnt that but I don't know if it's still taught to kids... hopefully it is. When multiplying two numbers on the 6502 which lacks a multiply instruction, it's exactly the same technique, except you use "1" and "0" digits instead of the regular "0-9" digits (this makes single-bit multiplication extremely simple as it becomes a simple AND operation), and use binary addition instread of regular addition.

When you're lucky enough to have a MMC5 that can do a 8x8->16 multiply in a couple of cycles you do it using bytes istead of "0-9" digits, still the same technique. Inidivual digits (that is, bytes) within the large numbers have to be multiplied each with eachother, and then shifted and added using the good old primary scool technique.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 15, 2019, 02:08:06 am
Well, uh... I was only really in school for a few months. We were given a math book a grade above ours and given calculators. Most of it was about shapes and doing weird puzzle things like... "8(12+4)(17-12)" and so on... just really long strings of those, is what I remember. So I never had to do multiplication or division the hard way. Trying to get my GED someday is going to suck probably. Eh.

Only a small update today...

Added in a new way to calculate who goes first in battle. Takes the player's luck stat, adds it with a random number between 1 and 50; takes the enemy's morale, divides it twice, adds it with a number between 1 and 50. If there are two identical numbers, it favours the second in line from the initial LUT of enemies 1-9, players 1-4. Not sure yet if it this is going to be fair later on. Or if its fair now.

Fixed a minor bug I caused that was turning everyone's weapons into their own palettes. It was only supposed to do that for fists! Then I thought all unarmed attacks should have fists. Then I changed my mind.

I figured out how to swap RAM, but I have to do more poking to see how to swap things over. I had it swap before a battle transition and it basically put me in battle with everyone's stats being 0s. All fighters, no names, no health... hah.


Some new bugs popped up now... White Mage's critical strength boost mucks up their sprite. Casting magic on someone puts them IN hiding now... fun things.
Fixed those, but Garland gives 1 point of experience with EXP Gain on HIGH? Fixed that, too. Guess ya gotta start with the low byte when multiplying with ASL and ROL.

Also made yet another thief boost: they will now try to hide during their turn when the party is surprised. Too much? Is it enough that the critical hit chance of weapons is fixed, that they can earn gold when doing a critical hit, and that their stats are boosted while attacking from hiding? I guess I can stop un-nerfing them now?  :P

Question: How show INT work? I know Anomie did something, but then FF Restored did it a different way... which do people prefer? Keeping in mind I have no idea how to copy their work exactly...
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on January 15, 2019, 08:18:43 pm
Short of actually adding a Steal command, I think the Thief is good without the auto-hide on surprise attacks. Maybe, if you could have them try to auto-hide when they are critical it might work better as a final un-nerf.

I think the INT patch by Anomie and the one used in FF Restored is like pretty much the same, no? Or at least very similar. Either one is fine.

As for the turn order, I think what would make sense is if it was mainly based on the AGI stat. With the LCK stat adding to the random number. This would make predicting turn order for your party more reliable.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 17, 2019, 04:36:54 pm
I was thinking Agility, then looked up how much Agility each class actually earns per level, and the Fighter earns more than the Thief...

In 49 level-ups, each class earns:
Fighter: 35 agility, 24 luck
Thief: 32 agility, 49 luck
BlackBelt: 25 agility, 30 luck
RedMage: 17 agility, 25 luck
WhiteMage: 18 agility, 20 luck
BlackMage: 13 agility, 14 luck

So it really does feel like a speed stat more than agility. Thief is fast, BB second fastest, Red Mage a teensy bit faster but limited to lighter swords...

But the point of my project is that anyone who wants to change stuff can do so easier! If you want agility instead of luck, that's changing one line. If you want to fiddle with the level up data, its organized so you just have to change a few 1s and 0s.

But you're right about the hide thing, I disabled that for now. Code's still in there if people want to enable it, though. I just wrote the hiding-when-critical code, but its also disabled until I have time to test it.

Working out the kinks for 3 save slots now. Looootta bugs going on due to the RAM switching. Loading and saving screens are working though, except for displaying which sprites each save game is using. It's a monsterous mess...

January 17, 2019, 11:51:13 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
I did it. I don't really know how I did it, but I did it. It's super messy... but... I DID IT.

There are now 3 save slots. Saving on the overworld works. Saving in inns works. You can load from the title screen. You can cancel saving and cancel loading and everything should be fine.

The MMC5's exRAM ($5C00) is now the base game data, where the current game draws from. That way its not wiped out when swapping RAM.

But please stress test the heck out of it!

https://drive.google.com/open?id=1G699Vc47Qr5he4zcBEi2JPTdc0a9h14n
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Orochi Kusanagi on January 18, 2019, 01:46:02 am
Wow, the amount of changes done on this has been nothing short of astounding. I love that these classics still get so much love from the fans.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on January 18, 2019, 02:19:49 am
Since you mentioned making things easy for other to make changes, how about adding commands?
Or having interchangeable commands?
One of my dreams has been to add class specific commands to help spice things up.

I'd also like to try to add a new screen for changing jobs like in the later games, but that's a whole other can of worms I'm ill prepared to even think about.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 19, 2019, 02:40:13 pm
Wow, the amount of changes done on this has been nothing short of astounding. I love that these classics still get so much love from the fans.
Thanks :D

Since you mentioned making things easy for other to make changes, how about adding commands?
Or having interchangeable commands?
One of my dreams has been to add class specific commands to help spice things up.

I'd also like to try to add a new screen for changing jobs like in the later games, but that's a whole other can of worms I'm ill prepared to even think about.

There's still 14 more banks to work with... I think? Both these things are ideas I wanted to do eventually. The Hide command came from trying to do class-specific things. I was having trouble changing the text when a new character's turn comes up. But I think I can do that now.

At the moment I think I reached the limit of what I can just "patch in", though. Further changes are going to require massively cleaning up the battle code at least. There's either 1 bit left in the battle command byte for a different action, or the hide command took it up.

I also want to clean up how in-battle and out-of-battle stats are loaded and used, how magic is stored out-of-battle, and clean up what bits of RAM are used for things, so its easier to tell what's safe to use and when.

Aaand I need to comment all my code better, and I think I'll stop keeping the original code commented out once a change I make works 100%. Its getting very messy to read. So for the next few weeks, that will probably be my focus. Along with minor bug fixes as I run into them. One slightly big "bug" is that the 4 big enemies have a gap between them, which pushes them too close to the heroes. That's going to require some nametable editing--or if that's impossible, I have to change the cool spell movement animation I made. :(
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on January 19, 2019, 11:06:38 pm
Ah, the dreaded commenting.
My work in Game Maker Studio sometimes feels slower than molasses because I'm always commenting everything so thoroughly.

Having to rewrite some of the code was probably inevitable given how the original code is kinda ... sloppy.
If you've read Anomie's bugfix and enhancement notes, you know how many issues there are.

Good luck, though!
If I can make some time to contribute, I'll try to do so. :)
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 21, 2019, 03:33:50 am
I tackled the dialogue data today. Only 256 lines in the game! Didn't know that. Should have expected it. Gotta figure out how to double that at least. Really hope I didn't screw up a pointer.

There was a game-freezing bug where the magic menu was looking at "$6300" instead of "ch_magicdata"--which used to be the same thing, but aren't anymore.

So I went through and looked for every place there was a variable that wasn't in variables.inc. Mostly they were in battle code. There's like, 8 different places they just chose at random to use as loop counters and temporary backup spots. So about 60% of the way through I just gave up labeling things very well because I was making new variable labels for the same damn thing. So a few spots it'll be saving to like, "math_basedamage" and it has nothing to do with damage at all.  :P I'll get around to that eventually...

Also updated the Checksum verification so now it tries to check the right spots for each save slot, instead of just the first one.

https://drive.google.com/open?id=1SQn4b5UpQcAA7HXzkRCTJ0Ls4RzsnLB6 - So here's a new upload. Rather than overwrite the old upload with every new change, which may or may not break everything, I'll start updating this one instead. Version... 0.2 or something. I should learn how to do project updates maybe.

If anyone is actually trying to play the game with this, please let me know when something looks way off.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: POWCo-op on January 24, 2019, 05:06:37 pm
Great work Jiggers. Thanks for that.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 26, 2019, 06:15:01 pm
Welcome!

Version 0.21 - https://drive.google.com/open?id=1SQn4b5UpQcAA7HXzkRCTJ0Ls4RzsnLB6

EDIT: False alarm, some bugs are still there. Working on it! Sorry!

Bugs Remaining:
* Sound Test screen plays weird stuff if you try to play a song twice.
* Being killed and poisoned in one hit will leave the dead character with the poisoned icon instead of the broken heart icon. Same for other ailments I assume.
* There's a small pause when enemies strike first; where players should be acting, but it skips over them. Not really a bug, but something I want to clear up soon.


Bugs Fixed: (thanks Mari42 for bringing some of these to my attention!)
* Save music was supposed to stop playing when leaving the save screen. Now it does!
* Treasure chests weren't displaying items because the dialogue box didn't know that item names and dialogue strings are in different banks. Now it does!
* I forgot to fix shop inventories after making consumables use different item IDs. This also stopped Heals and Pures displaying in the Drink menu in battle. Now they do!
* The highest byte of item prices when trying to purchase wasn't getting set to 0, making it impossible to buy things after a battle (my battle turn order list writes to the same spot). Fixed it. Edit: And DOUBLE fixed it because it wasn't updating in the right spot to be useful.
* Item prices were being loaded weirdly (shifted one way, then shifted the other to add in the carry), and it was breaking things. Fixed that by loading it normally and adding 0 without clearing the carry first? I'm not sure why it broke. Very weird.
* Fixed the after-battle party sorting so dead characters actually get shoved to the back row.
* More spell spelling fixes. Lokk 2 = Lock 2, Foice = Voice, Qauke = Quake... Holy and Wall were mixed up, as were Flare and Stop. Dumb things like that. Could still be some errors around.
Edit: * Treasure chests should now open the right items. Instead of a Canoe and a Fire Orb, you get a Cabin and a Heal! As you should.

Changes Made:
* Out of Battle Poison is now $04 instead of $03. This basically means all the OB/IB stuff Bank B does is stupid and pointless except for changing the character levels from 0-based to 1-based... So I took all that out and the levels are changed in like 12 bytes or something small like that.

* Character spells are now stored in 8 bytes with the rest of their data. Current and Max MP share a byte (current is high bits, max is low bits.) It took a lot of code, but to free up $100 of RAM in each save game, I think its worth it. The only trade off is that you can't really sort your spells in order of which you purchased first. However, with some tweaks to the numbers, (and a heck of a lot of menu and display changes, not to mention how battle selection grabs spells...) you could learn all 64 spells on a character--still in those 8 bytes. I'm very proud of this!!

* All character stat bytes are used up now. Weapons and armour take up 8 each. Spells and MP are 8 each. If more stats are needed I'll have to move Hiding out of there or something.

* There is now 256 bytes of unused space in each save game slot. Could be double game flag data! More treasure chests! More NPC triggers! Whatever game flags are used for!

Edit: * Bank 0 now exists as an editable ASM file. Had to quickly organize that and find the treasure data to fix the item bytes. Thanks to http://finalfantasyrandomizer.com/ for having a list of treasure stuff I could quickly refer to, and ... anomie, I think? For already having broken down the data structure of that bank! I kinda just copied their notes on it, sorry... Was a rush job!



Please look for potential bugs anywhere where magic is concerned! I haven't yet tested leveling up granting MP. All battle spells should be doing what they're supposed to do.

The next things I want to work on (after a week or two break) is updating weapons and armour screens. This will be a big one, too. Each character can have double the equipment, so each character will get their own screen. I'll play around with it and see how that comes out after my break.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on January 26, 2019, 06:33:03 pm
Cool stuff, man.

About the character equipment...
Before I got to the end of your post I was thinking about that already since you mentioned the changes to item IDs.
Is it feasible to merge the item and equipment functions in the game like later games do?
I always found it tedious having them separate and it sucks having to have 2 commands for using different kinds of items.
I imaging it would require some significant rewriting of the item screen and the associated commands.
Is my supposition correct?
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 30, 2019, 04:05:46 pm
I'm not sure if its feasible or not, yet. Both ideas will require learning how to scroll item windows, either in shops or... in shops AND the item list in the menu. What I'd love to do is have an equipment list seperate from items, and an equip character screen for each character. Then select what item from the list you want them to equip from the slot you choose. So that way a character only has 6 bytes of equipment data, and if its full, its ALWAYS equipped, while the equipment bag takes up some of the unused item list bytes.

Version 0.22 - https://drive.google.com/open?id=1SQn4b5UpQcAA7HXzkRCTJ0Ls4RzsnLB6

Changes:
* Character sprite and class are the same byte again--but low and high bits. So each time the game needs to get the class data it has to AND #$0F to clear the sprite bits out, or AND #$F0 to clear the class bits out for sprite use.
* Same thing for the hiding byte; the high bits are hiding, and the low bits... aren't used yet, but I want to code in a regeneration spell. So a character will be healed between turns, then it ticks down by 1, and stops at 0. So the Battle Turn number has a good reason for being there (counting how long until regen spells fade.)
* The EXP-to-Next bytes are unused now. The game calculates this every time you go to look at the status screen.
* Treasure chests not containing key items should be silent now... not sure about key item ones yet.

Bugs Fixed:
* Pressing right in the options menu would set a variable to 1. This variable is also used to tell shops to display a price... So if you used the options menu, then went to buy something, the shop would ask, "____g okay?" And possibly also mess up what you buy. Anyway, now the options menu clears its variables on exit.
* Forgot to set my Y loop counter to 0 when magic shops check the 3 slots per level, so it was only letting you learn 2 level 2 spells and I think 1 level 3 spell. Should now let you learn 3 spells per level as intended!

Bugs:
* Selling stuff is wonky. Gives too much money. Edit: Fixed. - Edit: Not fixed. Need to re-write a whole bunch of code. Taking out the equipment sorting routine really breaks a lot of stuff--but the routine itself was broken somehow... I don't want to deal with it. If you want to sell things for now, put them in the first slot.
* The other bugs I know of are still there...

I never really got that break I was looking forward to. Its always just, "Oh, this one last idea should be easy..." Then I swap stat bytes around and forget to change another thing and then think the first thing I changed is broken but its FINE and the fact that its fine drives me crazy because if its fine why is it bugging out so much and then I realize I forgot to change one tiny part. That's coding for ya.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on January 31, 2019, 06:40:25 am
... and then I realize I forgot to change one tiny part. That's coding for ya.

Ha! It sure is. I once spent a week rewriting an entire script in a GameMaker project thinking I had terribly messed it up somehow only to sleep on it and come back to it the next day and realize I had only forgotten to update a constant in another part of the game.

I had a Japanese FF hack a while back that did the separate equip screen per character thing.
Can't remember where I got it. Or if it could be of any help.

EDIT:
Found it. It's called Final Fantasy Revised.
It seems what they did was restructure the Weapon and Armor menus and add an extra mini inventory exclusively for equipment that all characters can access while in either of the equipment menus.
When you go to either equipment menu you choose a character like you do with the magic menu and only that character's stuff is shown.
Additionally, they added commands to the equipment menus so that you can directly switch between armor and weapons menus and swap to the next or previous character in the lineup.
It's kind of ingenious really.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Mari42 on January 31, 2019, 11:26:35 am
Ha! It sure is. I once spent a week rewriting an entire script in a GameMaker project thinking I had terribly messed it up somehow only to sleep on it and come back to it the next day and realize I had only forgotten to update a constant in another part of the game.

I had a Japanese FF hack a while back that did the separate equip screen per character thing.
Can't remember where I got it. Or if it could be of any help.

EDIT:
Found it. It's called Final Fantasy Revised.
It seems what they did was restructure the Weapon and Armor menus and add an extra mini inventory exclusively for equipment that all characters can access while in either of the equipment menus.
When you go to either equipment menu you choose a character like you do with the magic menu and only that character's stuff is shown.
Additionally, they added commands to the equipment menus so that you can directly switch between armor and weapons menus and swap to the next or previous character in the lineup.
It's kind of ingenious really.

You mean as in from PS1, Wonderswan, etc?
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 31, 2019, 04:14:41 pm
...and realize I had only forgotten to update a constant in another part of the game.

That was exactly the issue. I keep trying to organize the layout of character stats better, for easier reading in the memory viewer, and moved the hiding stat to $10 from $09, then shifted experience over to $09. Meanwhile the battle code was still clearing the hidden stat at the start of battle, so experience was getting reset... All because another variable I was using to point directly to the hidden stat...  :P

It seems what they did was restructure the Weapon and Armor menus and add an extra mini inventory exclusively for equipment that all characters can access while in either of the equipment menus.
When you go to either equipment menu you choose a character like you do with the magic menu and only that character's stuff is shown.

That's a lot like what I want to do, yeah. Except without switching armour and weapons. I think I can squeeze that in one screen and show the stats that update, too. Only show what they have equipped, but picking a slot opens the bag to choose what to try and wear.

I made a quick fix for selling weapons and armour (Link in previous post still). Instead of trying to match up the item box with character inventory, it just scans their inventory for the item you're selling, and if it finds a match, deletes it. So if you have 4 short swords and sell the 4th one, it will delete the 1st, equipped or not. I could add in a safety catch for selling equipped gear, but at the moment I'd rather focus on not burning myself out and, when I do get back to it, doing that whole upgraded weapon/armour inventory and shop update.

Also realized that something weird happened with the intro text and the fading-in sprites were offset by 4 and showing garbage characters... nooo idea how that happened, I haven't touched that code since it first worked... but I put in a fix for that, too.

And, just a reminder (to myself as well)... I don't consider what I'm doing to be updating FF1 anymore. Rather, I'm trying to make more sense of its code and expand on certain features, so that this disassembly can be used for other hacks. My ultimate goal is to make my own NES RPG. So at some point, things may start diverging wildly. I don't want to spend a lot of time doing something just to make this use features that other FF1 remakes use--unless those features are a sensible upgrade that would make other games better, too.

...that said, I have been working on a new song for boss battles...

https://drive.google.com/open?id=1ydVqBt_c8Tata1h4w-9C_8YsUhr_wXuM

(Its only midi square channels, so no triangle bass or duty settings or anything like that. Very rough draft.)
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on January 31, 2019, 07:01:40 pm
You mean as in from PS1, Wonderswan, etc?

Sorta, yeah. But the equipment is still separated from the consumable items and quest items in their own inventory apart.


...that said, I have been working on a new song for boss battles...

https://drive.google.com/open?id=1ydVqBt_c8Tata1h4w-9C_8YsUhr_wXuM

(Its only midi square channels, so no triangle bass or duty settings or anything like that. Very rough draft.)

Huh. Nice work there so far. Interesting choice to base it off the temple theme.
I've always been partial to using the Dungeon theme as a boss theme in my custom playlists.
If I had any kind of musical talent I would have actually made it into a real boss theme in Famitracker a long time ago.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on January 31, 2019, 09:21:46 pm
Thanks! There's some volcano and undersea shrine in there, too (and if you really want to stretch it, a brief reference to the original earth/marsh cave music.) I don't think Sky Castle would fit in at all though.

Meanwhile... the game is completely broken! Winning battles still doesn't award XP properly, and I have absolutely no idea why. Or, maybe XP is awarded properly, but the levelup routine is not granting the level when they reach the needed amount. I don't know when I'll get around to checking why and fixing it. I really just wanted to play for a while and not stare at the code for ten hours a day.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 01, 2019, 04:31:13 pm
First off, fantastic job on the new features so far, the options menu alone is beyond epic.
The selectable number of items to buy in the item shop is also great. As is the save menu and selectable character sprites.


Now on to issues I noticed...

Magic doesn't seem to be redirecting to a new target.
I only checked while using a red mage and casting Fire 1.

I noticed the experience values were wonky but you already know about that.


Suggestions for farther down the line that would benefit your future project and probably my own...

Being able to buy multiple items in the weapon and armor shops would be cool, though I imagine it would require having the items in a separate inventory for sure.

One thing I just realized would make shopping much simpler and less annoying is being able to open your party menu while you are in a shop.

And one idea that I had a while back was adding the ability to see at the very least whether or not a character can equip a given item.
I was thinking that perhaps the sprites used to display the party could change when you are pointing at a given item.
If they can equip it they change to the win pose.
If they can't equip it they change to the near death pose.
And if they already have it on they use the normal standing pose.
Alternatively, you have a plus, minus or equals sign appear over their heads instead.

I think that's it for now. :)
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 02, 2019, 10:44:14 pm
*flop* I fixed it. I fixed it all. I think.

Auto-target option now effect single-cast spells (on enemies, not on players.) I just never got around to poking that, but it was a super simple thing to do!

I fixed a bug where the black belt's fists were cyan. Because the code to give them a proper palette was only triggering if no weapon graphic was set (no weapon equipped I thought!), but the routine that figures out weapon stats sets the graphic to fists... So now it checks for fists and no weapon.

I was being dramatic in saying it was unplayably broken. The level up routine is working fine after all. And so is the EXP to Next display. In fact... code was perfect.

Quote
[22:13] Jiggers: when swapping banks from inside a bank... I thought it would be wise to backup the registers and some temp variables that are always being used. Just in case there's a situation where I needed to inject a bank switch and keep the bytes in those intact.
[22:13] Jiggers: But I never actually had to DO THAT
[22:14] Jiggers: Until this one thing, where... the only reason I need to do that is because my own backing up code WILL WIPE THOSE TEMPORARY VARIABLES CLEAR
[22:14] Jiggers: *cry*
[22:14] Jiggers: Anyway...
[22:14] Jiggers: LongCall_tmp    = $5CFB ; These backup tmp, tmp+1, and the A, X, and Y registers
LongCall_A      = $5CFD ; The LongCall routine restores them after it swaps banks
LongCall_Y      = $5CFE
LongCall_X      = $5CFF
[22:14] Jiggers: I fixed it
[22:15] Jiggers: LongCall_tmp was 5CFC and yet it was set to use +1 as well
[22:15] Jiggers: but that meant the accumulator was clearing out the high byte of tmp

... so I just decided to ditch the whole "backing up tmp and tmp+1 variables" idea. Right? They don't get wiped by the LongCall routine. I was just being super caurious and paranoid back then because I still barely knew how it all worked.

So experience gain is fine, and the status page shows it properly.

And I was trying to do a thing where Surprised attacks don't have a long pause, but just made it so enemies don't attack during their surprise attack turn. Fixed THAT, too. But the pause comes back if your characters die or are stoned or stunned or whatever. Not much I can do about it at the moment!

Version 0.23 https://drive.google.com/open?id=1SQn4b5UpQcAA7HXzkRCTJ0Ls4RzsnLB6

As far as shops go, at this point, I'm just thinking I'll re-write the whole inventory system and shops from scratch, when I am able to spend a few weeks on that... I think I can think of a way to show what they can equip... but entering the menu from the shop might be a bit too much. There's just soo many little sub-menus that poll for A or B or up or down or left or right. Making every little menu also check for start... oof. ( . .) Sorry.

Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 03, 2019, 01:49:31 am
Wait a minute, does that mean that the shops are actually a menu?
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 03, 2019, 03:25:56 pm
Menus within menus pretty much!

Buy/Sell/Exit - menu.
Selecting an item - menu.
Selecting who learns a spell/gets weapons or armour - menu.
Selecting yes/no - menu.
Everything in this game is menus! XD

I fiddled around with it. Every shop menu does call the same routine to re-draw the character sprites and keep music playing, so I put in a check for the start button to go into the menu. It worked... the problem is re-drawing the shop after. The list of items, the last message the shopkeeper says, whatever logic is going on prior to entering the menu... I can backup the main dialogue box, but the item lists and price being displayed in the dialogue box, all that would need to be backed up and re-drawn, and I'm really not sure how to do that. Its simpler to just re-enter the shop after going to the menu, but then at that point, is it really too annoying to leave and re-enter the shop manually? >.< And because of the other menu changes I did, the town music won't start up again after leaving the shop...

I'll keep that feature in mind for when I do get around to doing the shops over from scratch though.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 04, 2019, 03:02:16 pm
Ah, I see.

Yeah it's only a minor annoyance, so it's not that big a deal.

So I guess that is my better suggestion.
1) add an equipment indicator of some sort.
2) add an option to equip the item after selecting who will receive it.

Being able to see who can equip the currently selected item and whether putting on increases or decreases your stats would go a long way in not having to spend so much time swapping around equipment and leaving and entering the shops.

Combined with an equip now option and there will never be a need to leave the shop to check stats.

And because I can never leave well enough alone, if there was some way to directly display at least the basic stats of the currently selected equipment, that would be awesome and asking for way too much. :D

Regardless, thanks for all of your work so far.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 08, 2019, 10:49:36 pm
https://drive.google.com/open?id=1U0Ohq7_6GKZ6NQQOY_prcDbVtLMJ6dlJ

Version 0.30

Visibly, not much new...

Battle stats are now integrated into general Character stats. Things like Elemental resistance and weakness, weapon sprite, palette, element, and category; number of hits, plus the multiplyer, and critical hit rate. The routine that adjusts stats based on what's equipped now fills in those stats as well, outside of battle. (This also means, for now, the whole 8 weapons and 8 armours per character thing is shafted. But that won't matter once I start the inventory stuff.)

During battle preperations, any stats that could be changed by a spell is backed up, and then restored after battle (but before level up stats are tweaked). In battle, character stats are edited directly, by both spells and attacks, so only one or two pointers are needed at a time, instead of the... like 8 or so there were before. No more IB/OB stat nonsense; if I find any more, I'll keep updating.

All the btl_defender, btl_attacker, and btlmag_xxx variables have been shifted up into the $6000 area of RAM, as part of my ongoing attempt to organize what's used and what's not.

As usual... probably some bugs. Just finished this, haven't tested it much. Actually just noticed I messed up some of the weapon stats with the Unadjust/readjust routines, and think I fixed them...
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 09, 2019, 01:59:10 am
Groovy. I'll give it a whirl and let you know if I find anything wierd.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 09, 2019, 10:04:28 pm
Guh, sorry. Fixed bank was too full, had to move some stuff to Bank C (luckily made room by doing those edits.) So now the game will actually compile... File in last post updated!

Edit: Found some bugs. Not sure what the issue is or how to describe it. But Garland always messes up things. I'll poke at it some more in the next few days. So bad at testing this stuff.

Bug was in the explosions drawing for 2 Big Enemies and 6 Small Enemies, which the Garland battle uses, I guess! I just made it use DrawExplosions_PreserveX and then cut out some stuff that didn't look like it was needed anymore, so the routine looked more like the other ones. Okay. So, far as I can tell now, all the battle stuff works! Woo!

NOW WHERE THE HELL HAS THE KING GONE???

What could I have possibly edited to make his sprite entirely vanish?! I can walk on the throne now!
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 11, 2019, 07:47:44 am
o_O That is odd.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Thanatos-Zero on February 11, 2019, 11:01:39 am
Thinking about it, we could have a FF HD pack version using Mesen.

But now that I consider it. Final Fantasy III would profit the most by using HD scaled graphics.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 11, 2019, 04:38:12 pm
HD pack would be awesome. And how I wish someone like Disch had done a diassembly of FF3 to play with...

Version 0.30 zip file is updated with my fixes. Also poked a few more things, since at some point I broke some features. Overworld music was resetting when exiting the menu, now it doesn't. Moved the Readjust/Unadjust equip stats routines to Bank E, so there's more space in Bank F again, and did some more RAM arrangement. There's a slight timing error warning but I doubt its anything too serious.

Still no King.  :'(
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 11, 2019, 06:08:50 pm
yeah. Ever since the first few HD packs started coming out I've had those possibilities in the back of my mind. A nice hack of FF1, 2, & 3 with graphics like the Anniversary Editions would be pretty slick.

*Daydreaming*
FF1 with updated item and equipment system, MP instead of Vancian casting, and an expanded jobs system with unique commands for each class.
*Drooling now*
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on February 11, 2019, 07:35:31 pm
And how I wish someone like Disch had done a diassembly of FF3 to play with...

Hah.  Honestly the only reason I bothered with FF1 was because of my familiarity with the game.  I only played FF3 for 20 minutes and didn't get very far.

But, of course... there's nothing stopping YOU from doing an FF3 disassembly  ;)
Title: Re: FF1 MMC5 Disassembly Updates
Post by: KingMike on February 11, 2019, 09:25:04 pm
I'm one of I'm sure quite a number of people who played FF3 to the final dungeon and stopped at its unforgiving length.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 12, 2019, 01:11:27 am
I never got off the floating continent. It and FF5 are the only two I've never beaten.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 17, 2019, 06:13:40 pm
Good news everyone! I found the King. He was undone by a rogue elemental weakness variable.

https://drive.google.com/open?id=1pHO5ooyLaS7UscYMlHvjDS1-NRI7RYXy - Version 0.31

New Thing - Red tint when player is attacked! Will add jam sprites and veins to the screen edges next.

New Thing - Press select in the start menu to swap characters. Expected behaviour: Press select, choose character, press A, (character should now be in cheer pose to indicate they're selected!) choose second character, press A: swap successful with original menu SFX noise, if SFX is turned on. Pressing B at any time should cancel the swap and return the cursor to the main list. Trying to swap dead and stoned characters, or the same character with themselves, should cause the "cr-kow" error SFX or screen shake without red tint.

New Thing - Press Start + Select while loading or saving a game to clear that slot. You will be warned! Press B to cancel, or A to accept. This feature added 2 new tiles: One skull'n'crossbones with a black background located in 0D_B4C9_menuorbs.bin, and one plain black tile in bank_09_data.bin -- but $C1 really should be the black tile, if $FF is the normal background colour, right...? Eh.

New Thing - After Character 4 picks their battle command, a prompt shows up asking: Ready? Yes/No answers. Press B to return to Character 4's input. Press A on yes to continue the battle turn, or Press A on No to return to Character 4's input.

New Thing - Pause game with select! Screen darkens, music stops, sprites may flicker in standard maps... otherwise, seems to work fine. Music will resume after (triangle may take a while to kick back in if you paused on a long note.)


Fixed Thing - Instead of a second A button press stopping music in the sound test menu, it would play the healing jingle; now music stops properly.
Fixed Thing - Temple of Fiends and Sea Shrine song names were swapped in the sound test menu.
Fixed Thing - Victory music would persist in the overworld after battle and other such music not starting/not stopping nonsense. Fixed.
Fixed Thing - All Square 2 music tracks swapped to MMC5 Square 2, so that Square 2 for default music tracks is solely for SFX.
Fixed Thing - Exiting the armour equip screen was overwriting the King of Coneria's visibility flag somehow.
Fixed Thing - Weapon and Armour stats (critical hits, elemental weaknesses, etc) are updated for characters at the start of each battle
Fixed Thing? - Physical attack ailments *should* no longer be given to a character after they die.

Bug? - Square 2 holding high note when using healing items or spells in the menu - fixed? Maybe?
Bug - Listening to the old healing jingle in the sound test menu twice in a row produces a short high-pitched note. No idea how to fix. Not really important?

To Do - Find the King.
To Do - Go over enemy stat loading for physical and magical attacks and make sure everything's there.
To Do - Options cursor finickyness
To Do - Intelligence stuff! See below
To Do - Option to clear save data Done
To Do - Battle turn confirmation after 4th character picks command (have had so many oopsie moments here)
To Do - Have hidden icon be updated separately from the rest of the names/HP/ailments.
To Do - ChaosDeath routine tweaks for smaller battle screen (still)?
To Do - Sorting menu needs to be bigger, sprites need to move further to the right and less to the left, which will be undone by--
To Do - Swap characters on menu screen intead of select screen Done.
To Do - Delete old swap routines and make lots of space in Bank E. Done
To Do - Inventory/Weapons/Armour screens and mechanics re-write
To Do - Save overworld / map music in place when transitioning to battle, then return to playing from where it left off after battle. (May not be possible?)
To Do - Move enemy stats permanently from Bank C to Z, in order to add more; specifically, a stat that holds an "item" to be stolen from them. And then make sure all routines loading stats can reference them properly.



Someone else will need to work on some battle stuff for this, at some point. It's the math again. I just don't know what to do with it. I don't know how intelligence should work to do anything, or how the extra critical hit/effectivity thing for damage should work... Its all... just too much.  :-[ I don't like it, its not fun for me, and the game is fully playable without tweaking it... so whatever. If someone out there wants it--the files are free for editing! Pitch in!



Far as FF3 goes... I love the first third of it, and then get to that damn giant warzone city and remember why I always quit. The pacing just breaks there, for me. Seems like everything's a side-dungeon to grind out, when there wasn't that much grinding to do in getting off the floating continent. Assuming I can even get past the weird king bird enemy that you need dragoons for--but oops, there's no way to train dragoons while trapped in the city, is there? (Is there??)

FF3 Disassembly... I've been off and on about that idea. It seems like a big project. And which version would be best to do it with? One already patched with a translation? Looking it up, I just found out there's another translation, too, never played that one... but it has more hacky-ness done to it, so maybe not a good pick for a disassembly? Someone suggested making an MMC5 patch... Hmm...

Well, for now, I ignored this project for a while to come back with a clearer head. So I guess I'll continue again when I have time.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: KingMike on February 18, 2019, 01:38:59 am
I would say if you are going to do a full game disassembly, do it off an official version. (that would be Japanese)
Disassembling a hack seems to make less sense, because it would be easier to disassemble the differences later.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on February 18, 2019, 02:30:41 am
I would personally do whatever English translation is most prominent.

Whether or not something is "official" is largely irrelevant, IMO.  I'd want to do something my target audience is most likely going to be interested in.  And if the disassembly is going to be in English, the English version makes way more sense.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 18, 2019, 10:04:27 pm
I guess I'd look at which translation is the least edited. So not the one with the B to dash and other stuff.

FF1 stuff: Now that I've got a pretty much stable version up, I'm working on tearing apart the inventory. How's this look for an equip screen? (The . in "Left H." got squished over by accident.)

https://cdn.discordapp.com/attachments/523953073308303360/547247964926509056/FinalFantasy_026.png

At the moment, the weapon/armour offset is basically getting hard-coded. It reads 6 bytes of character inventory data, the first byte is $00 so it goes, okay, add the weapon items offset. After that, it adds the armour one. Doing away with "high bit set = equipped" because no need for it. If it exists in the inventory, its equip-able (eventually; haven't gotten that far yet.) But what I want to do at some point is work out a better way to differentiate between weapon and armour in the same screen... So that someday dual-wielding is possible. Or go the whole Bravely Second route and let the fighter equip swords to the head and body too. (8-Bit Theatre Fighter would be proud.) Wild ideas.

But how's it look? Not sure what to do with the extra space around the top and to the right of the weapon and left hand...
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 18, 2019, 10:53:06 pm
It looks pretty good so far.
Are you planning to expand the character limit on equipment names at all?
If so it might be better to arrange things differently; with the stats and equipment slots all in one large square and the stats by themselves on the top 2 lines.

Something like this:
Code: [Select]
/-----------------------------\
| Attack   XXX   Defense  XXX |
| Accuracy XXX   Evasion  XXX |
/-----------------------------\
|    Left Hand  [XXXXXXX@]    |
|    Right Hand [XXXXXXX@]    |
|                             |
|    Head       [XXXXXXX@]    |
|    Body       [XXXXXXX@]    |
|    Arms       [XXXXXXX@]    |
|    Accessory  [XXXXXXX@]    |
\-----------------------------/
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 19, 2019, 02:27:50 am
Ooh, I like that! Good suggestion :D

https://cdn.discordapp.com/attachments/509200240092643338/547315828715159552/Capture.PNG

Gonna go with 32 weapon slots, 32 armour slots... because that's what fits nicely on one screen. Its still twice what you could hold before so... Seems fair. Getting the screens looking right is finicky, but easy. All the tiny details and mechanics are gonna get hard from here. Really not looking forward to scrolling lists in the shops and battle.

Removing Armour and Weapons from the main menu to just put "Equip" instead also allowed me to remove the "WEAPON" squishy tiles. I will need to re-arrange the tileset some more now, maybe. And add a trash can icon? Maybe not... Lazy...
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Mari42 on February 19, 2019, 04:27:07 pm
I wish there would’ve been as stocks when you have same items, weapons, etc. Like as:

“Weapon x3”
“Weapon x4”
“Weapon x5”
Etc
Etc
Etc

So therefore it can prevent from having the same items, weapons, etc taking over it’s inventory.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 19, 2019, 10:50:06 pm
Glad I could help! :D

As much as it may terrorize your dreams to make scrolling menus, if you do manage it (fingers crossed) it might be a good idea to apply that to the weapon and armor inventories.

One of the things I've always found that makes an RPG feel unpolished is when you can't have at least one of every piece of equipment. Partially it is the completionist in me, but it is also a bit of me playing dress up during the end game.

You see, once everyone's level is maxed out I like to 'dress up' my party in whatever equipment I feel best fits their personality.

So FF1 by default has 40 weapons and 40 armors. As long as RAM isn't an issue it would add a lot of polish to have a scrolling inventory. And having multiples of weapons would be rad.

At this point I'm imagining an inventory similar to FF6 with a single column with a multiplier.

And one last thought, how about rewriting the discard button into a discard action? Instead of it taking space on the screen/inventory have it mapped to select or A + B.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 20, 2019, 02:45:18 am
Its just a matter of having the shop window start and stop displaying things in the list, I figure...

I've been playing around with how the discard option works. Code is getting pretty big, I think I have to do it a different way. Haven't even gotten to being able to equip items from the list yet. Problem is, the cursor is the item number, but when there's a space--should there even be a space? Should the list delete spaces so you don't have to scroll, or should it let you move items around in the list--I haven't even thought of moving items, oh boy...

So, with the edits I made to magic, there is 256 bytes free. I was thinking that could double the gameflags. But it could also be for equipment. 64 unique weapons, 64 unique armours... and then 128 bytes for the amount of each one. Otherwise, the issue is that the edits I made to the music driver require a bunch of non-consecutive bytes somewhere in RAM. It can't be in the part that gets swapped for saving the game, because all that becomes unusable, and music that uses it would mess up--which is the Prelude's melody, now. So right now I have those bytes being stored just before character data and after item data. If I didn't use that spot, there would be 192 bytes for items.

I want to add a few consumable item types as well--hi-potion, ether, pheonix down, eyedrops, smokebombs, wake-up bell, so 6 bytes for those. That would leave 46 bytes for weapons and armour each, including amount. But then no more room for any more consumables or key items...

Just kinda thinking aloud here now.

I put the Discard option where it is because it fills out the screen nicely. I got it set up to turn the cursor red, then you select the item to delete, then it goes bonkers because there's a sudden 0 in the middle of the lists. So, it could totally be the select button to do that. Or put it up at the top of the screen like the old screens had it.

Personally, I like not being able to keep every single piece of equipment. Striking a balance between really tight item management and having more space than there is equipment to fill it is how I'd make a game; but as this project is a base for what other people want to do with it... I'll try my best to work out a way for your requests!
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 20, 2019, 06:02:39 pm
That would be very much appreciated!
You do make a good point for inventory management. Maybe you could throw in a variable that could control inventory capacity? That way it could be an easy option for users.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 25, 2019, 05:20:56 am
So its 5 AM and I can't see straight no more.

I got the equip menu working just about how I want it to, for now.

I got some scroll going on in the shops.


Code: [Select]
@ScrollListDown:
    LDA #4
    STA cursor
    LDA item_box_offset
    CMP #$1B
    BCC :+
    JMP @DownReturn
  : INC item_box_offset
    JSR WaitForVBlank_L
    LDA #0
    STA menustall
    STA $2001 
    JMP ShopSelectBuyItem


@ScrollListUp:
    LDA #0
    STA cursor
    LDA item_box_offset
    BNE :+
    JMP @UpReturn
  : DEC item_box_offset
    JSR WaitForVBlank_L
    LDA #0
    STA menustall
    STA $2001
    JMP ShopSelectBuyItem

Problem at the moment is there's massive screen flicker when updating the list... and then after pressing A or B, the screen goes all janky. https://cdn.discordapp.com/attachments/509200240092643338/549532406227664906/unknown.png

The menus seem to work normally despite this.


Some maybe-dumb questions:
If the screen is already turned on, and I turn it on again, does that harm anything?

I thought calling WaitForVBlank would wait for... you know, and then do the drawing in that time, so there wouldn't be flickering from the screen turning off at the wrong time? Basically, um, how do I get rid of that screen flicker. Should I be setting scroll too?

If I can get that fixed, then I can fix the weird pause in battle when it updates the side-bar with HP and stuff, too...
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on February 25, 2019, 12:09:59 pm
Quote
If the screen is already turned on, and I turn it on again, does that harm anything?

No.  That's fine.

Quote
I thought calling WaitForVBlank would wait for... you know, and then do the drawing in that time, so there wouldn't be flickering from the screen turning off at the wrong time?

"Flicker" can describe a lot of things, so it's hard to say for sure.  But if you are waiting for VBlank before turning the screen off, then doing your drawing, you should be fine as long as you finish all your drawing and turn the screen back on before VBlank ends.  If you fail to do that, you'll get black bars and probably a garbled scroll on the following frame, which might be the flicker you're talking about.

Note that VBlank is a fixed length of time, regardless of whether or not the screen is off.  Turning the screen off for VBlank doesn't really gain you anything.


Quote
Basically, um, how do I get rid of that screen flicker. Should I be setting scroll too?

Yes.  The scroll and the PPU address set by $2006 are actually the exact same thing (the NES basically uses the PPU address to determine where to start drawing from, effectively making it the scroll value).  So any time you draw anything with $2006/2007, you should be resetting the scroll to whatever you want it to be immediately after.



EDIT:

Note that the game has a built-in mechanism for drawing things in menus without turning off the screen.  The 'menustall' variable you're clearing will split large draws across multiple frames so as never to spill outside of VBlank.  So.... if I'm remembering properly (and I might not be)... to scroll the shop inventory all you'd have to do is build a big string in RAM of the text you want to display in that box, then draw that single string using DrawComplexString with menustall=1, and the game will automatically draw a bit, wait for vblank, draw a bit more, etc.

.... but that MIGHT be too slow as I think it only draws a few lines per frame, and that shop box is pretty tall.  I dunno.  *shrug*
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 25, 2019, 04:45:30 pm
Ughhh...

Code: [Select]
    LDA SellingEquipment ; JIGS - if this is 2, turn screen off to draw
    CMP #02
    BNE :+
   
    JSR WaitForVBlank_L
    LDA #0
    STA menustall
    STA $2001
    DEC SellingEquipment
   
    :
   
    LDA #$02
    JSR DrawShopBox        ; draw shop box #2 (inv list box)

    LDA #<(str_buf+$21)    ; load up the pointer to our string
    STA text_ptr
    LDA #>(str_buf+$21)
    STA text_ptr+1
    JSR DrawShopComplexString  ; and draw it

    LDA #$1E
    STA $2001 ; turn screen on if it was off   

From Screen off to Screen on, its 14936 cycles... If I move the DrawShopBox part, it is 11258 cycles. I guess its just too big of a string to draw with the screen off at all.

Unless I write another drawing routine just for this--the string buffer is mostly control codes, so the drawing routine basically has to swap banks to get the actual names each time. Either I do that or set up inventory to scroll 5 items at a time... Which means it would be best if the inventory was divisible by 5. Or 12 5s and a 4 with a blank at the end. Well! I'll get to it then.

In other news, I feel like I reached peak programmer with this:

Quote
;; this routine temporarily sets cursor to bytes in the string buffer
;; which make it think its pointing to a 41st weapon or armor
;; which has its permission bits all set so no one can equip it...
;; which causes everyone to return to normal pose!
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 25, 2019, 06:20:29 pm
Yeah, that last bit is pretty slick.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on February 25, 2019, 06:46:36 pm
From Screen off to Screen on, its 14936 cycles... If I move the DrawShopBox part, it is 11258 cycles. I guess its just too big of a string to draw with the screen off at all.

Yeah VBlank is a little over 2000 cycles.  If you're doing a sprite DMA, it's closer to 1700.  So... yeah that's way too much to draw in a single frame.

Might have to just have a custom draw routine.


.... then again.... this is MMC5... and MMC5 has a vertical split screen mode....  In fact... this would be the absolute perfect use for it.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 26, 2019, 08:07:24 pm
https://drive.google.com/open?id=1M8Sv419Dvb2fn95olNiu2gYYUTt288d-

Version 0.32!

What's new and fixed:

* Buying in an item shop and pressing B to cancel now actually cancels...

* Shop keeper text has been updated (most of it) to be more centered in the box, and spread out with double line breaks to look neater, hopefully.

* New equip inventory stuff! Weapons and Armor options in main menu consolidated into "Equip" option. Press left and right in equip window to swap characters faster. Press A on an inventory slot to swap gear. Weapons and Armour have different windows, but all armor types share the same window.

* Weapon and Armor capacity is 64 items each.

* Mages start with a staff, fighter and thief start with small knives. Blackbelt has nothing but fists. Everyone has cloth armor.

* Equipping and un-equipping things should change stats properly... but if you know they're not, let me know.

Weapon and Armor inventory window:
* Press A to select item (tries to equip it). If item is equippable in that slot, to that character, it will swap the currently equipped item (seen in upper right little box) with the selected item.

* Press Select to access swap mode. Cursor turns a colour, pick the item you want to swap! Cursor turns another colour, pick the second item to swap! Errors if you try to swap the same item, the Discard option, or the currently equipped item (it was going to be a HUGE headache to allow swapping in that slot, sorry.) You cannot have blank spaces between items; the list will auto-sort to remove blank spots.

* Selecting the Discard option turns the cursor red, and from there, you can delete anything but the Discard option itself. Even works with currently equipped item!

* The way the cursor moves in this menu is a little wonky, but I tried to make it make sense. If you're in the first or second column and move down, it will wrap to the top of the second and third, and same going backwards. Up from the top of first column and down from the bottom of third will both hit the currently equipped item box.

Buying and Selling:
* At the moment, selling a character's equipped items is not supported. You can only sell from the inventory. The inventory scrolls by 5 items if you have them. It will scan ahead 5 slots, and if it sees a 0 in the list (first item on the next "page"), it will not scroll.

* If you have room in your gear inventory, you can choose to currently equip what you buy in the appropriate slot--if its equippable by that character. The current item will be moved to inventory. Or you can skip equipping it and put it directly in inventory.

* Characters have been moved into a straight line, and they also do a little jig when the cursor is hovering over something they can equip! Please let me know if they dance in magic shops or item shops or the inn or the clinic! They should not be doing that.



BUGS:

* I haven't even touched the battle menu for non-potion items... Expect it to be super, super screwy.

* The inventory window only shows 32 items still. So even if you have 64, you can only see the first 32 for now.

More stuff:

* I haven't gotten around to getting weapons and armor having a quantity yet.

* I wanna add little arrows to the boxes like in FF3, showing when you can scroll up or down, maybe.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 26, 2019, 10:24:50 pm
Dude, is that a new text effect on the opening story?
It's frickin' awesome!!

Will play a bit more tonight.

EDIT: Did some quick testing and everything seems to be working perfectly. I have to do a closer inspection of the equipment stats.

One thing that stuck out to me though is that sometimes the pose used by the characters in the shop menu isn't always super clear who changed poses if you aren't paying attention. If it is possible, I suggest that when the poses are updated, that characters that can't equip an item use either the stone palette or switch to the critically injured or death pose.

And I know you aren't working on the battle stuff right now, but it stuck out to me once again, like it always does when I play FF1, that there is no way for a character to skip their turn besides using an item with no spell effect. (Which is pretty lame.) So a defend command might be a great addition in the future.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 26, 2019, 11:05:16 pm
Yeah, its been there since the start of this thread. XD Thanks!

Also updated the .32 zip file again... I had the "pose if equip" variable getting set inside a shop routine that was being used for more than the weapon and armor shops; moved it out, so the characters don't get over-excited about purchasing heal potions anymore! Bug testing is rough.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 27, 2019, 01:13:24 am
Logic errors are the bane of my existence. :/
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 27, 2019, 08:16:13 pm
So... how should using an item in battle work?

My current idea is:
Take away the DRINK menu option.
Make the ITEMS option open a sub-menu: POTION, EQUIPMENT, WEAPONS, ARMOR
Then, choosing POTION opens the old DRINK menu.
Choosing EQUIPMENT (or EQUIPPED, whatever sounds better), shows a list of that character's items.
Choosing WEAPONS will allow scrolling through the weapon inventory...
Same for ARMOR.

Why move the DRINK menu? Because Battle menus have to be an even number for some reason. While I could just write a new menu routine just for the ITEMS option to only have 3 choices, its easier just to use what's already there. Plus, that makes a spot for having a unique command for each class...

I definitely do not like the idea of swapping equipment in battle. From an "I'd have to code it" perspective, anyway. That's just adding a whole other layer of confusion to how stats are handled by magic and equipment... Maybe much later when I'm more confident nothing is broken.

What I've done tonight is moved all the weapon, armor, and enemy data into Bank Z, except for the spells weapons and armor cast. Bank C now has 3,219 bytes free. $B00 of Enemy ROM data is stored in RAM (swapped to the other side, where save games are.) This is either temporary... or not. I'll either move all the routines that need to check Enemy ROM data to Bank Z, or swap RAM to have it do that.

The swap thing is kinda dumb. Even if its basically immediate, its just too much turning it on and off for every single byte load.

One thing that stuck out to me though is that sometimes the pose used by the characters in the shop menu isn't always super clear who changed poses if you aren't paying attention. If it is possible, I suggest that when the poses are updated, that characters that can't equip an item use either the stone palette or switch to the critically injured or death pose.

And I know you aren't working on the battle stuff right now, but it stuck out to me once again, like it always does when I play FF1, that there is no way for a character to skip their turn besides using an item with no spell effect. (Which is pretty lame.) So a defend command might be a great addition in the future.

Yeah, the difficulty in seeing some poses (white mage in particular) was the reason for moving their sprites into a straight line. I gotta think about how I'd do that. Adding the stun ailment? Basically every frame its adding the confusion ailment to characters, and I updated the out of battle sprite drawing to have them cheer-pose when that happens. Same thing done when swapping them in the menu. Then it has to wipe the ailment out after, without taking away poison or death or stone... So, adding stun in should make them crouch easily enough... I hope.

I generally use the Hide option to skip a turn, now. But yeah... defending would be more useful for that. Just not sure there's a bit left for it in the command byte. I'll put it on the To Do list!
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Mari42 on February 27, 2019, 09:00:29 pm
So... how should using an item in battle work?

My current idea is:
Take away the DRINK menu option.
Make the ITEMS option open a sub-menu: POTION, EQUIPMENT, WEAPONS, ARMOR
Then, choosing POTION opens the old DRINK menu.
Choosing EQUIPMENT (or EQUIPPED, whatever sounds better), shows a list of that character's items.
Choosing WEAPONS will allow scrolling through the weapon inventory...
Same for ARMOR.

Why move the DRINK menu? Because Battle menus have to be an even number for some reason. While I could just write a new menu routine just for the ITEMS option to only have 3 choices, its easier just to use what's already there. Plus, that makes a spot for having a unique command for each class...

I definitely do not like the idea of swapping equipment in battle. From an "I'd have to code it" perspective, anyway. That's just adding a whole other layer of confusion to how stats are handled by magic and equipment... Maybe much later when I'm more confident nothing is broken.

What I've done tonight is moved all the weapon, armor, and enemy data into Bank Z, except for the spells weapons and armor cast. Bank C now has 3,219 bytes free. $B00 of Enemy ROM data is stored in RAM (swapped to the other side, where save games are.) This is either temporary... or not. I'll either move all the routines that need to check Enemy ROM data to Bank Z, or swap RAM to have it do that.

That’s a perfect idea, so therefore people will have more options to be able to use/cast items IB where the players won’t be using too much magic since the “Drink” option is odd name for a title and slots are very short. That bothered me, but with you doing so it’s a perfect idea.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: KingMike on February 27, 2019, 09:07:12 pm
Drink was originally "kusuri" (medicine) but I guess DRINK was what they came up with in the official translation to fit within the original screen space/character limit.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 27, 2019, 10:22:24 pm
So... how should using an item in battle work?

Having a sub-menu set up is a good idea.

Drink: USE ITEM might be a good alternative since they are found under the ITEMS menu.
Equipment: is fine.
Weapons: has an issue...
Armor: has the same issue... and it isn't the names...

The issue is that access to all of the items that can cast a spell throws things a bit off balance.
I'm pretty sure the remakes handle it by making spells cast from an item ignore the user's INT when calculating the effects of the spell so that they are minimally effective.

So you'd probably want to do something like that here.
Or come up with some other limiter so that a bunch of spells don't suddenly become obsolete.

Some ideas:
- create a limit to how many time a character can use items to cast spells in any given battle.
- expand each character's equipment slots so they can carry extra 2 or 3 extra items for casting and/or swapping purposes. And don't include the WEAPONS or ARMOR options in the ITEMS sub-menu.
- replace all the spells used by items with new exclusive spells that are weaker than the originals and are not available to be learned in magic shops.
- do the INT patch upgrade to increase spell effectiveness but but don't include that boost when casting from an item.

Doing an equipment swap thing would probably be a can of worms programming wise.
And realistically you should only be able to swap weapons and shields.

Edit: On a side note, is it feasible to rearrange palettes so that the there are 3 available for character sprites like in Final Fantasy 3?
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 28, 2019, 06:59:12 pm
https://cdn.discordapp.com/attachments/516487781091115009/550824025593479168/Capture.PNG

Leaving that last menu slot open in case I figure out something new to add (Class change???)--meanwhile, made it more modern FF-styled!

I like the idea of each character having a little gear bag of spare weapons to cast with. That would be so much simpler than scrolling 64 or 32 weapons in battle. (Drawing battle boxes is the worst thing ever.) I guess it would look like the old equip menu, but 2 slots for each character. That would be 8 items displayed in the battle menu...

And that would leave 3 character stat bytes left.

3 palettes: I've thought about this.

From my understanding, once something is drawn to the background, it can't be changed, right? That's how they get a ton of colours on screen at once, changing palettes mid frame-draw, as well as having huge intro screens that use more unique tiles than can be loaded at once?

So each time a character is stoned, it would be feasible to undraw the sprite, load the sprite into background tile RAM instead, swap a background palette to grey (or the blues if you want to add in a frozen statue ailment!), draw it where the character used to stand.

For now... I did a thing! For every enemy in battle, their ROM stats are loaded with the RAM stats for easier access. This is 27 bytes per enemy, 243 in total. This could be upped to 28 bytes per enemy if there's another stat to add. For now, I've given them 1 extra--an item that can be stolen from. I haven't coded this in at all yet, its just there, waiting to be used. And now that I think about it, it probably won't work just like that at all.

It might have been simpler to add a RAM byte instead of a ROM byte (to switch when their item is gone), then have a LUT based on the enemy type. The LUT could randomize the item they have--imps could have cloth armour as well as small knives, and it could swap between which one you steal--as well as have an offset byte so that the stealing code would know if its weapon, armour, potion, or what have you. Ah, well... one extra ROM byte isn't hurting, for now. :P

I'm gonna keep poking at it before I upload another update though.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on February 28, 2019, 07:46:46 pm
From my understanding, once something is drawn to the background, it can't be changed, right?

The long and short answer to this question is "no, that's not correct."

But I'm not sure I understand the question properly, because OBVIOUSLY the background can be changed or else all games would have to be just 1 static screen.  Do you mean changed between frames?  Changed mid-frame?  Both of those are possible, but the latter is difficult.

Quote
That's how they get a ton of colours on screen at once, changing palettes mid frame-draw, as well as having huge intro screens that use more unique tiles than can be loaded at once?

I'm not SUPER familiar with FF3 but I don't think it does anything really fancy like this.  AFAIK the only screen-splitting it does is for the battle menu that pans to the side.

That said... palette changes mid-frame are EXTREMELY tricky and there are only a small handful of games which actually do it -- I'm pretty sure FF3 isn't one of them.

More common techniques to get more graphics on screen would be a CHR bankswap (or a nametable switch) mid-frame.  Both of those usually can be done in 1 or 2 writes and aren't SUPER timing critical.  But again I don't even think FF3 does this.  I could be wrong though.


Quote
So each time a character is stoned, it would be feasible to undraw the sprite, load the sprite into background tile RAM instead, swap a background palette to grey (or the blues if you want to add in a frozen statue ailment!), draw it where the character used to stand.

This is definitely possible.  The tricky part is finding the space for the player sprites in the BG CHR.  Most of it is in use already.

This would be sort of "easier" with MMC5's extended attribute mode, but "easier" is misleading because that's an entirely different can of worms that would require rewriting a ton of drawing code.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on February 28, 2019, 08:06:43 pm
Oh, I mean like... if you draw something to the background, then change the palette that was used to draw it, that doesn't automatically change what was already drawn. You'd have to re-draw the background again to apply that palette, wouldn't you? I wouldn't dare try to do anything mid-frame.

And there is space for 6 tiles of character! Between the enemy graphics and the lettering, there's some Japanese text with a / in front of it. Its actually there at the end of every batch of enemy tiles. I'm just not sure if those tiles have to stay there every time the screen updates...?
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on February 28, 2019, 10:56:44 pm
Oh, I mean like... if you draw something to the background, then change the palette that was used to draw it, that doesn't automatically change what was already drawn. You'd have to re-draw the background again to apply that palette, wouldn't you?

No.  You can change the palette without rewriting to the nametable, and the new palette will take effect immediately.

Some basics about how the frame is rendered:

- The game sets some data.  Notably:  nametables, attribute tables, and palettes
- The NES, during frame rendering, will read that data and draw pixels based on the contents of that data in real time, at that exact moment
- Once an individual PIXEL is visibly on the screen, then and only then* is it too late to change it (at least until next frame)

* Note that there's some buffering going on so it's actually too late to change it a few cycles before it's actually visible -- but for a general idea this is "close enough"


So if you want to write to the attribute table to change palette assignment for a 16x16 block -- that will IMMEDIATELY change the attributes for that block.  You do not need to redraw the block -- the nametable still contains the old data that it used to.


Quote
And there is space for 6 tiles of character!

That's enough for 1 character.  What if multiple people in your party are turned to stone?  I guess you could have a common "stone" graphic that is used for every class.

Quote
I'm just not sure if those tiles have to stay there every time the screen updates...?

I *THINK* the '/' slash is used somewhere (maybe in the original start menu?), but I'm 100% sure the other characters are not used anywhere and can be safely replaced.  =)
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on February 28, 2019, 11:32:32 pm
Final Fantasy 3 doesn't do anything wierd with the palettes as far as I know.
In battle and in the menu, there are three palettes dedicated to the character graphics and one that changes as needed.
The remaining palette changes as needed.
It is used by the hand pointer, weapon graphics, and spell affects.

Final Fantasy 1 uses only two dedicated palettes for the character graphics and one is dedicated to the hand pointer.
The remaining palette functions just like in FF3 except that it isn't used by the hand pointer.

So I imagine the only thing you need to do is change the hand pointer object to use the revolving palette and add appropriate code to change the colors in the revolving palette whenever you need to load the hand pointer.

That should leave things set up just like FF3 and now some of the classes can have a 3rd color scheme.

Anywho...

Love the menu layout. Now just shift all the little boxes to the right side and we're in business!! :P

I am 100,000% behind having a class change command!!!!!
My ideal set up for the classes is to have the 6 basic ones available as normal, having the option to class change at will, and the 6 advanced ones are all locked until after the Bahamut event is completed.

Speaking of which, one of the things I suggest adding in is something like the enhanced magic menu that Grond did in his hack. Being able to change around your spells would be very useful in general, but even moreso in tandem with being able to change classes.

Oh! About the gear bag. If I understand, you are saying that each party member gets to hold 2 extra items and all 8 are available to the whole party during battle? That would be like the perfect middle ground between limited personal inventories and full open party inventory!! Love it!

That thing you did: Damn! That's great. That pretty much paves the way for both random item drops and a Steal command! BTW, having each monster drop items that make sense has always been a thing I prefer to have.

I'd probably take it even further. Maybe too far. See I think that if I could, I would actually rather have non-intelligent monsters not drop Gil at all. I actually think that as tedious as it could become I'd prefer to go around getting monster hides, fangs, scales, etc. that I could sell of for gold. I kinda dig the whole monster hunting aspect. Though it would probably be necessary to create a whole big-ass array of new items that basically do nothing at all and expand the item inventory space

Either way, I dig the work you're doing it's pretty sick!

Last thing, I thought of something for the weapon and armor inventories. It would be a good QOL thing if the names of the equipment that the character can't use were drawn in a darker color like most of the later games do. That way the players don't get the annoyance of trying to equip gear that can't be equipped.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Lasciel on March 01, 2019, 04:57:08 am
OK, this is going to sound pretty stupid, but how do I apply this to a FF1 ROM, and to which version do I apply it? The NES version, or the GBA Dawn of Souls version?
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Mari42 on March 01, 2019, 02:24:35 pm
OK, this is going to sound pretty stupid, but how do I apply this to a FF1 ROM, and to which version do I apply it? The NES version, or the GBA Dawn of Souls version?

FF1 NES version  :)
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Lasciel on March 01, 2019, 03:05:17 pm
FF1 NES version  :)

Alright, so that takes care of that. I presume that I use the LD65 executable file in the zip, then?
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 01, 2019, 03:13:53 pm
Run the build.bat file and it will create a ROM file from the source code.
Then you can rename the ROM to whatever you like and play it as normal.

@Jiggers: I made a moch-up of how I would arrange the party menu. It basically matches the FF3 one.
It's just the most basic arrangement you could make really.

(https://i256.photobucket.com/albums/hh189/koala_knight/Stuff/th_FF1%20MMC5%20Menu%20WIP%20Moch-up_zpsf2arm18t.png) (https://s256.photobucket.com/user/koala_knight/media/Stuff/FF1%20MMC5%20Menu%20WIP%20Moch-up_zpsf2arm18t.png.html)
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 01, 2019, 03:28:44 pm
OK, this is going to sound pretty stupid, but how do I apply this to a FF1 ROM, and to which version do I apply it? The NES version, or the GBA Dawn of Souls version?

Not a stupid question! I didn't explain it at all. You don't need a ROM, you just click "build.bat" in and it will assemble all the code into a working game. (Oops I took so long replying to everything else it got answered!)

No.  You can change the palette without rewriting to the nametable, and the new palette will take effect immediately.

OHHHHhhhhh, damn. I completely mis-understood everything I was reading about all that, then. So now I wonder how FF3 does it. Do they just not have stone? No, they do. Okay, looking at that game, it must be swapping graphics, and its using the menu palette for stone, which is silly, 'cos there's blue dots on the people. So, that seems a bit complicated for me at the moment.

Love the menu layout. Now just shift all the little boxes to the right side and we're in business!! :P

...

Speaking of which, one of the things I suggest adding in is something like the enhanced magic menu that Grond did in his hack. Being able to change around your spells would be very useful in general, but even moreso in tandem with being able to change classes.

Oh! About the gear bag. If I understand, you are saying that each party member gets to hold 2 extra items and all 8 are available to the whole party during battle? That would be like the perfect middle ground between limited personal inventories and full open party inventory!! Love it!

...

I'd probably take it even further. Maybe too far. See I think that if I could, I would actually rather have non-intelligent monsters not drop Gil at all. I actually think that as tedious as it could become I'd prefer to go around getting monster hides, fangs, scales, etc. that I could sell of for gold. I kinda dig the whole monster hunting aspect. Though it would probably be necessary to create a whole big-ass array of new items that basically do nothing at all and expand the item inventory space

Either way, I dig the work you're doing it's pretty sick!

Last thing, I thought of something for the weapon and armor inventories. It would be a good QOL thing if the names of the equipment that the character can't use were drawn in a darker color like most of the later games do. That way the players don't get the annoyance of trying to equip gear that can't be equipped.
.

Whew... I still need to do some more background work before something like magic swapping is possible. The way item names are set up is complicated and I want to simplify it while making it easier to add more of everything. I think the area that needs work on next would be the printing routines, for that. And then I'd have to undo my cool "64 spells in 8 bytes of storage" thing. XD

Pros: 8 more character stat bytes.
Cons: Armour and Weapon inventories limited to 40 each (if using stacked items), or 80 each if each item of the same type takes up its own slot.

As it is now, its possible...? But the limit would be 64 spells in the game, as it is now. If you wanted to add other magic types and have more spells, magic bytes it would definitely need to be moved out of character stats again.

The monster item idea is neat, too. Would just need to, again, fix up the way items are labeled by the game. There's definitely room in the items part of save RAM for lots of things. And then fix up the way to sell them the way buying 99 potions works. Not too difficult, just finicky. Bank E is getting kinda full now though...

Gear Bag: I was actually thinking it would be 2 personal items each. 1 main weapon, 5 equipped armours, and 2 of either type for spell-casting. There's only really room to display 8, and it seems fairly balanced to me, closest to the original, considering how few items actually cast spells.

I'll look into a way to better highlight what you can equip in the armour menu. Maybe put the dancing sprite in there somewhere...

Run the build.bat file and it will create a ROM file from the source code.
Then you can rename the ROM to whatever you like and play it as normal.

@Jiggers: I made a moch-up of how I would arrange the party menu. It basically matches the FF3 one.
It's just the most basic arrangement you could make really.

I think all the orbs gotta be closer in the box, because of the nametable attributes. I tried moving them up, before, but lighting one made glitches where the bottom half and top half of one would be lit instead. :P (I also kinda like the menu on the left more... I think I'm either just so used to it... Japanese read right to left, right? So they're expecting to look to the menu on the right first... But heck, isn't too hard to change once I figure out the orb colour thing, so I'll figure out a way to do it.)
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 01, 2019, 03:52:23 pm
I think all the orbs gotta be closer in the box, because of the nametable attributes. I tried moving them up, before, but lighting one made glitches where the bottom half and top half of one would be lit instead. :P (I also kinda like the menu on the left more... I think I'm either just so used to it... Japanese read right to left, right? So they're expecting to look to the menu on the right first... But heck, isn't too hard to change once I figure out the orb colour thing, so I'll figure out a way to do it.)

Sounds like it's just a case of the current code trying to change something that has been moved, depending how it was coded it could be as simple as changing coordinates or it could be a pain in the butt.

Japanese being read right-to-left probably is the reason for the FF1 menu position, but that pretty quickly flew out the door. FF2 is still arranged vertically instead and the commands themselves are arranged left-to-right as in English. Then FF3 set the trend for the next7 or so games.
I guess it just depends on how much of the original game's set up you want to preserve.

Incidentally, which bank has the code for the menus?
I'd like to learn more about how they actually work.



PS- Another idea for you.
Have the shops and clinic not reset the town music.
Just like how the party menu doesn't interrupt the music and just lowers the volume.
That would free up the shop theme for use in other parts of the game.

Actually I keep a custom soundtrack of FF1 around and rename the menu, shop, and clinic themes into extra town themes. I imagine places like Pravoka would use the livelier shop theme, more sleepy towns could use the menu theme, and the standard town theme would be for the larger towns.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: KingMike on March 01, 2019, 05:41:16 pm
Vertical Japanese is top-to-bottom right-to-left.

But horizontally-printed Japanese is read just the same any western language.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 01, 2019, 05:46:01 pm
Yeah, that might be something nice to do for town music. I'll put it on the To Do list if I remember. Usually I re-read this thread and fill up the To Do list when I run out of other things I want to work on. XD

I really don't know why FF1 has a different layout from the other games, if its not the language thing... I was looking at FF3's menu and thinking, "this looks cluttered and kinda bad..." I don't remember thinking that about the SNES games, but I also haven't been actively thinking about menu positions at all when I last played any of them! So my next guess... FF3 did it like that to save space (I think I saved space by changing the menu layout a bit!) And it just kinda stuck...?

Bank E is the one for the main menu and shops!

https://drive.google.com/open?id=1d8XpfheXVsEln6EU5FYCRpxedbAWy68V -- here's the last update I did to it.

The usual logic is something like:

Turn off screen, reset buttons, clear nametable, load graphics (this is usually done in the fixed bank, before swapping to Bank E for menu logic), do any data filling (putting shop items into RAM for instance), draw boxes, fill boxes with text, turn on screen... (these are usually labeled Enter-something. EnterShop, EnterMainMenu, etc.)

Then the frame things: Clear old sprites, re-draw sprites, do audio updates, and check buttons, and loop until a button is pressed. (ShopFrame, MenuFrame)

Then, when buttons are pressed: If directional buttons, move the cursor around the screen. If A, use the cursor positioning to get character data, or item data, for whatever needs doing. If B, go back to previous menu or exit.

Every little thing has its own LUT, usually. For placing boxes, for placing sprites (both character and cursor), and so on. So if you want to swap the menu positions yourself... Look for "DrawMainMenu" which then goes through DrawOrbBox, DrawMainMenuGoldBox, and DrawMainMenuOptionBox, before drawing the main character box/boxes. What you really want to change is in:

lut_MainItemBoxes (menu box positions)
lut_MainMenuSubCursor (cursor positions for choosing a character)
lut_MainMenuCursor_Y (cursor positions for choosing menu option) (and then find the X coordinate in DrawMainMenuCursor)
DrawOrbBox (position of orb tiles is here instead of using a LUT; this also handles the nametable attribute byte the orbs use, but I don't immediately understand how to change it to move them over. Just know they need to be in the same attribute box.)
DrawMainMenu (text string positions for character names, level, hp, mp)

Moving the boxes is usually enough to change the text positioning, though. Sometimes I have to do INC/DEC dest_y/dest_x before it goes to DrawMenu/Shop/ComplexString to get things more centered and nice looking.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 01, 2019, 07:19:27 pm
Thanks for all the info! I appreciate it.

As for the Menu layout origin, I think it's just a case of this being the first time they did a fully separate menu for an RPG. And the FF3 layout ended up being the most popular.

Bug report time:
I noticed some screwiness in the shops this time.
I went in bought some stuff and everything was fine.
Bought a bunch of extra stuff to see the scrolling inventory; no issue.
Sold something and then there was a problem.
The stuff in my inventory changes into a bunch of wierd stuff.
This is in the armor shop.
I had a bunch of cloth armors, sold one, then backed out of selling, and all my cloths turned into 360g.
I then sold the 360g for 180g (LOL), and the remaining 360g turned into an ice shield that I sold for 2000g.
Then the first empty slot turned into a LUTE. Discarded it.
I tried again to but a bunch of cloth armors, sell one and back out with B.
This time I tried to go back to buying stuff and the store inventory went all screwy.
Eventually I was able to select the armor shop itself by pressing up on an empty store inventory...
I appeared to buy the shop itself, but alas this is not Fable and it only turned out to be a LUTE.
Discarded that one, too.

So it looks like there is something funky going on there with loading the wrong data. Seems like at one point it might have been loading data from the treasure table.

Also Garland appears to have the wrong AI or something as the text windows refer to him as SCORPION and he can heal himself.

EDIT:

In other news the owner of the Cornelia Weapon Shop is under investigation for suspicion of human trafficking...

(https://i256.photobucket.com/albums/hh189/koala_knight/Stuff/FinalFantasy_000_zpsdrdnsgxn.png) (https://s256.photobucket.com/user/koala_knight/media/Stuff/FinalFantasy_000_zpsdrdnsgxn.png.html)
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 01, 2019, 09:19:46 pm
Also Garland appears to have the wrong AI or something as the text windows refer to him as SCORPION and he can heal himself.

XD This is why I was waiting to upload version .33 ... I've only had time to battle imps so far, and their stats were checking out. (I did have to edit the way enemy names were drawn to even get that right though.)

I see what the issue is. Items are stored in inventory as $01-$40, then transferred to the shop's item box and their item offset thing is added. So a small knife ($01) becomes ($1D) but then, that's not subtracted when I put them back in the inventory... whoops! I'll get right on that.

I've been looking over how FF3 uses its save RAM, and discovered that they do the exact same thing I did with the magic! They cram it all into 8 bytes, using the bits to denote if a character has it in their list. Sneaky beans.



This is annoying me. I can't figure it out.

So each enemy has 28 bytes of RAM data, not 27 as I thought. (0 based stuff is messing with my mind too much.) They have 21 bytes of ROM data.

So, get RAM pointers...

Code: [Select]
GetEnemyRAMPtr:
    LDX #28                ; multiply enemy index by 28  (number of bytes per enemy)
    JSR MultiplyXA
    CLC                    ; then add btl_enemystats to the result (btl_enemystats is $6100)
    ADC #<btl_enemystats         
    STA EnemyRAMPointer
    TXA
    ADC #>btl_enemystats         
    STA EnemyRAMPointer+1
    RTS

Then load stats from ROM, and add in the last few RAM-only bytes:

Code: [Select]
LoadEnemyStats:
    LDA #$09
    STA btl_loadenemystats_counter              ; loop down-counter
    LDA #$00
    STA btl_loadenemystats_index               ; loop up-counter / enemy index
   
  @EnemyLoop:
    LDA btl_loadenemystats_index              ; Put a pointer to the current enemy's stat RAM
    JSR GetEnemyRAMPtr                          ;    in btltmp+A
   
    LDX btl_loadenemystats_index              ; Check to see if this enemy even exists
    JSR DoesEnemyXExist
    BNE :+
      JMP @NextEnemy        ; if it doesn't, skip ahead...
     
  : LDX #21                ; multiply current enemy ID by #$15  ($15 bytes of data per enemy)
    JSR MultiplyXA          ;   add the result to data_EnemyStats to generate a pointer to the enemy
    CLC                     ;   data in ROM.
    ADC #<data_EnemyStats 
    STA EnemyROMPointer
    TXA
    ADC #>data_EnemyStats
    STA EnemyROMPointer+1
   
    LDY #0
   @Loop:
    LDA (EnemyROMPointer), Y
    STA (EnemyRAMPointer), Y
    INY
    CPY #21               ; copy 21 bytes of ROM data into RAM.
    BNE @Loop
   
    LDA #0
    STA (EnemyRAMPointer), Y ; <- en_aimagpos
    INY                 
    STA (EnemyRAMPointer), Y ; <- en_aiatkpos
    INY
    LDA #$01
    STA (EnemyRAMPointer), Y ; en_numhitsmult, default to hit multiplier of 1
   
    INY
    LDA #0
    STA (EnemyRAMPointer), Y ; <- en_ailments

    LDY #04
    LDA (EnemyROMPointer), Y ; load max HP low byte
    PHA                      ; push low byte
    INY
    LDA (EnemyROMPointer), Y ; load max HP high byte
   
    LDY #en_hp+1
    STA (EnemyRAMPointer), Y ; save as current HP high byte
    PLA                      ; pull low byte
    DEY
    STA (EnemyRAMPointer), Y ; save as current HP low byte
   
    LDX btl_loadenemystats_index   ; get the enemy ID
    LDA btl_enemyIDs, X
    LDY #en_enemyid
    STA (EnemyRAMPointer), Y   
   
  @NextEnemy:
    INC btl_loadenemystats_index           ; inc up-counter to look at next enemy
    DEC btl_loadenemystats_counter           ; dec down-counter
    BEQ :+
      JMP @EnemyLoop    ; loop until all 9 enemies processed
     
  :  RTS

Everything looks okay? Here's six wolves in RAM:

(https://cdn.discordapp.com/attachments/509200240092643338/551262957632487464/6_Wolves.PNG)

Wolf ROM bytes, for comparison:
.byte $18,$00,$06,$00,$14,$00,$69,$FF,$24,$00,$01,$05,$08,$01,$00,$00,$00,$1C,$00,$00,$00

Now then, to print the name, this little routine has to combine the enemy stat index ($0 to $8 for 9 enemies)...

Code: [Select]
    LDX #28
    JSR MultiplyXA
    TAX
    LDA btl_enemystats + en_enemyid, X
   
;original code:
    ;ASL A           ; mulitply A by $14  ($14 bytes per entry in btl_enemystats)
    ;ASL A           ; first, multiply by 4
    ;STA $94         ;    store it in temp
    ;ASL A           ; then multiply by $10
    ;ASL A
    ;CLC
    ;ADC $94         ; add with stored *4
    ;TAX             ; put in X to index
    ;LDA btl_enemystats + en_enemyid, X   ; get this enemy's ID

What is it doing wrong, that 2 out of 4 wolves are labeled IMP (the code is fetching $00 instead of $02)?

Edit again: And after all that... I guess it works after all? Maybe I was so tired I forgot to build after my last change...

https://drive.google.com/open?id=1d8XpfheXVsEln6EU5FYCRpxedbAWy68V - So selling and enemies should work now...

Also fixed:
* EXP and money earning.
* Garland is not using Cure anymore
* Imps do not run away from level 1 parties
* Selecting a character to swap won't reset the cursor back to the first character
* Cursor can't even touch the save option outside of the overworld (like FF3)
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 02, 2019, 01:58:48 am
Heya. More bugs.

-When I'm in any shop (magic, item, clinic, inn, etc.) if I press the start button at any time it starts looping a scratch sound effect that doesn't stop until I leave the shop. Doesn't happen in the party menu.

-In every shop and in the party menu, every time I press the A button it plays that same scratch sound as above, but only once per press. Additionally every time I move the finger pointer. Battle menus aren't affected.

-When I sell stuff, no matter which item I choose it always removes the item at the top of the currently displayed page of items instead of the one I was pointing at.

-When I buy an item and immediately equip it to the character in the 1st slot it removes their current weapon just fine and equips the item I just bought. However when I do the same thing with the characters in the other slots instead of adding the weapons they are holding into the inventory it adds a copy of whatever weapon the character in the 1st slot is holding.

-When I try to cast a spell that doesn't have an out of battle effect, it tells me that I'm out of charges for that level instead of saying that the spell can't be used outside now.

-There still seems to be some funkiness going on because at the end of the battle when I killed Garland, the message box referred to him as an IMP and then for a split second as a GrIMP.


Question: Are the experience point and gil values for enemies out of whack? I seem to get some pretty wierd results. Is it because of the options menu effects?
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 02, 2019, 02:20:50 am
Heya. More bugs.

-When I'm in any shop (magic, item, clinic, inn, etc.) if I press the start button at any time it starts looping a scratch sound effect that doesn't stop until I leave the shop. Doesn't happen in the party menu.

That is weird! I'll look at it tomorrow. I remember in some menu code or other, it was clearing the start button, and the comments were like, "Why does it do this, the start button does nothing here"? Maybe its a bug in the original game's code that they fixed by doing that?? *shrug*

-In every shop and in the party menu, every time I press the A button it plays that same scratch sound as above, but only once per press. Additionally every time I move the finger pointer. Battle menus aren't affected.

XD This is on purpose. I thought the bloopy SFX were too annoying so I played around with the noise channel and made some SFX I thought were kind of okay, not too grating, not too loud. Both this and the start-button bug can be turned off in the options menu. I only used the original menu SFX for swapping characters because my noise channel things were too subdued for a success sound, and the visual changes happened too fast to be satisfying.

You can use the old square 2 SFX too. Look for "PlaySFX_MenuSel" and "PlaySFX_MenuMove" in Bank E, and comment out my code and delete the ;s in front of the original code.

-When I sell stuff, no matter which item I choose it always removes the item at the top of the currently displayed page of items instead of the one I was pointing at.

...weird. I didn't notice that happening. But that is definitely not right, will poke it tomorrow.

-When I buy an item and immediately equip it to the character in the 1st slot it removes their current weapon just fine and equips the item I just bought. However when I do the same thing with the characters in the other slots instead of adding the weapons they are holding into the inventory it adds a copy of whatever weapon the character in the 1st slot is holding.

I just noticed this and fixed it (edited my previous post, but forgot to mention this bug.) It was caused by using Y where I should have used X.

-When I try to cast a spell that doesn't have an out of battle effect, it tells me that I'm out of charges for that level instead of saying that the spell can't be used outside now.

Oopsie. Should be an easy fix, just gotta find the right byte for the right message. I wouldn't even think of trying that, so good catch.

-There still seems to be some funkiness going on because at the end of the battle when I killed Garland, the message box referred to him as an IMP and then for a split second as a GrIMP.

Weiiird... if you have time, try again with the last update in my previous post?

Question: Are the experience point and gil values for enemies out of whack? I seem to get some pretty wierd results. Is it because of the options menu effects?

They were, definitely. While I fixed enemy RAM loading 27 bytes when it first loads enemies, I forgot to change that in the battle bank, so morale and AI were wonky, and also in Bank B, where the after-battle stuff happens, was still using the original game's enemy RAM size, so it was loading random values for experience and money. It should work now!
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 02, 2019, 04:52:23 am
OK. I tested everything out again. All the battle related options (Experience, Money, Encounter Rate) seem to be working flawlessly.

No issues fighting Garland either.

One thing I noticed is that I was able to get the cap from the first treasure chest on the left side of the Temple of Fiends. It wasn't visible initially in the armor inventory, but when I first pressed A to equip the empty space it appeared in the body slot, then I removed it from there and it appeared properly and was able to equip it on the head slot.

I have to say that being able to set XP and Gil to high and manipulate the encounter rate as I need is awesome.
It saves time when I need to level up by setting everything to HIGH and being able to set the encounter rate to LOW removes a lot of the annoyance of battles interrupting me while I'm trying to concentrate on exploration.

Another thing, in the party creation menu is the palette for the frames supposed to have dark blue instead of medium gray?

On to some suggestions...

Party Menu stuff...
I love being able to switch between characters when I'm in the equip menu.
I'd love to be able to do the same thing in the Magic and Status menus.
I imagine it would be pretty simple to get that done in the Status menu.
However, I'm thinking it might be a hassle in the Magic menu since it already uses all 4 directions for navigation.
It would need to either use an alternative method to switch characters (which would cause an inconsistent controls situation) or you would have to add a command that you start on. While on this command (call it CAST or USE) press A to switch to the normal interaction mode or Left/Right to switch characters.
That way the controls in all the menus would remain standardized.

I think I mentioned this before but, there is a little annoyance in the name input menu that might be worth fixing. If I input a name that is shorter than 7 characters I'm forced to input blank spaces. That blows. I suggest having the start button end name input prematurely.

Oh! When I used a tent just now, after exiting the tent menu I noticed that the character in the 1st slot (which was a Fighter with the Monk sprite) momentarily switched back to using the Fighter sprite although the palette was still the Monk's.

I think that's all for now.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 02, 2019, 06:48:00 pm
Yay for Garland being normal! Whenever I edit battle stuff, fighting him is the basic "Did I screw up?" check, since his data is so far down the list from imps and wolves...

I did forget to update the getting items from treasure chests for the new inventory... will do that next!

I really liked the ability to set individual difficulty settings in Bravely Default. Setting EXP and money gain to high at the start, I don't think you'd need to do the marsh cave grind very much at all. Last time I was able to play without going "I want to change this", I got to level 7 not long after getting the ship... Which I used to do at level 3.

"Another thing, in the party creation menu is the palette for the frames supposed to have dark blue instead of medium gray?" -- Yep, its not something I can easily change. I thought the black background would be better for seeing how your characters will look for 90% of the game, but the boxes don't align on the attribute table. Can't make the outside the box background classic blue without changing the frames of the boxes. *shrug*

I'm updating the status menu a lot now, and the equip menu. I forgot about DTE text, and now I'm using it as much as possible to save space... You can now swap characters in the status screen! I'm not sure I want to bother with the magic menu, though. I still need to set up the 2 extra weapons stuff, and there's very little space left... If I finish it up and I do have space, I'll give it a try.

I fixed up the name input menu to allow pressing start. It won't let you press start without at least 1 non-space character input. Also you can press B on a blank name to go back to class/sprite select, since that bothered me too.

Quote
When I try to cast a spell that doesn't have an out of battle effect, it tells me that I'm out of charges for that level instead of saying that the spell can't be used outside now.

Which spell were you trying? I used Fire, and got the correct message. The code looks okay...

Quote
Oh! When I used a tent just now, after exiting the tent menu I noticed that the character in the 1st slot (which was a Fighter with the Monk sprite) momentarily switched back to using the Fighter sprite although the palette was still the Monk's.

Got it fixed, I think. Needed to re-load some graphics after using the save screen, which loads up the standing sprites for all 12 classes.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 02, 2019, 07:42:55 pm
Fire and Bolt both did it. Haven't checked the others yet.
I'll let you know.

Edit: Just checked again, It only happens on the 2nd and 3rd spells, not the 1st one.
Just to make sure I downloaded the zip again and rebuilt the ROM and started a new game.

Since you are working on the status screen, would you consider moving the level display to the same box as the name and instead adding the Magic Evade stat? Having the M.Evade % visible is one of those things other mods have done that I find really convenient. No need to add it to the equip menu either since it isn't affected by equipment at all.

Also, I have another editing question, how do I know how much space has been used in a bank while working on the asm file?
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 02, 2019, 11:22:34 pm
Actually already have the status screen showing Magic... well, defense. Did that before you posted, sorry. >.>

I think I have the two extra battle items working now, I just need to re-write how its drawn in the box and make sure the battle code will select the right thing... This might take a while. Other than that, I think the only bug I haven't fixed yet is the magic one you just found.

For checking the space in each bank, I put "END OF BANK X" text at the end of each file I want to check, then load the .nes file up in something.

(https://cdn.discordapp.com/attachments/509200240092643338/551620347791802369/Capture.PNG)



https://drive.google.com/open?id=1d8XpfheXVsEln6EU5FYCRpxedbAWy68V

!! Yay, I think I got everything.

For the spells having an improper message, I don't know what my brain was thinking. Cursor was being used to index an 8-byte long LUT, when cursor could have been up to 24... So, made a new LUT 3x as large, because heck if I know how to divide a single byte by 3 instead.

Dumb thing: I made the Thief and Ninja's names in the party generation screen centered in their boxes. Thief at least. Ninja should work. But then I forgot to move the space from the front of Ninja's text. I did it now but I already uploaded the file...

There's two new slots in the Equip menu. This meant squishing everything into 1 box. I don't know if it looks okay. But its all working, as far as I can tell. And using items in battle is back in business! 3 weapons, 5 armors.

The item battle box is sorted like this:
0 Weapon - 1 Shield
2 Head - 3 Body
4 Hands - 5 Accessory
6 Item 1 - 7 Item 2

I'm afraid any other way to sort it would be ridiculously difficult... Except this one, more like the original code:
0 Weapon - 4 Head
1 Shield - 5 Body
2 Item 1 - 6 Hands
3 Item 2 - 7 Accessory

Which would require moving Item 1 and 2's stats around. Having Shield be in slot 3 would save the equip menus maybe a dozen bytes of code (not having to compare 6 and then compare 0 to see what's a weapon and what's armor), but just... looks wrong to my dumb brain somehow.

I also found and fixed the BlackBelt armour bug.

I think that wraps it up for all the big changes I had going on... There's just no room left in Bank E for adding code for 99 stacks of stuff. I'm gonna take a break for a few days (unless you find more bugs) and then think about what I want to do next. Either organizing item names better so the amount of gold in treasure chests isn't taking up item slots, or working out how game flags can use more than the 3-4 bits it currently does. Or just slowly start documenting more things... Or move NPC dialogue stuff to another bank so E has 5000 free bytes again...
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 04, 2019, 02:42:49 am
Cool beans. I was out of town for the weekend and just got back. I'll do some testing tomorrow.

I'm very interested in the moving of NPC dialogue to another bank. I think it would be worth it for further changes to the menus.

Before I got to the end of your post I was already thinking of asking if would be possible to split the contents of Bank E in some way to make more room for editing the party menu more.

Also, is the ROM this disassembly produces expanded as far as MMC5 can go?


EDIT:

Something got borked because in the Temple Ruins I encountered a ghoul that was actually a Frost Lizard and Garland was actually a Frost Giant.

That selling bug still seems to be there. It always takes the top item on the list no matter which one I choose to sell.

And I can get the potion and cabin from the chests just fine, but the cap didn't appear in inventory.

The new equip menu layout is pretty good, but might benefit from a bit more rearrangement. I'll post a mock-up image later so I can just show you what I'm thinking.

The Status screen, on the other hand, needs a lot more work. It just feels wierd.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 04, 2019, 04:23:26 pm
Also, is the ROM this disassembly produces expanded as far as MMC5 can go?

Nope. Chaos Rush's FF3 translation uses MMC5 and is 1 megabyte. This is currently half that. And most of it is still filler.dat. I don't know if you'd need to completely re-organize the whole game structure, though. If its just more banks, or if the banks have to be bigger or smaller or anything... not my area of understanding stuff.

Blegh... I forgot about the selling bug. I see the problem, at least.

And this time I'll test the treasure chest and enemies before I call it fixed... (Garland worked last time though! *whine*)

The new equip menu layout is pretty good, but might benefit from a bit more rearrangement. I'll post a mock-up image later so I can just show you what I'm thinking.

The Status screen, on the other hand, needs a lot more work. It just feels wierd.

Yeah, it is weird. Could put the orb box there to make it more filled out? Code in some more stat printing routines to show critical hit and whatnot? Or just use more boxes again once Bank E has more space for it...

For the selling bug, if you want to try this...

Code: [Select]
@ItemsForSale:
    LDA #01
    STA inv_canequipinshop ; turn on the ability to dance to equipable items!
    JSR ShopSelectBuyItem        ; have the user select an item to sell
    BCS @_Loop                   ; if they pressed B, jump back to the loop
   
    LDA cursor       ; add this
    STA ItemToEquip  ; and this
   
    DEC SellingEquipment
    JSR DrawShopSellItemConfirm  ; draw the sell confirmation dialogue
    JSR ShopLoop_YesNo           ; give them the yes/no option
    BCS @_Cancel                 ; if they pressed B, canecl
    LDA cursor
    BNE @_Cancel                 ; if they selected "No", cancel

    LDA ItemToEquip   ; change "cursor" to "ItemToEquip"
    CLC
    ADC item_box_offset
    TAX
    LDA #0
    STA item_box, X

And for the missing cap: Its actually a bigger bug. But an easy fix.

Code: [Select]
FillEquipInventoryWithItemBox: ;; fill inventory from item box - after equipping, swapping, deleting an item!
    LDX equipoffset
    BEQ :+      ; if 0, its a weapon, so skip ahead
    CPX #06
    BCS :+

    LDX #$40    ; 64 bytes past weapon list
    JMP :++     ; X is now the start of weapons or the start of armors 
   
  : LDX #0
  : LDY #0

Add the JMP :++ and the second : in front of the LDY at the end, and do the same for FillItemBoxWithEquipInventory below that.

I wonder if all these dumb equipoffset checks would be better done with a LUT...? How many bytes does that bit of code take up, compared to:

LDX equipoffset
LDA EquipmentOffset_Lut, X
TAX

plus 8 bytes of: $00, $01, $01, $01, $01, $01, $00, $00
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 04, 2019, 05:06:26 pm
The LUT might be a smidge less bytes, I think, but I'm not 100% sure.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 07, 2019, 01:42:41 am
...it saved like 9 bytes. But I moved the talking routines to the Dialogue data bank and now there's looooots of space.

Fixed the selling (pretty sure) and missing cap. Fixed a few more battle things with enemy RAM stats. (forgot a # in front of a variable name and suddenly 1 wolf out of 6 was regenerative...) Can't replicate the enemy names being off anymore, though, so it seems fixed to me still.

https://drive.google.com/open?id=1rmHbc4YZg0NkobkkmNSZroZHykFfCuc1 - Version 0.34 ?

Removing 0.33 because I overwrote the file with a buggy mess.

Asking someone about the status screen, they prefer the old one, too. Are the lowercase, longer words alright, though? If I split them into two boxes, I'd either need to have them stacked up, or pushed to the edges of the screen like the magic menu is. I sorta like having room to add another box of information. Job level, capacity points, someday, maybe...

Also amazed at how cluttered everything in FF3 is!
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 07, 2019, 03:32:43 am
I like the longer names for the base stats, yeah.

Please, for the love all that is good in the world do not add the capacity point system from FF3 into this.
There's a good reason they never used anything like that ever again.
Personally, I'm just fine with keeping things super simple.
A simple Job menu that just lets me change jobs is more than good enough.

I don't think separate Job Levels are necessary really.
Jobs in this game only really affect 2 things; how your stats grow and access to spells.
So there isn't as much of a need for specific job leveling with no abilities to gain or commands to learn and allocate.

But...
If I was going to go all out, I'd pretty much copy the job system from FF5 and maybe a spattering of features from later FFs.

One thing to keep in mind if you are going to add a job system is that you will have to figure out a way to deal with magic. That's why I've been pushy about making the magic menu more flexible. If the magic menu allows for easily exchangeable spells, then switching jobs won't be much of an issue.

Speaking of changing jobs, another thing to keep in mind is what to do with equipment.
I think the best thing to do is have it give a warning before automatically unequip everything.
FF3 gives a warning bout having to unequip before trying to change jobs, but then you have to trudge back to the equip menu and manually do it yourself. That blows.

EDIT:

Bug reports...
Buying and selling in the equipment shops seems to be working fine now.
I did notice, though, that after I had only 4 items in inventory it already allowed me to scroll down to the second page where I could start selling empty slots for 0 gil.
It didn't seem to have any adverse effect on the actual inventory itself.

The experience and gil reward values are out of whack again. Goblins are giving out hundreds of XP on the low setting.


Buying things in the item shop is overwriting the amount of the item I purchased instead of adding it to the ones I already have.

I noticed something about the glitch with FrGiant Garland. He changed into a FrGiant after I hit him with magic. So it's maybe loading the wrong index somewhere in the end of the spell casting routine?

After Leveling up above 9 the level up text is overwriting the text box on the right side due to the longer name strings.

I can confirm that the treasure chests in the Ruined Temple are all functioning properly.
(Love my shiny new cap!)

EDIT2:

Suggestions I thought of during tonight's playtest...

Character creation menu:

After I'm done with all 4 characters, can you make it so I can press START to begin the game instead of B? Most of the other games have you confirm with START instead of the cancel button.

Add a confirmation message after pressing Start to finalize character creation and start the game.

Depending on how involved you want to get with it, you could allow players to press START at any time and have different subroutines take effect depending on the circumstances.
-Press START without entering any names at all: starts the game with the default party and changes their names to those of the core members of the development team.
Code: [Select]
(Fighter   , Thief, Monk , RedMage.)
(Hiro[nobu], Nasir, Amano, Uematsu.)
-Press START with only 1, 2, or 3, names filled in: Start the game with that many characters, and the remaining blanks are not present at all. Playing through the whole game on HIGH encounter rate and LOW XP and gil would be brutal as a solo party. It's basically formalizing what some people already do for a challenge by letting some characters die and never reviving them.

I was thinking about the blue frames in this menu, what about doing a graphics bank swap instead of changing the palette? That way you could have that menu use alternate graphics that allow you to keep the frame colors consistent.

Speaking of graphics bank swapping, What about having a full set of male and female sprites for each class? Something like... press SELECT to switch graphics sets while selecting the class and sprite? I can provide the graphics even.

Other Stuff:

Add a sell command to the item shop.

Add a delete command to the File Load menu.

Add an option to remember cursor position on the main menu.
Even if it is limited to only functioning while you are on the main menu and it resets when you exit it would be great QoL.

Remove the "Nothing here." message when I press A and there is nothing there.
Save some of that text space for something more useful than the obvious.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 08, 2019, 01:15:41 am
Whew, that's a lot... I'll just touch on a few things for now:

You can delete in the save/load screen! Press Start + Select at the same time (holding down one and then the other doesn't work, haven't figured that out yet. Gotta press both at once.)

Garland being a Frost Giant--I see it now. It shows up for a split second after displaying the damage dealt. While undrawing boxes... I hate battle boxes so much. EDIT: I could have sworn I went over the battle magic stat loading and saving routines before, but... I guess I didn't? So, I fixed that. Garland's enemy ID was being overwritten by his defense or something. I think this was also making imps give extra money? Did that only happen if you cast magic on them? Updated the last link with the fix!

"I did notice, though, that after I had only 4 items in inventory it already allowed me to scroll down to the second page where I could start selling empty slots for 0 gil." -- I fixed this by changing a CPY #4 to a CPY #6 in the subroutine "@ScrollDownLoop:" Must have thought it was 0-based, since it needs to scan 5 ahead... except it needs to scan 6 ahead, actually.

That's all I got time to report for now. (And Capacity points are dumb, I agree.)
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 08, 2019, 05:43:41 am
No worries! After all this is just a hobby at the end of the day.

I'll have a look at that new update as soon as I get a chance.
I've been pretty busy, too actually. (Still want to try doing some mock ups to illustrate my ideas.)

EDIT:
Fuck it! I did it live!

Magic Changing Frost Giant Garland Bug: Fixed. Tested on the CREEPS too and they didn't change either.

Premature Inventory Scrolling in Shops: Fixed. Tested with 1, 2, 3, 4, 5, and 6 items in the inventory to make sextuple-sure it worked right.

However...

The XP/Gil rewards are still coming in from every enemy, not just IMPs, way too high. Has nothing to do with the magic change bug as far as I can tell.

I noticed another bug in the shops. The EXIT command is borked. It just opens the sell menu instead of leaving the shop.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on March 08, 2019, 11:12:50 am
Is there a git page for this?  If not, it might be worth considering setting one up.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: KingMike on March 08, 2019, 01:27:03 pm
Whew, that's a lot... I'll just touch on a few things for now:

You can delete in the save/load screen! Press Start + Select at the same time (holding down one and then the other doesn't work, haven't figured that out yet. Gotta press both at once.)

NES games usually program it to store both HELD and PUSHED states of the controller buttons, somewhere in RAM.
(HELD being the exact state of the controller data, PUSHED being the state after some filtering to remove buttons held on continuous frames, or whatever the polling interval is)
I suppose you could experiment with those.

It would be very easy to find the RAM, just do a breakpoint for $4016 and look where its shifting the data to.

Maybe mess with combinations like Start+Select "HELD" (I suppose consequential repeated erasing of SRAM wouldn't hurt).
Or check if Select PUSHED + Start HELD and the reverse.
Or maybe two flags, one for each button, set when pushed, and erase when both are set.

There's probably a simpler way I'm missing.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 08, 2019, 11:09:05 pm
Maybe mess with combinations like Start+Select "HELD" (I suppose consequential repeated erasing of SRAM wouldn't hurt).

I figured it out! It does have variables for different button states, but whatever I was trying last time to read them wasn't working, but it does now. When Start + Select are held, the "joy" variable is #$30, and I was able to have it branch off a CMP. I don't remember why I was having trouble before when I tried almost the same thing...

Is there a git page for this?  If not, it might be worth considering setting one up.

I've been afraid to spend a day figuring out how github works... But yeah, that's really something I should sort out real soon. Edit: Someone helped me out with it!

https://github.com/JiggeryPonkery/FF1-MMC5

The XP/Gil rewards are still coming in from every enemy, not just IMPs, way too high. Has nothing to do with the magic change bug as far as I can tell.

I noticed another bug in the shops. The EXIT command is borked. It just opens the sell menu instead of leaving the shop.

Oops, my bad with the exit shop. I tried to save a few bytes (me: why does it need to CMP #1 there's only buy and sell... one BNE and one BEQ!) and forgot there was actually a third option...

So for the XP/Gil... This is how it looks when the game is checking the stats. (Using Mesen's RAM viewer.)

(https://cdn.discordapp.com/attachments/509200240092643338/553786914034155521/Capture.PNG)

For some reason, LoadEnemyStats wasn't filling the whole area that enemy stats actually occupy. It grabs all those bytes and combines them into the Gil/XP rewards. So there were some random non-0 bytes where the blue is, maybe? I updated the routine to clear those 256 bytes to 0 before writing enemy stats, so it might be fixed, or that might not have been the issue. But the rest of the code seems fine, and from the looks of things, its definitely grabbing the right bytes to check... I can't think of what else it could be.

So, again, all those little fixes in the last link!
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 09, 2019, 04:34:59 am
Groovy! I can confirm that the XP/Gil, file delete, and exit commands are all fixed.
There are still a few more things left, plus I noticed another one.
Whenever I appear on the world map the party is always facing right.
This occurs even if I just enter the menu and then exit.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 09, 2019, 03:22:07 pm
Yay! And Boo.

So I was trying to cheat to check out the pirates, to make sure battles with 9 enemies were loading right. I thought, maybe changing these two positioning variables would teleport me - "unsram_ow_scroll_x" and "unsram_ow_scroll_y". That didn't work, so I looked them up to see what they do, and far as I can tell, they're only used to set the starting positions. So I thought, well that's silly to fill up two bytes of SRAM for something you can just hardcode. But what if people want to change it? I'll set up some constants! But then I forgot you needed a # in front of constant variables to actually make them work as numbers, so it was loading new games at coordinates 0, 0. So I just undid everything I changed and left it alone because I needed to get back on track and not be distracted from my original goal.

Except... I didn't undo everything I changed, I guess? I don't know how I could have messed up the direction you face on loading the overworld. But now I see that Standard maps have this:
LDA #DOWN
STA facing
...and the overworld doesn't seem to set facing at all? It just clears it to 0, then does a routine that sets it to 8 but gets set to 0 again after.


Edit: So for a while I'm going to focus on cleaning up the code that's there. Re-arrange things, make fancy headers for routines, make it look good, like Disch had it before.

Also, I re-arranged all of Bank 0 and freed up 736 bytes. Lots of padding in there to make sure data was on page boundaries or whatnot. I just swapped the data around so there's less need for padding. And re-wrote the game_flags initialization, since its 7 0s and 249 1s. So now it fills with 1s with a loop, then writes the 7 0s to the proper spots. Have not uploaded these changes yet.

I ran into Kary during testing and she cast Fire 3, which was ineffective. Gotta look into that, too.

Gave imps Kary's AI and they were able to cast Fire 3 just fine?



For the item buying bug:

 @CompletePurchase:   
    LDA MMC5_tmp
    LDX shop_curitem
    ORA items, X ; <- add this line
    STA items, X
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 10, 2019, 05:49:37 am
Cool. Tidying up and rearranging the code will help to better manage the new additions you want to do and make it easier on anyone else who wants to edit the game.

I’m going to go back and review my posts so i can double check any remaining bugs I noticed.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 14, 2019, 10:37:06 am
(https://cdn.discordapp.com/attachments/527351555779723266/555629776929423363/Capture.PNG)

Anyone know what this means? Despite the error, it seems to compile just fine...
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Mari42 on March 14, 2019, 11:02:47 am
(https://cdn.discordapp.com/attachments/527351555779723266/555629776929423363/Capture.PNG)

Anyone know what this means? Despite the error, it seems to compile just fine...

https://forums.nesdev.com/viewtopic.php?f=10&t=14315#p172009
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 14, 2019, 09:00:15 pm
Huh, I didn't change anything to do with that, but its not doing it anymore.

Hey, @Disch! FFHackster is the only source for FF1's treasure table converted into items that I've been able to find. Is there any chance you still have the raw, but converted data? Would save me from having to go through the drop-down and tag every single byte... like this:

Code: [Select]
lut_Treasure:
.byte $00, $00 ; 00 ; "Unused" ;
.byte $00, $47 ; 01 ; "Coneria 1" ; Iron Armor
.byte $00, $55 ; 02 ; "Coneria 2" ; Iron shield
.byte $00, $06 ; 03 ; "Coneria 3" ; TNT
.byte $00, $26 ; 04 ; "Coneria 4" ; Iron staff
.byte $00, $27 ; 05 ; "Coneria 5" ; Sabre
.byte $00, $2B ; 06 ; "Coneria 6" ; Silver knife

I'm poking at the treasure chest system. Now the first byte informs what kind of item it is, so that there can be more than 256 item IDs. Weapons and armor are split from other items so there can be more of them. But now I gotta re-do every single byte, after figuring out what the original item was supposed to be!
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on March 14, 2019, 11:55:05 pm
Hey, @Disch! FFHackster is the only source for FF1's treasure table converted into items that I've been able to find. Is there any chance you still have the raw, but converted data? Would save me from having to go through the drop-down and tag every single byte... like this:

"raw but converted"?  lol   :P

So going by your example it looks like there are 2 strings you're looking for:  The label name, and the actual item name.

Hackster pulls the label names from the FFHackster.dat file in its directory.  It's a binary file -- I was young... sorry.  You can open it with a hex editor though and the labels are visible at offset 0x51AA, and each label name is exactly 31 characters (if the label is shorter, it's padded with zeros).

The item name ares looked up from the in-game item table, though, so those are not stored anywhere.


I could probably write up a quick-ish Python script to generate that lut_Treasure table in your example.  And while I'm doing that, I might as well convert to the new format you're looking for so you don't have to do it manually.

Can you describe the final format you're shooting for?  You said the first byte is the item type, is it 00=item, 01=weapon, 02=armor, etc?  And are weapons/armor now zero based (weapon 0 = small knife)?  Full spec plz.

Once I have that I'll throw together a script for ya.


EDIT:  The other question is, if I convert the table, do you need the item names?  Extracting the item names would actually be the hardest part because I have to parse a table file and all that nonsense.  Although I might have some python code for loading tables lying around....

Like if I just gave you a file that looked like this:

Code: [Select]
lut_Treasure:
.byte $00, $00     ; Unused
.byte $02, $07     ; Coneria 1
.byte $02, $13     ; Coneria 2
; ...

Would that be good enough?
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 15, 2019, 12:45:55 am
Ooo... no, its the item names I want! I got the label list from something else--one of the other FF1 docs floating around here, I think.

The format is...
;; If the first byte is $00, the second byte is $70 or higher (80 possible amounts of gold)
;; If the first byte is $01, its an item, key item, or magic:
;; second byte: $1 through $0F are consumables   (15 possible items)
;; second byte: $10 through $2F are key items    (32 possible key items)
;; second byte: $30 through $6F are magic spells (64 possible spells)
;; If the first byte is $02, its weapons or armor:
;; $0 through $3F are weapons     (64 possible weapons)
;; $40 through $7F are armors     (64 possible armors)

The weapons/armour table is 0 based, so that it caps at $7F, but I think I kept the IDs the same, so nunchucks are 01, small knife is 02.. Everything else shares the same table as before, but spells are moved up before the amount of gold in chests.

This is how I've got the items organized now... probably not going to change them after this unless something drastic happens, but I think this is a good enough amount of new items.
Code: [Select]
lut_ItemNamePtrTbl:
.word BLANK             ; 00
.word NAME_HEAL         ; 01
.word NAME_X_HEAL       ; 02
.word NAME_ETHER        ; 03
.word NAME_ELIXIR       ; 04
.word NAME_PURE         ; 05
.word NAME_SOFT         ; 06
.word NAME_P_DOWN       ; 07
.word NAME_TENT         ; 08
.word NAME_CABIN        ; 09
.word NAME_HOUSE        ; 0A
.word NAME_EYEDROPS     ; 0B
.word NAME_SMOKEBOMB    ; 0C
.word NAME_HORN         ; 0D
.word BLANK             ; 0E
.word BLANK             ; 0F

;; Key Items
.word NAME_LUTE         ; 10
.word NAME_CROWN        ; 11
.word NAME_CRYSTAL      ; 12
.word NAME_HERB         ; 13
.word NAME_KEY          ; 14
.word NAME_TNT          ; 15
.word NAME_ADAMANT      ; 16
.word NAME_SLAB         ; 17
.word NAME_RUBY         ; 18
.word NAME_ROD          ; 19
.word NAME_FLOATER      ; 1A
.word NAME_CHIME        ; 1B
.word NAME_TAIL         ; 1C
.word NAME_CUBE         ; 1D
.word NAME_BOTTLE       ; 1E
.word NAME_OXYALE       ; 1F
.word NAME_CANOE        ; 20
.word BLANK             ; 21
.word BLANK             ; 22
.word BLANK             ; 23
.word BLANK             ; 24
.word BLANK             ; 25
.word BLANK             ; 26
.word BLANK             ; 27
.word BLANK             ; 28
.word BLANK             ; 29
.word BLANK             ; 2A
.word BLANK             ; 2B
.word ORB1              ; 2C
.word ORB2              ; 2D
.word ORB3              ; 2E
.word ORB4              ; 2F

.word SPELL1       ; 30
.word SPELL2       ; 31
.word SPELL3       ; 32
.word SPELL4       ; 33
.word SPELL5       ; 34
.word SPELL6       ; 35
.word SPELL7       ; 36
.word SPELL8       ; 37
.word SPELL9       ; 38
.word SPELL10      ; 39
.word SPELL11      ; 3A
.word SPELL12      ; 3B
.word SPELL13      ; 3C
.word SPELL14      ; 3D
.word SPELL15      ; 3E
.word SPELL16      ; 3F
.word SPELL17      ; 40
.word SPELL18      ; 41
.word SPELL19      ; 42
.word SPELL20      ; 43
.word SPELL21      ; 44
.word SPELL22      ; 45
.word SPELL23      ; 46
.word SPELL24      ; 47
.word SPELL25      ; 48
.word SPELL26      ; 49
.word SPELL27      ; 4A
.word SPELL28      ; 4B
.word SPELL29      ; 4C
.word SPELL30      ; 4D
.word SPELL31      ; 4E
.word SPELL32      ; 4F
.word SPELL33      ; 50
.word SPELL34      ; 51
.word SPELL35      ; 52
.word SPELL36      ; 53
.word SPELL37      ; 54
.word SPELL38      ; 55
.word SPELL39      ; 56
.word SPELL40      ; 57
.word SPELL41      ; 58
.word SPELL42      ; 59
.word SPELL43      ; 5A
.word SPELL44      ; 5B
.word SPELL45      ; 5C
.word SPELL46      ; 5D
.word SPELL47      ; 5E
.word SPELL48      ; 5F
.word SPELL49      ; 60
.word SPELL50      ; 61
.word SPELL51      ; 62
.word SPELL52      ; 63
.word SPELL53      ; 64
.word SPELL54      ; 65
.word SPELL55      ; 66
.word SPELL56      ; 67
.word SPELL57      ; 68
.word SPELL58      ; 69
.word SPELL59      ; 6A
.word SPELL60      ; 6B
.word SPELL61      ; 6C
.word SPELL62      ; 6D
.word SPELL63      ; 6E
.word SPELL64      ; 6F

.word MoneyChest1  ; 70
.word MoneyChest2  ; 71
.word MoneyChest3  ; 72
.word MoneyChest4  ; 73
.word MoneyChest5  ; 74
.word MoneyChest6  ; 75
.word MoneyChest7  ; 76
.word MoneyChest8  ; 77
.word MoneyChest9  ; 78
.word MoneyChest10 ; 79
.word MoneyChest11 ; 7A
.word MoneyChest12 ; 7B
.word MoneyChest13 ; 7C
.word MoneyChest14 ; 7D
.word MoneyChest15 ; 7E
.word MoneyChest16 ; 7F
.word MoneyChest17 ; 80
.word MoneyChest18 ; 81
.word MoneyChest19 ; 82
.word MoneyChest20 ; 83
.word MoneyChest21 ; 84
.word MoneyChest22 ; 85
.word MoneyChest23 ; 86
.word MoneyChest24 ; 87
.word MoneyChest25 ; 88
.word MoneyChest26 ; 89
.word MoneyChest27 ; 8A
.word MoneyChest28 ; 8B
.word MoneyChest29 ; 8C
.word MoneyChest30 ; 8D
.word MoneyChest31 ; 8E
.word MoneyChest32 ; 8F
.word MoneyChest33 ; 90
.word MoneyChest34 ; 91
.word MoneyChest35 ; 92
.word MoneyChest36 ; 93
.word MoneyChest37 ; 94
.word MoneyChest38 ; 95
.word MoneyChest39 ; 96
.word MoneyChest40 ; 97
.word MoneyChest41 ; 98
.word MoneyChest42 ; 99
.word MoneyChest43 ; 9A
.word MoneyChest44 ; 9B
.word MoneyChest45 ; 9C
.word MoneyChest46 ; 9D
.word MoneyChest47 ; 9E
.word MoneyChest48 ; 9F
.word MoneyChest49 ; A0
.word MoneyChest50 ; A1
.word MoneyChest51 ; A2
.word MoneyChest52 ; A3
.word MoneyChest53 ; A4
.word MoneyChest54 ; A5
.word MoneyChest55 ; A6
.word MoneyChest56 ; A7
.word MoneyChest57 ; A8
.word MoneyChest58 ; A9
.word MoneyChest59 ; AA
.word MoneyChest60 ; AB
.word MoneyChest61 ; AC
.word MoneyChest62 ; AD
.word MoneyChest63 ; AE
.word MoneyChest64 ; AF
.word MoneyChest65 ; B0
.word MoneyChest66 ; B1
.word MoneyChest67 ; B2
.word MoneyChest68 ; B3
.word MoneyChest69 ; B4
.word MoneyChest70 ; B5
.word MoneyChest71 ; B6
.word MoneyChest72 ; B7
.word MoneyChest73 ; B8
.word MoneyChest74 ; B9
.word MoneyChest75 ; BA
.word MoneyChest76 ; BB
.word MoneyChest77 ; BC
.word MoneyChest78 ; BD
.word MoneyChest79 ; BE
.word MoneyChest80 ; BF

My treasure table looks like this so far:
Code: [Select]
lut_Treasure:
.byte $00, $00      ; 00 ; "Unused" ;
.byte $02, ARMOR4   ; 01 ; "Coneria 1" ; Iron Armor
.byte $02, $55      ; 02 ; "Coneria 2" ; Iron shield
.byte $01, TNT      ; 03 ; "Coneria 3" ; TNT
.byte $02, $26      ; 04 ; "Coneria 4" ; Iron staff
.byte $02, $27      ; 05 ; "Coneria 5" ; Sabre
.byte $02, $2B      ; 06 ; "Coneria 6" ; Silver knife
.byte $01, CABIN    ; 07 ; "Temple of Fiends 1" ; Cabin
.byte $01, HEAL     ; 08 ; "Temple of Fiends 2" ; Heal
.byte $02, $5D      ; 09 ; "Temple of Fiends 3" ; Cap
.byte $02, $36      ; 0A ; "Temple of Fiends 4" ; Rune sword
.byte $02, $35      ; 0B ; "Temple of Fiends 5" ; Were sword
.byte $01, SOFT     ; 0C ; "Temple of Fiends 6" ; Soft
.byte $02, $2D      ; 0D ; "Elfland 1" ; Silver helm
.byte $00, $81      ; 0E ; "Elfland 2" ; 400 g
.byte $00, $7E      ; 0F ; "Elfland 3" ; 330 g
.byte $02, $65      ; 10 ; "Elfland 4" ; Copper gloves
.byte $02, $37      ; 11 ; "NorthWest Castle 1" ; Power staff
.byte $02, $66      ; 12 ; "NorthWest Castle 2" ; Iron gloves
.byte $02, $2A      ; 13 ; "NorthWest Castle 3" ; Falchon
.byte $00, $7B      ; 14 ; "Marsh Cave 1" ; 259 g
.byte $00, $4E      ; 15 ; "Marsh Cave 2" ;
.byte $01, HOUSE    ; 16 ; "Marsh Cave 3" ; House
.byte $00, $80      ; 17 ; "Marsh Cave 4" ;
.byte $00, $86      ; 18 ; "Marsh Cave 5" ;
.byte $00, $21      ; 19 ; "Marsh Cave 6" ;
.byte $00, $87      ; 1A ; "Marsh Cave 7" ;
.byte $00, $25      ; 1B ; "Marsh Cave 8" ;
.byte $01, CROWN    ; 1C ; "Marsh Cave 9" ; CROWN

I was gonna make it really easy to edit by putting like, WEAPON1, WEAPON2, etc, in Constants. Maybe even sub-categorize that, so its KNIFE1, SWORD1, HAMMER1, STAFF1, and so on for weapons, and BODY1, HEAD1, ARMS1 and such for armors.

Just having the original item for reference in a list would be a big help, so don't go out of your way to convert it all perfectly unless... that's fun for you? XD
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on March 15, 2019, 01:08:27 pm
Okay well I got lazy and scrapped the idea of doing the conversion and just have the labels and item names:

Code: [Select]
Unused                 -
Coneria 1              - Iron   Armor
Coneria 2              - Iron   Shield
Coneria 3              - TNT   
Coneria 4              - Iron   Staff
Coneria 5              - Sabre 
Coneria 6              - Silver Knife
Temple of Fiends 1     - CABIN 
Temple of Fiends 2     - HEAL Potion
Temple of Fiends 3     - Cap   
Temple of Fiends 4     - Rune   Sword
Temple of Fiends 5     - Were   Sword
Temple of Fiends 6     - SOFT Potion 
Elfland 1              - Silver Hammer
Elfland 2              - 400 G
Elfland 3              - 330 G
Elfland 4              - Copper Gauntlets
NorthWest Castle 1     - Power  Staff
NorthWest Castle 2     - Iron   Gauntlets
NorthWest Castle 3     - Falchon
Marsh Cave 1           - 295 G
Marsh Cave 2           - Copper Bracelet
Marsh Cave 3           - HOUSE 
Marsh Cave 4           - 385 G
Marsh Cave 5           - 620 G
Marsh Cave 6           - Short  Sword
Marsh Cave 7           - 680 G
Marsh Cave 8           - Large  Knife
Marsh Cave 9           - CROWN 
Marsh Cave 10          - Iron   Armor
Marsh Cave 11          - Silver Bracelet
Marsh Cave 12          - Silver Knife
Marsh Cave 13          - 1020 G
Dwarf Cave 1           - 450 G
Dwarf Cave 2           - 575 G
Dwarf Cave 3           - CABIN 
Dwarf Cave 4           - Iron   Helmet
Dwarf Cave 5           - Wooden Helmet
Dwarf Cave 6           - Dragon Sword
Dwarf Cave 7           - Silver Knife
Dwarf Cave 8           - Silver Armor
Dwarf Cave 9           - 575 G
Dwarf Cave 10          - HOUSE 
Matoya's Cave 1        - HEAL Potion
Matoya's Cave 2        - PURE Potion
Matoya's Cave 3        - HEAL Potion
Earth Cave 1           - 880 G
Earth Cave 2           - HEAL Potion
Earth Cave 3           - PURE Potion
Earth Cave 4           - 795 G
Earth Cave 5           - 1975 G
Earth Cave 6           - Coral  Sword
Earth Cave 7           - CABIN 
Earth Cave 8           - 330 G
Earth Cave 9           - 5000 G
Earth Cave 10          - Wooden Shield
Earth Cave 11          - 575 G
Earth Cave 12          - 1020 G
Earth Cave 13          - 3400 G
Earth Cave 14          - TENT   
Earth Cave 15          - HEAL Potion
Earth Cave 16          - RUBY   
Earth Cave 17          - 1250 G
Earth Cave 18          - Silver Shield
Earth Cave 19          - CABIN 
Earth Cave 20          - 5450 G
Earth Cave 21          - 1520 G
Earth Cave 22          - Wooden Staff
Earth Cave 23          - 3400 G
Earth Cave 24          - 1455 G
Titan's Tunnel 1       - Silver Helmet
Titan's Tunnel 2       - 450 G
Titan's Tunnel 3       - 620 G
Titan's Tunnel 4       - Great  Axe
Gurgu Volcano 1        - HEAL Potion
Gurgu Volcano 2        - CABIN 
Gurgu Volcano 3        - 1975 G
Gurgu Volcano 4        - PURE Potion
Gurgu Volcano 5        - HEAL Potion
Gurgu Volcano 6        - 1455 G
Gurgu Volcano 7        - Silver Shield
Gurgu Volcano 8        - 1520 G
Gurgu Volcano 9        - Silver Helmet
Gurgu Volcano 10       - Silver Gauntlets
Gurgu Volcano 11       - 1760 G
Gurgu Volcano 12       - Silver Axe
Gurgu Volcano 13       - 795 G
Gurgu Volcano 14       - 750 G
Gurgu Volcano 15       - Giant  Sword
Gurgu Volcano 16       - 4150 G
Gurgu Volcano 17       - 1520 G
Gurgu Volcano 18       - Silver Helmet
Gurgu Volcano 19       - SOFT Potion 
Gurgu Volcano 20       - 2750 G
Gurgu Volcano 21       - 1760 G
Gurgu Volcano 22       - Wooden Staff
Gurgu Volcano 23       - 1250 G
Gurgu Volcano 24       - 10 G
Gurgu Volcano 25       - 155 G
Gurgu Volcano 26       - HOUSE 
Gurgu Volcano 27       - 2000 G
Gurgu Volcano 28       - Ice    Sword
Gurgu Volcano 29       - 880 G
Gurgu Volcano 30       - PURE Potion
Gurgu Volcano 31       - Flame  Shield
Gurgu Volcano 32       - 7340 G
Gurgu Volcano 33       - Flame  Armor
Ice Cave 1             - HEAL Potion
Ice Cave 2             - 10000 G
Ice Cave 3             - 9500 G
Ice Cave 4             - TENT   
Ice Cave 5             - Ice    Shield
Ice Cave 6             - Cloth 
Ice Cave 7             - Flame  Sword
Ice Cave 8             - FLOATER
Ice Cave 9             - 7900 G
Ice Cave 10            - 5450 G
Ice Cave 11            - 9900 G
Ice Cave 12            - 5000 G
Ice Cave 13            - 180 G
Ice Cave 14            - 12350 G
Ice Cave 15            - Silver Gauntlets
Ice Cave 16            - Ice    Armor
Castle of Ordeal 1     - Zeus   Gauntlets
Castle of Ordeal 2     - HOUSE 
Castle of Ordeal 3     - 1455 G
Castle of Ordeal 4     - 7340 G
Castle of Ordeal 5     - Gold   Bracelet
Castle of Ordeal 6     - Ice    Sword
Castle of Ordeal 7     - Iron   Gauntlets
Castle of Ordeal 8     - Heal   Staff
Castle of Ordeal 9     - TAIL   
Cardia 1               - 1455 G
Cardia 2               - 2000 G
Cardia 3               - 2750 G
Cardia 4               - 2750 G
Cardia 5               - 1520 G
Cardia 6               - 10 G
Cardia 7               - 500 G
Cardia 8               - HOUSE 
Cardia 9               - 575 G
Cardia 10              - SOFT Potion 
Cardia 11              - CABIN 
Cardia 12              - 9500 G
Cardia 13              - 160 G
Not Used 1             - 530 G
Not Used 2             - Small  Knife
Not Used 3             - Cap   
Not Used 4             - Zeus   Gauntlets
Sea Shrine 1           - Ribbon 
Sea Shrine 2           - 9900 G
Sea Shrine 3           - 7340 G
Sea Shrine 4           - 2750 G
Sea Shrine 5           - 7690 G
Sea Shrine 6           - 8135 G
Sea Shrine 7           - 5450 G
Sea Shrine 8           - 385 G
Sea Shrine 9           - Power  Gauntlets
Sea Shrine 10          - Light  Axe
Sea Shrine 11          - 9900 G
Sea Shrine 12          - 2000 G
Sea Shrine 13          - 450 G
Sea Shrine 14          - 110 G
Sea Shrine 15          - Light  Axe
Sea Shrine 16          - Opal   Armor
Sea Shrine 17          - 20 G
Sea Shrine 18          - Mage   Staff
Sea Shrine 19          - 12350 G
Sea Shrine 20          - 9000 G
Sea Shrine 21          - 1760 G
Sea Shrine 22          - Opal   Bracelet
Sea Shrine 23          - 2750 G
Sea Shrine 24          - 10000 G
Sea Shrine 25          - 10 G
Sea Shrine 26          - 4150 G
Sea Shrine 27          - 5000 G
Sea Shrine 28          - PURE Potion
Sea Shrine 29          - Opal   Shield
Sea Shrine 30          - Opal   Helmet
Sea Shrine 31          - Opal   Gauntlets
Sea Shrine 32          - SLAB   
Waterfall 1            - Wizard Staff
Waterfall 2            - Ribbon 
Waterfall 3            - 13450 G
Waterfall 4            - 6400 G
Waterfall 5            - 5000 G
Waterfall 6            - Defense
Not Used 5             - HEAL Potion
Not Used 6             - HEAL Potion
Not Used 7             - HEAL Potion
Not Used 8             - HEAL Potion
Not Used 9             - HEAL Potion
Not Used 10            - HEAL Potion
Not Used 11            - HEAL Potion
Not Used 12            - HEAL Potion
Not Used 13            - HEAL Potion
Mirage Tower 1         - Aegis  Shield
Mirage Tower 2         - 2750 G
Mirage Tower 3         - 3400 G
Mirage Tower 4         - 18010 G
Mirage Tower 5         - CABIN 
Mirage Tower 6         - Heal   Helmet
Mirage Tower 7         - 880 G
Mirage Tower 8         - Vorpal
Mirage Tower 9         - HOUSE 
Mirage Tower 10        - 7690 G
Mirage Tower 11        - Sun    Sword
Mirage Tower 12        - 10000 G
Mirage Tower 13        - Dragon Armor
Mirage Tower 14        - 8135 G
Mirage Tower 15        - 7900 G
Mirage Tower 16        - Thor   Hammer
Mirage Tower 17        - 12350 G
Mirage Tower 18        - 13000 G
Sky Palace 1           - 9900 G
Sky Palace 2           - HEAL Potion
Sky Palace 3           - 4150 G
Sky Palace 4           - 7900 G
Sky Palace 5           - 5000 G
Sky Palace 6           - ProRing
Sky Palace 7           - 6720 G
Sky Palace 8           - Heal   Helmet
Sky Palace 9           - 180 G
Sky Palace 10          - Bane   Sword
Sky Palace 11          - White  Shirt
Sky Palace 12          - Black  Shirt
Sky Palace 13          - Ribbon 
Sky Palace 14          - Opal   Gauntlets
Sky Palace 15          - Opal   Shield
Sky Palace 16          - Silver Helmet
Sky Palace 17          - HOUSE 
Sky Palace 18          - 880 G
Sky Palace 19          - 13000 G
Sky Palace 20          - ADAMANT
Sky Palace 21          - 4150 G
Sky Palace 22          - SOFT Potion 
Sky Palace 23          - 3400 G
Sky Palace 24          - Katana
Sky Palace 25          - ProCape
Sky Palace 26          - Cloth 
Sky Palace 27          - 9500 G
Sky Palace 28          - SOFT Potion 
Sky Palace 29          - 6400 G
Sky Palace 30          - 8135 G
Sky Palace 31          - 9000 G
Sky Palace 32          - HEAL Potion
Sky Palace 33          - ProRing
Sky Palace 34          - 5450 G
ToF Revisited 1        - Masmune
ToF Revisited 2        - 26000 G
ToF Revisited 3        - Katana
ToF Revisited 4        - ProRing
ToF Revisited 5        - ProCape
ToF Revisited 6        - 45000 G
ToF Revisited 7        - 65000 G
Unused                 -

If you want the Python scripts so you can tweak them, lemme know.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 15, 2019, 04:31:56 pm
I don't know how to use python, but this is perfect! Thank you! :D

I'm working on the item menu now... I've got it loading an item's name, then putting all the text blocks into RAM, then printing from that RAM address. Hopefully by time I've got the scroll offset stuff in place, it will be able to print the whole screen in a single V-blank or two!
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on March 15, 2019, 04:59:10 pm
I don't know how to use python

I absolutely love it.

Only on RHDN would someone know 6502 assembly, but not Python.   :laugh:

Anyway, happy to help!  This is a cool project you got going on.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 16, 2019, 12:04:03 am
It still took two hours to do the conversions and re-enter all the bytes... but could have been longer.

(https://cdn.discordapp.com/attachments/527351555779723266/556274546177736715/unknown.png)

Here's a peek! This layout allows 16 items per page. Since you never have more than 16 key items at any one time--using the Herb and TNT and things remove them before you can pick up more--it will never need more space than that. If someone DOES edit the game to add more key items, then they've got the ability to make a third page. Pressing select swaps between consumables and key items.

Now coding in using consumables in the menu... then have to figure out battle use. *cry* X-Heal, Elixir, and Phoenix Down should work as intended (if tmp+2 isn't being used while using heal potions), but Ether is going to need some market research. Need to make a new screen that shows MP and then lets you pick a level to refill. Or should it straight up refill all the character's MP across all levels?

Smokebomb: should it stop enemy encounters for X steps, or just lower them further? In battle, it will put all characters into hiding on use. The horn will wake all characters from sleep. Oh, I should rename that to WakeBell or something...

Is there any benefit to using @Local labels, or is that just for organization? Does it save a byte when they're used or something?
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on March 16, 2019, 04:23:54 am
Quote
Is there any benefit to using @Local labels, or is that just for organization?

You say that as if organization isn't a benefit!

Local variables are a scope restriction.  Scope restrictions avoid name conflicts.  Having scopes allows you to not worry about making every single identifier name 100% unique.  For example, you can have a local "@Loop" label, but a global "Loop" label would probably be disastrous.  Or having a local variable named "@box_x" might be useful for a box drawing routine, but having a global "box_x" label would be less useful, since different routines might use different areas for that variable.

Honestly I wish I used local variables more.  I didn't really take full advantage of them until I got near the end of the disassembly.  Instead, I made that wretched "tmp" space that is horribly unclear.

Quote
Does it save a byte when they're used or something?

Nope.  The final binary is the same.  They're really just there to avoid name conflicts and keep identifiers scope restricted.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 16, 2019, 08:12:14 am
Here's a peek! This layout allows 16 items per page. Since you never have more than 16 key items at any one time--using the Herb and TNT and things remove them before you can pick up more--it will never need more space than that. If someone DOES edit the game to add more key items, then they've got the ability to make a third page. Pressing select swaps between consumables and key items.

Any chance that it could be changed to a mini menu instead of a button press?
Like Final Fantasy 5 & 6 but without the Sort command.
Also, what do you mean by having the ability to add a third page exactly?


Quote
Now coding in using consumables in the menu... then have to figure out battle use. *cry* X-Heal, Elixir, and Phoenix Down should work as intended (if tmp+2 isn't being used while using heal potions), but Ether is going to need some market research. Need to make a new screen that shows MP and then lets you pick a level to refill. Or should it straight up refill all the character's MP across all levels?

I'd keep it simple and have it refill all spell levels at once.
Why make a whole new screen from something as mundane as restoring spell charges when you could use the time and space to do something more interesting?

I'd nix the whole spell level thing entirely like they did in Dawn of Souls and Anniversary Edition.
You'd only need to track one byte or two of MP as opposed to 8 of spell charges and maybe have a separate spell level stat so the game can restrict access to spells of higher levels than a character would be able to cast. Still, that would give you like another 5 free bytes for each character's stats, no?


Quote
Smokebomb: should it stop enemy encounters for X steps, or just lower them further? In battle, it will put all characters into hiding on use. The horn will wake all characters from sleep. Oh, I should rename that to WakeBell or something...

Wakeup Bell would be a nice reference to Bravely Default (which is arguably the true continuation of classic Final Fantasy) if it can fit.
One thing , though, just about every version of the Alarm Clock / Wakeup Bell is a single target item.
Might be better to follow suit, plus how often is most of the party going to asleep all at once to justify sitting through the 4 messages that would trigger on each party member?

As for the Smoke Bomb (should be 2 words), while making everyone hide is a pretty cool idea, it does buck tradition a bit from what it does in every other game in the series.
That said, maybe Smoke Screen would be a better name for it instead?
A single smoke bomb is usually enough for a single person to escape or hide, but a smoke screen by definition implies a larger scale situation like hiding the whole party.
I'm not to sure about having an item that manipulates the encounter rate in a game that already lets you do that through a menu option.
So I would have to go with completely preventing enemy encounters for a noticeable number of steps, or maybe even straight up until the next time you use a warp tile to switch maps.

You may also want to consider having both a Smoke Bomb and a Smoke Screen.
Having a traditional Smoke Bomb item might be very useful if all your casters are dead or you are playing with an all martial team.
I'm thinking it would function like the warp spell out of battle, and it would have a 100% escape effect in battle.

Anyway, great work on the item menu so far. Can't wait to try it out for myself. :cheers:
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 19, 2019, 08:16:25 pm
Nope.  The final binary is the same.  They're really just there to avoid name conflicts and keep identifiers scope restricted.
Ooh, good to know. I've been moving so many little things around, wondering if it will make a difference--hoping it does, because that's the point.

Any chance that it could be changed to a mini menu instead of a button press?

Why not both?

Consumables:
(https://cdn.discordapp.com/attachments/294356735714394112/557711267981164564/Capture.PNG)
Elixir Screen:
(https://cdn.discordapp.com/attachments/294356735714394112/557711516326166539/unknown.png)
Ether Screen:
(https://cdn.discordapp.com/attachments/294356735714394112/557715111138033697/unknown.png)

I went with Wakeup Bell because Alarm clocks just... don't make sense? And I couldn't figure out what kind of horn icon to make. Birthday party horn? Big tuba? Keeping Smoke bomb because of the 8 character limit (12 for key items.) Could be 9, but it would look ugly pressing up against the numbers...

Ultimate goal is probably VWF, but that's... like, the last thing, maybe.

I want to make the sleep ailment more dangerous. I've made it harder to wake up from than stun, and I made it use the death pose, have 'em all zonked out. I don't think I've EVER been put to sleep in the original game, so I'd like to see more enemies use it.

I might be the only one who really likes the MP per level system... It definitely adds some strategy and difficulty that's different than just making enemies have more health. Saving up your biggest spells for the boss, or using them on those #@&!%in' sorcerers in the ice cave and the ghosts in the  underwater palace? Being forced to fall back on lower-level spells makes you feel desperate and in danger, instead of spamming ethers and your highest spell. So thinking on that, I decided refilling the whole MP pool was a little OP. Elixirs do it, but if I was going to re-design the dungeons and everything, you'd get maybe 5 of them in the whole game...

I updated all the shops to use the new item IDs, did a bit more cleanup of things here and there--its all blurry now. Re-wrote item messages to be simpler. CURE spells now use the same message as Heal and X-Heal, things like that. As you can see in the screenshot, tents, cabins, and houses now have a confirmation before use, and so should the WARP and EXIT spells.

Next steps:
Implement code for smoke bombs...
Magic swapping...
And finally delve into adding the new items in battle.

Edit: Oh, yeah, finally fixed the weird sluggishness in the Options menu. Turns out drawing the text every frame was ... happening. Now it only updates when it needs to.

I'm still unsure about how to update things with github so I'm gonna try to finish a few more things before putting the changes up...?
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Disch on March 19, 2019, 08:56:38 pm
I assume that's supposed to be Phoenix Down, but since you used the icon for down it ends up reading like "Down down"   :laugh:


Quote
I'm still unsure about how to update things with github so I'm gonna try to finish a few more things before putting the changes up...?


I assume you have git installed?  From a command prompt in your project's root directory:
Code: [Select]
git add .
git commit -m "Put a message here to indicate what you changed with this commit"
git push

'add .' adds all changed files to the list of files to be committed.
'commit' actually commits them (basically saves/backs them up).  Note that commit only commits locally (does not update github)
'push' pushes the committed changes to the remote repo (updates github)


...

But really, I recommend just getting a gui program like SmartGit (free for noncommercial use).  It shows you what files you've changed, and you can just click a button to push them.

(https://i.imgur.com/9RMRp52.png)

Hardest part will be setting SmartGit up to work with your repo, but that's a one time thing and once you figure it out it's pretty easy to do it again.  It has a wizard that sort of walks you through it but if you are completely unfamiliar with git you might not understand some of the lingo.


If you have uncommitted changes it might be tricky.  Here's what I'd do to set up SmartGit:

1 )  Move your entire project directory somewhere else (or just rename the directory it's in).  So the directory where you want your project is entirely empty.
2 )  From SmartGit, Go in the 'Repository' menu, and select 'Clone'
3 )  Follow the prompts.  Select "Remote Git Repository" and give it the URL to your github page
4 )  All the "Selection" stuff can be left to their defaults
5 )  And the "Local Directory" is where you want your project to be
6 )  Once done, it'll clone what was pushed to your repo (what is currently on github)
7 )  Copy/paste your more recently modified files over that (but do NOT copy any hidden '.git/' folders)
8 )  Use SmartGit to commit/push


Note I'm making this all sound a lot more complicated than it is.  It's actually really easy once you do it.  It's only really tricky because of the unpushed changes.  If you push everything with git first, then you can just delete your local copy and do only steps 2-6 above.



EDIT:

As for a few good git practices once you have things set up:

1 ) Don't work directly out of your master.  Whenever you are working on something, branch off of master into a new branch (commonly referred to as a "feature branch").  Try to keep master in stable/working condition at all times.  That way if something REALLY gets hecked up, you can very easily toss your feature branch and fall back to master.

2 ) Commit to your feature branch very frequently.  Keep commits small and keep them frequent.  Once a day at the VERY LEAST (assuming you did work that day).  Often, do more.  Basically any meaningful incremental change should be its own commit.  Each commit is effectively a full backup, and is as easy as a button press.  So if something gets broken, you can easily roll back to see where the problem started.

3 ) Merge your feature branch(es) back into master when you're confident they're stable.  Basically the feature branch gets the small incremental changes you made when adding the feature, and the merge from feature->master is the full & complete feature/bugfix.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 19, 2019, 10:54:25 pm
I want to make the sleep ailment more dangerous. I've made it harder to wake up from than stun, and I made it use the death pose, have 'em all zonked out. I don't think I've EVER been put to sleep in the original game, so I'd like to see more enemies use it.

That doesn't really make sense to me.

Sleep is supposed to be less serious than stun.
I've always viewed the sleep ailment as just being put into a state of rest, that is why in most of the rest of the series you can wake up after taking a physical hit.

Stun, on the other hand, is actually paralysis in the original Japanese.
It is used for both the Hold and Stop spells and is most definitely seems intended to be the more serious condition.
Even the formulas that determine if you wake up each round support this with sleep being progressively easier to wake up from as your HP increases

Changing it to use the death pose sounds like a good idea. That does make more sense.

Not being put to sleep often was definitely not my experience, though I will admit that I remember clearly getting stunned a hell of a lot more often.

I think that changing sleep to not be dependent on max HP would be a good idea.
Maybe having a few more enemies cause it is fine too, as long as you don't go overboard.
However, I'd also suggest that you have physical damage remove sleep like in the later games.
But elevating it above stun seems too drastic, and potentially balance breaking.
And, honestly, stun is already annoying enough without piling sleep into that category.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 20, 2019, 06:01:15 pm
Currently, enemies have a 25% chance to recover from stuns, and a 10% chance to recover from sleep. Maybe that's what I was thinking of. Players have a 50% chance to wake, and 25% chance to get over a stun. I did do away with max HP helping with waking up.

Hm. You give a good argument. My thought was that sleeping is a deeper unconscious state, and that a stun was like a whack on the head that should be shaken off easier. But waking from sleep on getting hit is something I can and should do, so maybe the Bell could be like... Something to recover from a stun. Should it still be party-wide? Because its an ailment that you can randomly recover from, and turn order is randomized instead of more active-time, I was thinking it would just be double frustration to try and cure something when it gets shaken off the same turn--thus wasting two characters' turns. Whereas if it affects the whole party, you're using one turn to regain three. If it WAS an alarm clock type item, also, it could be set to occur on turn-end, so its more a pre-emptive use situation! Which would be more fun and clever than just being reactive to something after the fact.

(And that's my complaint about ailments in just about any game; its not just something that debilitates my stats, but its something that basically cancels not just one turn, but the turn needed to undo it as well, dragging out battles without giving a whole lot of strategy. Which is another point to Bravely Default, in that there were abilities that depended on enemies having those ailments, and ailments actually hit most enemies, making it a strategy that was sometimes BETTER than mashing the fight command..

I assume that's supposed to be Phoenix Down, but since you used the icon for down it ends up reading like "Down down"   :laugh:

Whups... yeah. I changed it to PhoenixF where F is the feather icon, and looks better now!

I got GitHub desktop installed (Windows 7), I just wasn't sure how to manage things with it. I'm going to work on getting the master thingy stable, since I'm making big, sweeping changes to the organization of the banks and everything, and then start working on updating all the little changes from there on out.

Thanks for the advice. :D
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 21, 2019, 02:20:26 am
Currently, enemies have a 25% chance to recover from stuns, and a 10% chance to recover from sleep. Maybe that's what I was thinking of. Players have a 50% chance to wake, and 25% chance to get over a stun. I did do away with max HP helping with waking up.

Yeah, there is some wierdness with the recovery chances for these.
I think the most reasonable thing to have that is not far off from what the original code intended is for players to wake up from sleep with a base 20% chance + a bonus = Intellect/4.
The chance for an enemy would be the same except it would be a bonus from Magic Defense instead of Intellect because they lack the Intellect stat.
Stun should, IMO, be a fixed number of rounds instead of a percent chance to recover automatically.
That would require the use of few bytes of RAM to use as status counters.


Quote
Hm. You give a good argument. My thought was that sleeping is a deeper unconscious state, and that a stun was like a whack on the head that should be shaken off easier.

Thanks. I had a similar thought initially, but then I remembered a bunch of translation research I did for the game and verified that Stun is actually called Paralysis in the original Japanese text and that it is used as a stun, paralysis, and stop ailment depending on which element it is paired with.


Quote
But waking from sleep on getting hit is something I can and should do,

I support that 1000%.


Quote
so maybe the Bell could be like... Something to recover from a stun.

It would need a different name because of the variety of effects that the stun ailment represents.
What sort of thing could recover you from being knocked out cold, held in place, and negate time being stopped around you?


Quote
Should it still be party-wide? Because its an ailment that you can randomly recover from, and turn order is randomized instead of more active-time, I was thinking it would just be double frustration to try and cure something when it gets shaken off the same turn--thus wasting two characters' turns. Whereas if it affects the whole party, you're using one turn to regain three. If it WAS an alarm clock type item, also, it could be set to occur on turn-end, so its more a pre-emptive use situation! Which would be more fun and clever than just being reactive to something after the fact.

Affecting the whole party seems reasonable to me.


Quote
(And that's my complaint about ailments in just about any game; its not just something that debilitates my stats, but its something that basically cancels not just one turn, but the turn needed to undo it as well, dragging out battles without giving a whole lot of strategy. Which is another point to Bravely Default, in that there were abilities that depended on enemies having those ailments, and ailments actually hit most enemies, making it a strategy that was sometimes BETTER than mashing the fight command..

I agree.
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Jiggers on March 21, 2019, 04:20:00 am
It would need a different name because of the variety of effects that the stun ailment represents.
What sort of thing could recover you from being knocked out cold, held in place, and negate time being stopped around you?

Now that's something I never realized, different stun elements supposed to be different things entirely. Who knows, maybe I'll eventually get around to making a bunch of different ailments based on timers. I already have plans to make a healing spell that heals a bit per round, like regenerating enemies--would use the high bits of the Hidden byte, and subtract $10 every turn, then stop when it hits 0. There's definitely RAM space for some multi-purpose in-battle spell variables of that sort.

I completely broke the options menu. I think I just need to re-write it from scratch. Try to stick it in the Menu bank once I'm done with this.

(https://cdn.discordapp.com/attachments/527351555779723266/558194535193116672/unknown.png)

Forgetting a spell works 100% now. There's 64 bytes after the key items for spells to be stored in their own inventory. I'll make it so buying a spell just puts it in the inventory (caps out at 4; why would you need more?) The Learn option doesn't do anything yet. I need to think of how the screen should look. Spells are 6 letters long, there's 30 tiles inside the box borders, and the cursor needs 2 tiles to not cover letters. I guess there's no helping it, though. The smartest thing to do would be to split it into White and Black magic screens, 4 spells per line, with 1 tile of space between, and have the cursor blocking some letters. Still need the space at the bottom to display things like "That spell level is full" and "you can't learn that"...

Meanwhile, items in the battle menus. 10 consumable items, but the limit is 8 per menu. My thoughts:
Screw the way FF1 does battle boxes for this. Put the names of items that exist into RAM and draw from an offset. 10 items x 8 letters, 1 space, 2 numbers, then line break control code that can be swapped with a terminator. $78 space in RAM, so the printing start point doesn't have to be stupidly far like it did with the main menu item screen. Then scrolling through items just uses the usual drawing routine. I think I should be able to handle that...
Title: Re: FF1 MMC5 Disassembly Updates
Post by: Vanya on March 21, 2019, 01:14:45 pm
A regen spell sounds like a great addition!
As for ailments, The game could really uses at least one more full set of 8 to flesh them out properly and eliminate the need for double duty status. I suppose the easiest way to do that would be to add a new spell effect that has a different set of status ailments.

What is the Hidden Byte? That isn't the Magic Defense byte, is it?

Love the WIP magic menu!
If you mean you can't buy more than 4 iterations of the same spell, then yeah, there's never going to be a need for more than 4 of any spell in any given play-through.

A few thoughts on the text layout of the magic menu...

I don't think you should worry about the cursor overlapping any text as long as it doesn't overlap the spell name it's pointing at.

Do you really need the spell charges to be displayed on the menu directly? The game already shows you your current MP on the main menu and it tells you if a spell has run out of MP when you try to use it as well.

(Come to think of it, this could be one of the reasons the series switched over to a single MP pool; so that it would be less hassle to display current and max MP on the main menu.)

Anyway, it might be better to move the current/max MP over to the status menu in order to save space here.

Also, you have that message box at the bottom to work with. Why not have it there permanently (maybe even expand it to go all the way across the screen) and use it to display the current/max MP as well as a a short description? Plus it might speed things up if it isn't rewriting the whole message box every time it needs to tell you something.

As for the actual spell inventory, splitting it up into White and Black magic is a good idea.

Another option is to do away with individual spell purchases.
You'd increase the cost of buying a spell (2x cost is probably a good median value) and then have it so any character can learn the spell by copying it from the inventory.
Now spells in FF would be more like how spell books are in D&D.
You buy a spell scroll and then any character, that can learn the spell, can copy it to their spell book.
The Learn command would add the spell, but not remove it from inventory.
The Forget command would remove the spell, but not add it to the inventory.
That way you don't have to worry about having multiple copies of a spell in the inventory.
Plus, it would help simplify the magic shops too.

On a side note: It might be a good idea to then also grey out spells on the shop lists that are already in your inventory. That way the player doesn't need to keep track of which spells have been purchased. And then when all the spells have been purchased you could have a message saying, "There is nothing more I can teach you."

You can also maintain the 3 column set up by manipulating the font palette in the inventory.
Display spells your job can learn for the selected level as normal, but the rest are grayed out.
That way you don't have to worry about fitting all the spells of a given level on one line nor restrict them to 6 characters.

Alternatively, you could try only displaying the spells that correspond to the level you selected to learn.

I agree with screwing the way FF does battle boxes! They are definitely too restrictive. Any improvement on that front is welcome.