You are viewing a potentially older version of this package. View all versions.
proxysaw-ProxyObjDep-0.0.1 icon

ProxyObjDep

A simple object dependency workaround

Date uploaded 2 years ago
Version 0.0.1
Download link proxysaw-ProxyObjDep-0.0.1.zip
Downloads 28
Dependency string proxysaw-ProxyObjDep-0.0.1

README

ProxyObjDep

A simple workaround for object dependency on Recomp.

Usage

This is primarily to work around objects needing to be loaded for drawing commands. For instance you cannot simply draw the Deku Mask GI from anywhere, or draw DL's from different objects within the same actor without a bunch of complicated logic. With this library this is made simple:

// Import the functions 
RECOMP_IMPORT("proxy_obj_dep", bool ProxyObjDep_Load(PlayState* play, u8 segment, s16 objectId));
RECOMP_IMPORT("proxy_obj_dep", void ProxyObjDep_Unload(u8 segment, s16 objectId));

void MyActor_Draw(Actor* actor, PlayState* play) {
    if (ProxyObjDep_Load(play, 0x06, OBJECT_GI_NUTSMASK)) {
        Matrix_Scale(30.0f, 30.0f, 30.0f, MTXMODE_APPLY);
        GetItem_Draw(play, GID_MASK_DEKU);

        ProxyObjDep_Unload(0x06, OBJECT_GI_NUTSMASK);
    }

    if (ProxyObjDep_Load(play, 0x06, OBJECT_GI_GOLONMASK)) {
        Matrix_Scale(30.0f, 30.0f, 30.0f, MTXMODE_APPLY);
        GetItem_Draw(play, GID_MASK_GORON);

        ProxyObjDep_Unload(0x06, OBJECT_GI_GOLONMASK);
    }
}

Technical

Currently, this is achieved with a very naive approach, a static location in which all objects can be simultaneously loaded into and never unload. Later on I may improve it to be more dilegent and clean up it's un-used objects as things are "unloaded", but the API will stay the same.