extern Gfx kamakura_DL_model[];
extern Gfx obj_w_kamakura_window_model[];

static void aKKR_actor_draw(ACTOR* actor, GAME* game) {
    STRUCTURE_ACTOR* kamakura;
    GRAPH* graph;
    Mtx* mtx;
    f32 color;
    int r1;
    int g1;
    int b1;
    int l2;
    int r2;
    int g2;
    int b2;
    u16* pal;
    Gfx* poly_opa;
    Gfx* poly_xlu;

    kamakura = (STRUCTURE_ACTOR*)actor;
    graph = game->graph;
    color = kamakura->arg0_f;
    pal = Common_Get(clip).structure_clip->get_pal_segment_proc(aSTR_PAL_KAMAKURA);
    mtx = _Matrix_to_Mtx_new(graph);
    if (mtx == NULL) {
        return;
    }

    if (color > 0.0f) {
        r2 = 255;
        g2 = 255;
        b2 = 150;

        r1 = (color * 255.0f) + 0.5f;
        g1 = (color * 255.0f) + 0.5f;
        b1 = (color * 150.0f) + 0.5f;
        l2 = (color * 120.0f) + 0.5f;
    } else {
        r1 = 0;
        g1 = 0;
        b1 = 0;

        l2 = 0;
        r2 = 0;
        g2 = 0;
        b2 = 0;
    }

    OPEN_DISP(graph);
    {
        _texture_z_light_fog_prim_npc(graph);

        poly_opa = NOW_POLY_OPA_DISP;

        gSPMatrix(poly_opa++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
        gSPSegment(poly_opa++, G_MWO_SEGMENT_8, pal);
        gDPPipeSync(poly_opa++);
        gDPSetEnvColor(poly_opa++, r1, g1, b1, 0);
        gSPDisplayList(poly_opa++, kamakura_DL_model);
        SET_POLY_OPA_DISP(poly_opa);
    }
    {
        _texture_z_light_fog_prim_xlu(graph);

        poly_xlu = NOW_POLY_XLU_DISP;

        gSPMatrix(poly_xlu++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
        gDPSetPrimColor(poly_xlu++, 0, l2, r2, g2, b2, 0);

        gSPDisplayList(poly_xlu++, obj_w_kamakura_window_model);
        SET_POLY_XLU_DISP(poly_xlu);
    }
    CLOSE_DISP(graph);

    _texture_z_light_fog_prim_shadow(graph);
    (*Common_Get(clip).bg_item_clip->draw_shadow_proc)(game, &aKKR_shadow_data, FALSE);
}
