Skip to content

Interpreter: Implement Maniac SetGameOption operation 1 (variable count)#3544

Open
luadebug wants to merge 1 commit into
EasyRPG:masterfrom
luadebug:setgameoption
Open

Interpreter: Implement Maniac SetGameOption operation 1 (variable count)#3544
luadebug wants to merge 1 commit into
EasyRPG:masterfrom
luadebug:setgameoption

Conversation

@luadebug
Copy link
Copy Markdown

@luadebug luadebug commented May 12, 2026

maniac: Fix PicPointer variable lookup in CommandShowPicture

The IsValid guard was unnecessary since Get() already returns 0 safely
for out-of-bounds variable IDs. Removing it also fixes the case where
the variable array hasn't grown yet to the requested index.

SetGameOption operation 1 is now a no-op since the Player auto-expands
the variable array on Set(), making pre-allocation unnecessary.

Remove the redundant IsValid guard before Get() in CommandShowPicture's PicPointer handling — Get() already returns 0 safely for any variable ID. Implement SetGameOption operation 1 as a no-op since the variable array auto-expands on write.

@Ghabry
Copy link
Copy Markdown
Member

Ghabry commented May 12, 2026

Please don't use copilot or whatever AI that is to write these PR descriptions. The tools are extremely verbose and a human has to read this...

Thanks for implementing however I wonder why this call to SetLowerLimits is necessary. I don't think there is a way to query this value and our Player just expands the variable array so it should just work.

The only non-debug usage of IsValid I could find is

        if (com.parameters[19] != 0) {
            int var = 0;
            if (Main_Data::game_variables->IsValid(com.parameters[19])) {
                var = Main_Data::game_variables->Get(com.parameters[19]);
            }
            params.name = PicPointerPatch::ReplaceName(params.name, var, com.parameters[18]);
        }

in CommandShowPicture so maybe the real bug is this IsValid call that shouldn't be necessary their?

Is that the cause of the bug?

@luadebug
Copy link
Copy Markdown
Author

luadebug commented May 12, 2026

Please don't use copilot or whatever AI that is to write these PR descriptions. The tools are extremely verbose and a human has to read this...

Thanks for implementing however I wonder why this call to SetLowerLimits is necessary. I don't think there is a way to query this value and our Player just expands the variable array so it should just work.

The only non-debug usage of IsValid I could find is

        if (com.parameters[19] != 0) {
            int var = 0;
            if (Main_Data::game_variables->IsValid(com.parameters[19])) {
                var = Main_Data::game_variables->Get(com.parameters[19]);
            }
            params.name = PicPointerPatch::ReplaceName(params.name, var, com.parameters[18]);
        }

in CommandShowPicture so maybe the real bug is this IsValid call that shouldn't be necessary their?

Is that the cause of the bug?

I think that is the cause. You can validate against https://freegame-mugen.jp/roleplaying/game_9561.html
Before change game stuck on main menu next to start game. After change its possible to select new game and play this game.

Although I am a bit confused how to escape this menu...? I can't save the game after boss fight so :/
image
Save01.lsd.tar.gz

@jetrotal
Copy link
Copy Markdown
Contributor

Are those covered in #3487 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants