Quake BSP renderer for PS1
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

29 lines
676 B

#include "common.h"
#include "asset.h"
void asset_loadTexture(const u_long* tim, ps1texture_t *texture)
{
TIM_IMAGE* tparam;
GetTimInfo(tim, tparam);
// This freezes up if the TIM image has weird dimensions
LoadImage(tparam->prect, tparam->paddr);
// Upload CLUT for palettized images
if (tparam->mode & 0x8)
{
LoadImage(tparam->crect, tparam->caddr);
}
DrawSync(0);
if (texture != NULL)
{
texture->prect = *tparam->prect;
texture->crect = *tparam->crect;
texture->mode = tparam->mode;
texture->uoffs = (texture->prect.x % 64) << (2 - (texture->mode & 0x3));
texture->voffs = (texture->prect.y & 0xFF);
}
}