EasyRPG / Player

RPG Maker 2000/2003 and EasyRPG games interpreter
https://easyrpg.org/player/
GNU General Public License v3.0
989 stars 185 forks source link

Unimplemented LSD Chunks #1849

Open fmatthew5876 opened 5 years ago

fmatthew5876 commented 5 years ago

RPG_RT will write the SaveInventory::turns chunk to LSD with the number of turns the last battle consisted of.

No idea how this is used, but we should write the chunk to be compatible with 2k and 2k3 battles.

Signals whether we should replay or not the same BGM as current bgm if requested??

???

Used by interpreter to abort execution if configured to do so on escape.

fmatthew5876 commented 5 years ago

Test Cases 1 - Behavior of Music Stopping

  1. Play music twice
    1. PlayBGM X
    2. PlayBGM X again

Result: Nothing happens

  1. Play, Fade, Play
    1. PlayBGM X
    2. FadeBGM
    3. Save -> music_stopping == 1
    4. PlayBGM X

Result: X plays again

  1. Save and load
    1. PlayBGM X
    2. FadeBGM
    3. Save -> music_stopping == 1
    4. Quit and load game

Result: After load the save, BGM is playing and music_stopping == 0 :exclamation: So while this chunk exists in the LSD data, it always gets cleared on load game!

fmatthew5876 commented 4 years ago

Test Cases 2 - abort_on_escape flag

EV01 parallel

Wait 0.0s
Wait 0.0s
OpenSaveMenu
OpenSaveMenu
EraseEvent

EV01 parallel

Wait 0.0s
Battle, interrupt if escape
Sw1 off
EraseEvent

EV02 parallel

Wait 0.0s
Save
EraseEvent
Save EV02 current command EV02 abort on escape
1 2 1
2 3 0
3 4 0

Conclusions

fmatthew5876 commented 4 years ago

This SaveSystem::transparent (0x37) chunk. I'm at a loss for what it does or if it's even a real chunk.

I hacked it into my save game as 1 and I don't notice anything change. I checked messages and the player sprite.

Any ideas?

Ghabry commented 4 years ago

Cherry answered "as far as I know it says whether the messagebox is set to be without background."

fmatthew5876 commented 4 years ago

There is a RPG::System::messageTransparent in dynrpg which maybe maps to this? Need to investigate further.

fmatthew5876 commented 4 years ago

So this chunk actually maps to RPG::System::messageActive in dynrpg. So maybe this is what we call Game_Message::IsMessagePending()?

I'm not sure if it's ever possible to save your game while the message window is up.

fmatthew5876 commented 4 years ago

And it looks like you can call scenes while messages are up.

EV01 trigger

MessageOptions: Allow Events to Continue
Switch 01 On
Msg: Hello

EV02 parallel, from Sw 01

OpenSaveMenu

The save scene will call repeatedly while the message animates and displays.

This feature appears broken, because if you load your game, the message will be gone. We don't emulate this at all in player. It's also not known what else is allowed when "Allow events to continue" is set.

This needs more investigation.

fmatthew5876 commented 4 years ago

So far in dynrpg version I have discovered that this flag is:

I set a break point on reads and I couldn't find anything reading this variable except when you save your game.

The flag never gets reset on the map, even after the message box closes. It doesn't reset if you enter a menu or teleport to another map. It doesn't get set in 2k3 battles for any messages except those caused by events. It gets cleared before the end battle messages.

Looks like an unused / incomplete feature?

fmatthew5876 commented 4 years ago

For the abort_on_escape flag, the interpreter checks it at the beginning of it's main loop.

When the interpreter runs, it checks if this flag is set, and then it checks the battle state to see if the previous battle succeeded or not.

if (abort_on_escape) {
  abort_on_escape = 0;
  if (last_battle_result == escape) {
    EndEvent();
    return;
  }
}

RPG_RT does this on the next frame after the battle when the interpreter. Player does it in a continuation immediately upon finishing the battle.

So there is a subtle timing difference of 1 frame of when this event interpreter is active vs when it is not, which could cause a bug in some games.

fmatthew5876 commented 4 years ago

For messageActive I've discovered something.

When you do ShowMessage, ShowChoices, or ShowNumInput, this flag gets set to 1, and then message is spawned.

When you do other things which spawn messages, such as level up, class change, battle messages, etc.. RPG_RT appends the text to some global variable at 004CDC30.

This thing is likely a pascal TStrings or TStringList object: https://wiki.freepascal.org/TStringList-TStrings_Tutorial

This global is checked when the foreground interpreter is run, if any text is pending in this object, the interpreter breaks out of the loop, sets messageActive=0 and then spawns the message box.

So it looks like this flag might actually mean "Message was created by event".

I still have not found any code which reads or otherwise switches on the flag, other than the code which saves it to LSD.