예제 #1
0
    def _header():
        block = {
            'loopstart': c.NextTrigger(),
            'loopend': c.Forward(),
            'contpoint': c.Forward(),
        }

        ut.EUDCreateBlock('whileblock', block)
예제 #2
0
    def _footer():
        block = {'blockend': c.Forward()}
        ut.EUDCreateBlock('executeonceblock', block)

        tv = c.EUDLightVariable()
        EUDJumpIf(tv == 1, block['blockend'])
        tv << 1
        return True
예제 #3
0
    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
예제 #4
0
    def _footer():
        block = {
            'loopstart': c.NextTrigger(),
            'loopend': c.Forward(),
            'contpoint': c.Forward()
        }

        ut.EUDCreateBlock('infloopblock', block)
        return True
예제 #5
0
파일: pexist.py 프로젝트: phu54321/eudplib
    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
예제 #6
0
파일: swblock.py 프로젝트: phu54321/eudplib
def EUDSwitch(var):
    block = {
        'targetvar': var,
        'casebrlist': {},
        'defaultbr': c.Forward(),
        'swend': c.Forward()
    }

    c.PushTriggerScope()
    ut.EUDCreateBlock('swblock', block)

    return True
예제 #7
0
파일: listloop.py 프로젝트: Dr-zzt/eudplib
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')
예제 #8
0
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')
예제 #9
0
파일: listloop.py 프로젝트: Dr-zzt/eudplib
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')
예제 #10
0
    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
예제 #11
0
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')
예제 #12
0
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'
    )