Completely remove old chara render code

This commit is contained in:
Lucas S. Vieira 2025-01-10 23:55:55 -03:00
parent 10f37f2bd2
commit ed6c4807fc
4 changed files with 1 additions and 81 deletions

View file

@ -34,9 +34,6 @@ typedef struct {
void load_chara(Chara *chara, const char *filename, TIM_IMAGE *tim);
void free_chara(Chara *chara);
void chara_render_frame(Chara *chara, int16_t framenum,
int16_t vx, int16_t vy, uint8_t flipx);
void chara_draw_gte(Chara *chara, int16_t framenum,
int16_t vx, int16_t vy,
uint8_t flipx, int32_t angle);

View file

@ -98,73 +98,6 @@ free_chara(Chara *chara)
}
}
void
chara_render_frame(Chara *chara, int16_t framenum, int16_t vx, int16_t vy, uint8_t flipx)
{
CharaFrame *frame = &chara->frames[framenum];
int16_t left = frame->x >> 3;
int16_t right = 7 - (frame->width >> 3) - left;
for(uint16_t row = 0; row < frame->rows; row++) {
for(uint16_t colx = 0; colx < frame->cols; colx++) {
uint16_t col = flipx ? frame->cols - colx - 1 : colx;
uint16_t idx = (row * frame->cols) + col;
idx = frame->tiles[idx];
if(idx == 0) continue;
// Get upper left UV from tile index on tileset
uint16_t v0idx = idx >> 5; // divide by 32
uint16_t u0idx = idx - (v0idx << 5);
uint8_t
u0 = (u0idx << 3),
v0 = (v0idx << 3);
SVECTOR xy0 = {
vx + (colx << 3) + (flipx ? (right << 3) : frame->x) - (chara->width >> 1),
vy + (row << 3) + frame->y - (chara->height >> 1),
0, 0,
};
// I don't know why, but it works
uint8_t tw, th;
tw = (u0 < 248 ? 8 : 7);
th = (v0 < 248 ? 8 : 7);
if(flipx) {
if (u0 > 0) u0--;
if (u0 + tw >= 254) tw--;
}
// Use a textured quad since we need to reverse
// our UVs manually
POLY_FT4 *poly = (POLY_FT4 *) get_next_prim();
increment_prim(sizeof(POLY_FT4));
setPolyFT4(poly);
setRGB0(poly, level_fade, level_fade, level_fade);
setTPage(poly, 1, 1, chara->prectx, chara->precty); // 8-bit CLUT
setClut(poly, chara->crectx, chara->crecty);
setXYWH(poly, xy0.vx, xy0.vy, 8, 8);
if(flipx) {
setUV4(
poly,
u0 + tw, v0,
u0, v0,
u0 + tw, v0 + th,
u0, v0 + th);
} else {
setUVWH(poly, u0, v0, tw, th);
}
sort_prim(poly, OTZ_LAYER_PLAYER);
}
}
}
// Extern variables
uint8_t frame_debug = 0;

View file

@ -1210,11 +1210,6 @@ player_draw(Player *player, VECTOR *pos)
{
// if iframes, do not show for every 4 frames
if(player->cur_anim && ((player->iframes >> 2) % 2) == 0) {
/* chara_render_frame(&player->chara, */
/* player->anim_frame, */
/* (int16_t)(pos->vx >> 12), */
/* (int16_t)(pos->vy >> 12) - 9, */
/* player->anim_dir < 0); */
chara_draw_gte(&player->chara,
player->anim_frame,
(int16_t)(pos->vx >> 12),

View file

@ -130,12 +130,7 @@ screen_sprite_test_draw(void *d)
font_set_color(128, 128, 128);
font_draw_sm(buffer, 10, 10);
/* chara_render_frame(&data->chara, */
/* data->frame, */
/* (int16_t)(data->pos.vx), */
/* (int16_t)(data->pos.vy), */
/* data->flipx); */
chara_draw_gte(&data->chara,
data->frame,
(int16_t)(data->pos.vx),