def _header(): block = { 'loopstart': c.NextTrigger(), 'loopend': c.Forward(), 'contpoint': c.Forward(), } ut.EUDCreateBlock('whileblock', block)
def _footer(): block = {'blockend': c.Forward()} ut.EUDCreateBlock('executeonceblock', block) tv = c.EUDLightVariable() EUDJumpIf(tv == 1, block['blockend']) tv << 1 return True
def _footer(conditions, *, neg=False): block = {'ifend': c.Forward(), 'next_elseif': c.Forward()} ut.EUDCreateBlock('ifblock', block) if neg: EUDJumpIf(conditions, block['next_elseif']) else: EUDJumpIfNot(conditions, block['next_elseif']) return True
def _footer(): block = { 'loopstart': c.NextTrigger(), 'loopend': c.Forward(), 'contpoint': c.Forward() } ut.EUDCreateBlock('infloopblock', block) return True
def _footer(): block = {'origcp': f_getcurpl(), 'playerv': c.EUDVariable()} playerv = block['playerv'] playerv << 0 cs.EUDWhile()(playerv <= 7) cs.EUDContinueIfNot(f_playerexist(playerv)) f_setcurpl(playerv) ut.EUDCreateBlock('ploopblock', block) return True
def EUDSwitch(var): block = { 'targetvar': var, 'casebrlist': {}, 'defaultbr': c.Forward(), 'swend': c.Forward() } c.PushTriggerScope() ut.EUDCreateBlock('swblock', block) return True
def EUDLoopUnit(): ut.EUDCreateBlock('unitloop', 0x628430) ptr, epd = f_cunitepdread_epd(ut.EPD(0x628430)) if cs.EUDWhile()(ptr >= 1): yield ptr, epd cs.EUDSetContinuePoint() c.SetVariables([ptr, epd], f_cunitepdread_epd(epd + 1)) cs.EUDEndWhile() ut.EUDPopBlock('unitloop')
def EUDLoopRange(start, end=None): ut.EUDCreateBlock('looprangeblock', None) if end is None: start, end = 0, start v = c.EUDVariable() v << start if EUDWhile()(v < end): yield v EUDLoopSetContinuePoint() v += 1 EUDEndWhile() ut.EUDPopBlock('looprangeblock')
def EUDLoopPlayerUnit(player): player = c.EncodePlayer(player) first_player_unit = 0x6283F8 ut.EUDCreateBlock('playerunitloop', first_player_unit) ptr, epd = f_cunitepdread_epd(ut.EPD(first_player_unit) + player) if cs.EUDWhile()(ptr >= 1): yield ptr, epd cs.EUDSetContinuePoint() # /*0x06C*/ BW::CUnit* nextPlayerUnit; c.SetVariables([ptr, epd], f_cunitepdread_epd(epd + 0x6C // 4)) cs.EUDEndWhile() ut.EUDPopBlock('playerunitloop')
def _footer(n): vardb = c.Db(4) c.RawTrigger(actions=c.SetMemory(vardb, c.SetTo, n)) block = { 'loopstart': c.NextTrigger(), 'loopend': c.Forward(), 'contpoint': c.Forward(), 'vardb': vardb } ut.EUDCreateBlock('loopnblock', block) EUDJumpIf(c.Memory(vardb, c.Exactly, 0), block['loopend']) return True
def EUDLoopSprite(): y_epd = c.EUDVariable() y_epd << ut.EPD(0x629688) ut.EUDCreateBlock('spriteloop', 'sprlo') if cs.EUDWhile()(y_epd < ut.EPD(0x629688) + 256): ptr, epd = f_dwepdread_epd(y_epd) if cs.EUDWhile()(ptr >= 1): yield ptr, epd cs.EUDSetContinuePoint() c.SetVariables([ptr, epd], f_dwepdread_epd(epd + 1)) cs.EUDEndWhile() y_epd += 1 cs.EUDEndWhile() ut.EUDPopBlock('spriteloop')
def EUDLoopList(header_offset, break_offset=None): blockname = 'listloop' ut.EUDCreateBlock(blockname, header_offset) ptr, epd = f_dwepdread_epd(ut.EPD(header_offset)) if break_offset is not None: cs.EUDWhileNot()(ptr == break_offset) else: cs.EUDWhile()([ptr > 0, ptr <= 0x7FFFFFFF]) yield ptr, epd cs.EUDSetContinuePoint() c.SetVariables([ptr, epd], f_dwepdread_epd(epd + 1)) cs.EUDEndWhile() ut.ep_assert( ut.EUDPopBlock(blockname)[1] is header_offset, 'listloop mismatch' )