Support randomonall for ALL supported events that randomly change sprites.
This commit is contained in:
		
							parent
							
								
									51134965fa
								
							
						
					
					
						commit
						aae08a807f
					
				
							
								
								
									
										5
									
								
								Rom.py
								
								
								
								
							
							
						
						
									
										5
									
								
								Rom.py
								
								
								
								
							| 
						 | 
					@ -169,7 +169,10 @@ def apply_random_sprite_on_event(rom: LocalRom, sprite, local_random, allow_rand
 | 
				
			||||||
        allow_random_on_event = not rom.read_byte(0x186381)  # Check if explicitly disabled in rom. If so, it stays that way.
 | 
					        allow_random_on_event = not rom.read_byte(0x186381)  # Check if explicitly disabled in rom. If so, it stays that way.
 | 
				
			||||||
    if sprite and not isinstance(sprite, Sprite):
 | 
					    if sprite and not isinstance(sprite, Sprite):
 | 
				
			||||||
        sprite = sprite.lower()
 | 
					        sprite = sprite.lower()
 | 
				
			||||||
        if sprite.startswith('randomon'):
 | 
					        if sprite == 'randomonall':
 | 
				
			||||||
 | 
					            onevent = 0xFFFF  # Support all current and future events that can cause random sprite changes.
 | 
				
			||||||
 | 
					            onhit = 0x01
 | 
				
			||||||
 | 
					        elif sprite.startswith('randomon'):
 | 
				
			||||||
            onevent = onhit = 0x01 if 'hit' in sprite else 0x00
 | 
					            onevent = onhit = 0x01 if 'hit' in sprite else 0x00
 | 
				
			||||||
            onevent += 0x02 if 'enter' in sprite else 0x00
 | 
					            onevent += 0x02 if 'enter' in sprite else 0x00
 | 
				
			||||||
            onevent += 0x04 if 'exit' in sprite else 0x00
 | 
					            onevent += 0x04 if 'exit' in sprite else 0x00
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -294,6 +294,7 @@ rom:
 | 
				
			||||||
    randomonslash: 0 # Random sprite on sword slashes
 | 
					    randomonslash: 0 # Random sprite on sword slashes
 | 
				
			||||||
    randomonitem: 0  # Random sprite on getting items.  
 | 
					    randomonitem: 0  # Random sprite on getting items.  
 | 
				
			||||||
                     # You can combine these events like this.  randomonhit-enter-exit  if you want it on hit, enter, exit.
 | 
					                     # You can combine these events like this.  randomonhit-enter-exit  if you want it on hit, enter, exit.
 | 
				
			||||||
 | 
					    randomonall: 0 # Random sprite on any and all currently supported events. Refer to above for the supported events.
 | 
				
			||||||
    Link: 50 # To add other sprites: open the gui/Creator, go to adjust, select a sprite and write down the name the gui calls it
 | 
					    Link: 50 # To add other sprites: open the gui/Creator, go to adjust, select a sprite and write down the name the gui calls it
 | 
				
			||||||
  disablemusic: # If "on", all in-game music will be disabled
 | 
					  disablemusic: # If "on", all in-game music will be disabled
 | 
				
			||||||
    on: 0
 | 
					    on: 0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue