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

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

Lasciel

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #80 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?

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #81 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.

« Last Edit: March 01, 2019, 03:21:47 pm by Vanya »

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #82 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.)
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #83 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.
« Last Edit: March 01, 2019, 04:30:30 pm by Vanya »

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6905
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #84 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.
"My watch says 30 chickens" Google, 2018

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #85 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.
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #86 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...

« Last Edit: March 01, 2019, 07:48:21 pm by Vanya »

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #87 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:



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)
« Last Edit: March 02, 2019, 02:02:53 am by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #88 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?

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #89 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!
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #90 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.

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #91 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.
« Last Edit: March 02, 2019, 07:30:24 pm by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #92 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?
« Last Edit: March 02, 2019, 08:11:12 pm by Vanya »

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #93 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://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...
« Last Edit: March 03, 2019, 02:31:22 am by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #94 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.
« Last Edit: March 04, 2019, 04:51:30 am by Vanya »

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #95 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
« Last Edit: March 04, 2019, 04:56:42 pm by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #96 on: March 04, 2019, 05:06:26 pm »
The LUT might be a smidge less bytes, I think, but I'm not 100% sure.

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #97 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!
I know exactly what I'm doing. I just don't know what effect it's going to have.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #98 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.
« Last Edit: March 07, 2019, 05:18:06 am by Vanya »

Jiggers

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: FF1 MMC5 Disassembly Updates
« Reply #99 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.)
« Last Edit: March 08, 2019, 04:29:19 am by Jiggers »
I know exactly what I'm doing. I just don't know what effect it's going to have.