Spoiler: show
Code:
//Bitmap Quad()

void do_bmpdrawquadr(BITMAP *bmp, int *sdci, int xoffset, int yoffset)
{
    //sdci[1]=layer
    //sdci[2]=x1
    //sdci[3]=y1
    //sdci[4]=x2
    //sdci[5]=y2
    //sdci[6]=x3
    //sdci[7]=y3
    //sdci[8]=x4
    //sdci[9]=y4
	//sdci[10]=sourcex
	//sdci[11]=sourcey
	//sdci[12]=sourcew
	//sdci[13]=sourceh
    //sdci[14]=width
    //sdci[15]=height
    //sdci[16]=tile/combo
    //sdci[17]=polytype
    
    int x1 = sdci[2]/10000;
    int y1 = sdci[3]/10000;
    int x2 = sdci[4]/10000;
    int y2 = sdci[5]/10000;
    int x3 = sdci[6]/10000;
    int y3 = sdci[7]/10000;
    int x4 = sdci[8]/10000;
    int y4 = sdci[9]/10000;
    int sx = sdci[10]/10000;
    int sy = sdci[11]/10000;
    int sw = sdci[12]/10000;
    int sh = sdci[13]/10000;
    int w = sdci[14]/10000;
    int h = sdci[15]/10000;
    int bitmapIndex = sdci[12]/10000;
    int polytype = sdci[13]/10000;
    
    //todo: finish palette shading
    /*
    POLYTYPE_FLAT
    POLYTYPE_GCOL
    POLYTYPE_GRGB
    POLYTYPE_ATEX
    POLYTYPE_PTEX
    POLYTYPE_ATEX_MASK
    POLYTYPE_PTEX_MASK
    POLYTYPE_ATEX_LIT
    POLYTYPE_PTEX_LIT
    POLYTYPE_ATEX_MASK_LIT
    POLYTYPE_PTEX_MASK_LIT
    POLYTYPE_ATEX_TRANS
    POLYTYPE_PTEX_TRANS
    POLYTYPE_ATEX_MASK_TRANS
    POLYTYPE_PTEX_MASK_TRANS
    */
    polytype = vbound(polytype, 0, 14);

    
    
    BITMAP *tex = zscriptDrawingRenderTarget->GetBitmapPtr(bitmapIndex);
    
    /*
    
    //When I did this, ZC crashed...
    
    BITMAP *sourceBitmap = zscriptDrawingRenderTarget->GetBitmapPtr(bitmapIndex);
    BITMAP* subBmp = 0;
    
	subBmp = script_drawing_commands.AquireSubBitmap(w, h);
	stretch_blit(sourceBitmap, subBmp, sx, sy, sw, sh, 0, 0, w, h);
    
    */
    
    bool mustDestroyBmp = false;
    
    
    if(!tex)
    {
        mustDestroyBmp = true;
        Z_message("BitmapQuad() : Invalid Bitmap ID", bitmapIndex);
        return; //non power of two error
        clear_bitmap(tex);
    }
    
    
    V3D_f V1 = { static_cast<float>(x1+xoffset), static_cast<float>(y1+yoffset), 0, 0,                             0,                             0 };
    V3D_f V2 = { static_cast<float>(x2+xoffset), static_cast<float>(y2+yoffset), 0, 0,                             static_cast<float>(h), 0 };
    V3D_f V3 = { static_cast<float>(x3+xoffset), static_cast<float>(y3+yoffset), 0, static_cast<float>(w), static_cast<float>(h),0 };
    V3D_f V4 = { static_cast<float>(x4+xoffset), static_cast<float>(y4+yoffset), 0, static_cast<float>(w), 0,                              0 };
    
    Z_message("BitmapQuad() : Trying to draw Bitmap ID", bitmapIndex);
    quad3d_f(bmp, polytype, tex, &V1, &V2, &V3, &V4);
    
    if(mustDestroyBmp)
        destroy_bitmap(tex);
//    destroy_bitmap(sourceBitmap);
        
}


When run, the statement if ( !tex ) catches, and returns an error.

What did I do wrongly here, that it isn't grabbing an existing ZScript bitmap to use as the texture?

When I tried to make a bitmap, and blit, then use the dest bitmap, ZC crashed. The code that I tried for that is in a comment block.