From ebfc839acb15d5d4928e1ffe3207cf2d45a3a102 Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Fri, 4 Jul 2025 22:14:43 -0500 Subject: [PATCH] add full covers --- cover/silvertreesfull.png | Bin 443579 -> 443806 bytes src/scene/tracker/cover.cpp | 90 ++++++++++++++++++++++++++++++------ src/ta_parameter.hpp | 36 +++++++++++++++ src/texture.cpp | 12 +++++ src/texture.hpp | 2 + xm_player.mk | 4 +- 6 files changed, 128 insertions(+), 16 deletions(-) diff --git a/cover/silvertreesfull.png b/cover/silvertreesfull.png index f3c0606c6af10a0056601ee3a8686963394bb20b..e09164ec75ed26dce4c7eda020c257423de378d0 100644 GIT binary patch delta 672 zcmdnpDLt=SdO|ZJ^TZZILvtnu1`!4Z1{m$`=^LP6q-SWLXKca1U}RuqYGq(4eF~%qcA`5M?>YFHnBa^P;QQpZK5*!N&&+?eE>KzO$G4PcK*S*#wyY z)6*X6!cJz}wOZl?odlRA4z4-kQ|l)Z{6QxE`-hKT^^R@cbN;Vo)zm#F8Rk34)Ti%C z6wDX!&yTWtUi*kc+mq{~<;NY4;wp7dcD?x|{e02kx_Od@MlUNLacm5Dld!Wn@?=2g z@{Yw_s{;4gzut7HvU_vX%8l1-e{vtL%uSv7+N6Er5v6GgP7OU$r&b(r>Iv%=5zf5j zU-6?|X1|Bt%$QVzBAo?XqLUu8|8Ks3cUEitNltUkISjkva(*X^aJ*$YyDPU|{&v}C z77iQc@TlAIxeUhhmt4Oc^@ZcbZ8p7iw`c8Pk9o(??7u6;qfcbPOMQ`s@5aBD$y})C z{<3E0-mTvXe=(%2Sbc@Jpn#)CRI~c-aN$>FRk zxh+i0ER8HJ%uEa{CUdhDbHJi>avPf(oU?fgn;_%lM{F@FiAjdWX@)6gx~Yb#M!F^j zhKagK<|#(H7Uo7q#)&BgW+sUylatteVOotgZ)eZr5M$U8839aCY)RhkE)0S|mQZ+A r3F~BQ0R;|LW)>6s|IP}{$pY=k0*pY+1jNih%mT!$+mi*@BDMekrl0zr delta 618 zcmbQ&Exo%_dO|ZJ)5I1-Lk|W921X!;(e9qU0SZQXh6Z}Z77PqV21ce<2If`lN7KUY9J^193e#WH< zOLkartz%`k7hBDzcW#%}4z8vL>>axwEP0`%`cGeTOUKs-JLKQLvwe4u(P{4)6Kw%z zle=cYojYcnT-S9loJG*V{+OYX@#z_pm#A3vt*`#^qe}c~yLP2r3Poh=(L9b1!; zb>#99!O+W^@h2+Q6y1BYX6ouSmHz(@1^C5BKC?QTsIs9$)k9$6f-a#`8w8hzsvmXg z`u14%kMp{CrRh%Vgd{A*0vg$Fer^7L@O|FeKlN9ZOc&{5j@9q`Y{jwuV%(sWLF|R%C`m zltlRYSS4@X#MH>7l4xO=l4zc6uA69RZm4ULlxU`#XlZGxn`U5?n3igsWMQ6`GC7=e zCAX=GnX!qXsgb#*;bd;MVh&i8PHtmUgL5`-VH0HByn-WvL(J3vO*JrSuqAoByD*pn vSyo|vq1Kb-1Qj?~gtSfn?|J&O*-fzBO^^|YnShuXh*^M`b-SA&Tf`Os?>Y0) diff --git a/src/scene/tracker/cover.cpp b/src/scene/tracker/cover.cpp index 9fc9a05..5d34ddb 100644 --- a/src/scene/tracker/cover.cpp +++ b/src/scene/tracker/cover.cpp @@ -19,6 +19,7 @@ namespace scene::tracker::cover { float height; float scale; vec3 color; + uint32_t texture_full_offset; }; int cover_ix = -1; @@ -27,6 +28,15 @@ namespace scene::tracker::cover { static vec3 bg_color = {0, 0, 0}; + const uint32_t full_texture_size = tsp_instruction_word::texture_u_size::from_int(512) + | tsp_instruction_word::texture_v_size::from_int(512); + + const float full_texture_width = 1.0 / 512.f; + const float full_texture_height = 1.0 / 512.f; + + const float full_width = 432.0f; + const float full_height = 432.0f; + static const cover covers[] = { [thebeach] = { .texture_offset = texture::offset::thebeach, @@ -49,6 +59,7 @@ namespace scene::tracker::cover { .height = 72, .scale = 6, .color = {0x0d, 0x10, 0x1a}, + .texture_full_offset = texture::offset::silvertreesfull, }, [redtree] = { .texture_offset = texture::offset::redtree, @@ -60,6 +71,7 @@ namespace scene::tracker::cover { .height = 72, .scale = 6, .color = {0x1a, 0x00, 0x00}, + .texture_full_offset = texture::offset::redtreefull, }, [mountain] = { .texture_offset = texture::offset::mountain, @@ -151,6 +163,14 @@ namespace scene::tracker::cover { }; } + constexpr inline vec2 transform_texture_full(const vec2& t) + { + return { + (t.x * full_width) * full_texture_width, + (t.y * full_height) * full_texture_height, + }; + } + constexpr inline vec2 transform_texture(const cover& cover, const vec2& t) { @@ -223,15 +243,6 @@ namespace scene::tracker::cover { update_background(cover); - uint32_t texture_size = cover.texture_size - | tsp_instruction_word::dst_alpha_instr::zero; - - global_polygon_textured(multi.op, - para_control::list_type::translucent, - cover.texture_offset, - texture_size, - texture_control_word::pixel_format::_565); - float z = 1.0 / 3.0f; int base_color = 0xffffff; @@ -266,12 +277,61 @@ namespace scene::tracker::cover { vec2 ct = transform_texture(cover, vtx[2]); vec2 dt = transform_texture(cover, vtx[3]); - quad_type_3(multi.op, - ap, at, - bp, bt, - cp, ct, - dp, dt, - base_color); + if (cover.texture_full_offset == 0) { + uint32_t texture_size = cover.texture_size + | tsp_instruction_word::dst_alpha_instr::zero; + + global_polygon_textured(multi.op, + para_control::list_type::translucent, + cover.texture_offset, + texture_size, + texture_control_word::pixel_format::_565); + + quad_type_3(multi.op, + ap, at, + bp, bt, + cp, ct, + dp, dt, + base_color); + } else { + vec2 atf = transform_texture_full(vtx[0]); + vec2 btf = transform_texture_full(vtx[1]); + vec2 ctf = transform_texture_full(vtx[2]); + vec2 dtf = transform_texture_full(vtx[3]); + + uint32_t texture_size = cover.texture_size + | tsp_instruction_word::dst_alpha_instr::zero; + + global_polygon_textured_tl(multi.op, + para_control::list_type::translucent, + cover.texture_offset, + texture_size, + texture_control_word::pixel_format::_565); + + uint32_t alpha0 = (uint32_t)(255.0 * (1.0 - zoom_interp)) << 24; + + quad_type_3(multi.op, + ap, at, + bp, bt, + cp, ct, + dp, dt, + alpha0 | base_color); + + uint32_t alpha1 = (uint32_t)(255.0 * (zoom_interp)) << 24; + + global_polygon_textured_tl(multi.op, + para_control::list_type::translucent, + cover.texture_full_offset, + full_texture_size | tsp_instruction_word::dst_alpha_instr::inverse_src_alpha, + texture_control_word::pixel_format::_565); + + quad_type_3(multi.op, + ap, atf, + bp, btf, + cp, ctf, + dp, dtf, + alpha1 | base_color); + } if (zoom_interp > 0) draw_shroud(multi.op, cover); diff --git a/src/ta_parameter.hpp b/src/ta_parameter.hpp index 432aedb..0a46865 100644 --- a/src/ta_parameter.hpp +++ b/src/ta_parameter.hpp @@ -45,6 +45,42 @@ static inline void global_polygon_textured(ta_parameter_writer& writer, ); } +static inline void global_polygon_textured_tl(ta_parameter_writer& writer, + uint32_t list_type, + uint32_t texture_offset, + uint32_t texture_size, + uint32_t pixel_format) +{ + const uint32_t parameter_control_word = para_control::para_type::polygon_or_modifier_volume + | list_type + | obj_control::col_type::packed_color + | obj_control::texture + ; + + const uint32_t isp_tsp_instruction_word = isp_tsp_instruction_word::depth_compare_mode::greater_or_equal + | isp_tsp_instruction_word::culling_mode::no_culling; + + const uint32_t tsp_instruction_word = tsp_instruction_word::texture_shading_instruction::modulate_alpha + | tsp_instruction_word::src_alpha_instr::src_alpha + | tsp_instruction_word::fog_control::no_fog + | tsp_instruction_word::use_alpha + | texture_size; + + const uint32_t texture_address = texture_memory_alloc.texture.start + texture_offset; + const uint32_t texture_control_word = pixel_format + | texture_control_word::scan_order::twiddled + | texture_control_word::texture_address(texture_address / 8); + + writer.append() = + ta_global_parameter::polygon_type_0(parameter_control_word, + isp_tsp_instruction_word, + tsp_instruction_word, + texture_control_word, + 0, // data_size_for_sort_dma + 0 // next_address_for_sort_dma + ); +} + static inline void global_polygon_intensity(ta_parameter_writer& writer, uint32_t list_type, uint32_t texture_offset, diff --git a/src/texture.cpp b/src/texture.cpp index 3ee7122..81ea0d4 100644 --- a/src/texture.cpp +++ b/src/texture.cpp @@ -23,6 +23,8 @@ #include "cover/thebeach.data.h" #include "cover/tree.data.h" #include "cover/moonmountains.data.h" +#include "cover/redtreefull.data.h" +#include "cover/silvertreesfull.data.h" #include "printf/printf.h" @@ -94,6 +96,16 @@ namespace texture { .size = reinterpret_cast(&_binary_cover_moonmountains_data_size), .offset = offset::moonmountains, }, + { + .start = reinterpret_cast(&_binary_cover_redtreefull_data_start), + .size = reinterpret_cast(&_binary_cover_redtreefull_data_size), + .offset = offset::redtreefull, + }, + { + .start = reinterpret_cast(&_binary_cover_silvertreesfull_data_start), + .size = reinterpret_cast(&_binary_cover_silvertreesfull_data_size), + .offset = offset::silvertreesfull, + }, }; const int textures_length = (sizeof (textures)) / (sizeof (textures[0])); diff --git a/src/texture.hpp b/src/texture.hpp index b44d46e..7de99c2 100644 --- a/src/texture.hpp +++ b/src/texture.hpp @@ -21,6 +21,8 @@ namespace texture { constexpr int thebeach = silvertrees + 32768; constexpr int tree = thebeach + 32768; constexpr int moonmountains= tree + 32768; + constexpr int redtreefull = moonmountains+ 32768; + constexpr int silvertreesfull = redtreefull+ 524288; }; extern struct texture textures[]; diff --git a/xm_player.mk b/xm_player.mk index 12f4698..3b9c3e3 100644 --- a/xm_player.mk +++ b/xm_player.mk @@ -22,7 +22,9 @@ TEXTURE_OBJ = \ cover/silvertrees.data.o \ cover/thebeach.data.o \ cover/tree.data.o \ - cover/moonmountains.data.o + cover/moonmountains.data.o \ + cover/redtreefull.data.o \ + cover/silvertreesfull.data.o PCM_OBJ = \ pcm/start3.adpcm.o \