UndertaleModTool icon indicating copy to clipboard operation
UndertaleModTool copied to clipboard

fixed disappearing returns

Open XdotCore opened this issue 1 year ago • 4 comments

Description

This fixes issue #1456 caused by pr #1191. This issue occurred because the pr would remove any exit instruction that wasn't followed by an operation starting with push int, which removed simple return;s that didn't meet that req because they compile to exit (while return value; compiles to ret). Thanks to @Jacky720 for a better way than my initial solution in #1680

Caveats

Haven't done proper testing

Notes

N/A

XdotCore avatar Feb 13 '24 06:02 XdotCore

This also resolves #1223 (and maybe some more, we have a big issues backlog).

Jacky720 avatar Feb 13 '24 13:02 Jacky720

Can someone test this please?

Miepee avatar Feb 17 '24 12:02 Miepee

Can someone test this please?

Scuffed test

Before PR: https://github.com/krzys-h/UndertaleModTool/commit/4cb37e67c8b9f5428958dadb332efdff7b540317 After PR: https://github.com/Dobby233Liu/UndertaleModTool/commit/fc119135b58e6c7a72d2e4c093c7a0c5f4a31d4a

In DR Ch 1&2 v1.10 (2022.1),

  1. Open gml_GlobalScript_scr_create_hitbox_solid, insert right after start of body
    if global.darkzone != 1 return;
    
    • Before PR: compiles to
      f ((global.darkzone != true))
      {
      }
      
    • After PR: compiles to
      if ((global.darkzone != true))
          return;
      
  2. Open gml_Object_o_boxingflame_Create_0, insert before line 1
    if (instance_exists(o_boxingqueen) == 0) return;
    
    • Before PR: compiles to
      f ((instance_exists(o_boxingqueen) == 0))
      return;
      
    • After PR: compiles to
      f ((instance_exists(o_boxingqueen) == 0))
         return;
      

With ULCA Deltarune skit program which is 2023.1 ,

  1. Open gml_Object_obj_event_anxietyrealized_Create_0, and insert before line 1
    if global.chapter != 3 { exit; }
    
    • Before PR: compiles to
      if ((global.chapter != 3))
          return;
      
    • After PR: compiles to
      if ((global.chapter != 3))
          return;
      
  2. Open gml_GlobalScript_scr_mercyadd, insert right after start of body
    if !global.darkzone exit;
    
    • Before PR: compiles to
      if (!global.darkzone)
          return;
      
    • After PR: compiles to
      if (!global.darkzone)
         return;
      

Dobby233Liu avatar Feb 17 '24 13:02 Dobby233Liu

ty, probably is good then

Miepee avatar Feb 17 '24 14:02 Miepee