mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-21 23:58:51 -05:00
Moved grayscale effect to the gpu and replaced some texture loads (#221)
This commit is contained in:
parent
ffa4a11148
commit
1f3a6b928f
@ -170,6 +170,12 @@
|
||||
#define G_TEXRECT_WIDE 0x37
|
||||
#define G_FILLWIDERECT 0x38
|
||||
|
||||
/* GFX Effects */
|
||||
|
||||
// RDP Cmd
|
||||
#define G_SETGRAYSCALE 0x39
|
||||
#define G_SETINTENSITY 0x40
|
||||
|
||||
/*
|
||||
* The following commands are the "generated" RDP commands; the user
|
||||
* never sees them, the RSP microcode generates them.
|
||||
@ -2821,6 +2827,14 @@ _DW({ \
|
||||
_g->words.w1 = 0; \
|
||||
}
|
||||
|
||||
#define gsSPGrayscale(pkt, state) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = _SHIFTL(G_SETGRAYSCALE, 24, 8); \
|
||||
_g->words.w1 = state; \
|
||||
}
|
||||
|
||||
#ifdef F3DEX_GBI_2
|
||||
/*
|
||||
* One gSPGeometryMode(pkt,c,s) GBI is equal to these two GBIs.
|
||||
@ -3161,6 +3175,8 @@ _DW({ \
|
||||
(_SHIFTL(r, 24, 8) | _SHIFTL(g, 16, 8) | \
|
||||
_SHIFTL(b, 8, 8) | _SHIFTL(a, 0, 8)))
|
||||
|
||||
#define gsDPSetGrayscaleColor(pkt, r, g, b) \
|
||||
DPRGBColor(pkt, G_SETINTENSITY, r, g, b, 255)
|
||||
#define gDPSetEnvColor(pkt, r, g, b, a) \
|
||||
DPRGBColor(pkt, G_SETENVCOLOR, r,g,b,a)
|
||||
#define gsDPSetEnvColor(r, g, b, a) \
|
||||
@ -3177,7 +3193,6 @@ _DW({ \
|
||||
gDPSetColor(pkt, G_SETFILLCOLOR, (d))
|
||||
#define gsDPSetFillColor(d) \
|
||||
gsDPSetColor(G_SETFILLCOLOR, (d))
|
||||
|
||||
#define gDPSetPrimDepth(pkt, z, dz) \
|
||||
gDPSetColor(pkt, G_SETPRIMDEPTH, \
|
||||
_SHIFTL(z, 16, 16) | _SHIFTL(dz, 0, 16))
|
||||
|
@ -16,6 +16,7 @@ void gfx_cc_get_features(uint64_t shader_id0, uint32_t shader_id1, struct CCFeat
|
||||
cc_features->opt_2cyc = (shader_id1 & SHADER_OPT_2CYC) != 0;
|
||||
cc_features->opt_alpha_threshold = (shader_id1 & SHADER_OPT_ALPHA_THRESHOLD) != 0;
|
||||
cc_features->opt_invisible = (shader_id1 & SHADER_OPT_INVISIBLE) != 0;
|
||||
cc_features->opt_grayscale = (shader_id1 & SHADER_OPT_GRAYSCALE) != 0;
|
||||
|
||||
cc_features->clamp[0][0] = (shader_id1 & SHADER_OPT_TEXEL0_CLAMP_S);
|
||||
cc_features->clamp[0][1] = (shader_id1 & SHADER_OPT_TEXEL0_CLAMP_T);
|
||||
|
@ -39,10 +39,11 @@ enum {
|
||||
#define SHADER_OPT_2CYC (1 << 4)
|
||||
#define SHADER_OPT_ALPHA_THRESHOLD (1 << 5)
|
||||
#define SHADER_OPT_INVISIBLE (1 << 6)
|
||||
#define SHADER_OPT_TEXEL0_CLAMP_S (1 << 7)
|
||||
#define SHADER_OPT_TEXEL0_CLAMP_T (1 << 8)
|
||||
#define SHADER_OPT_TEXEL1_CLAMP_S (1 << 9)
|
||||
#define SHADER_OPT_TEXEL1_CLAMP_T (1 << 10)
|
||||
#define SHADER_OPT_GRAYSCALE (1 << 7)
|
||||
#define SHADER_OPT_TEXEL0_CLAMP_S (1 << 8)
|
||||
#define SHADER_OPT_TEXEL0_CLAMP_T (1 << 9)
|
||||
#define SHADER_OPT_TEXEL1_CLAMP_S (1 << 10)
|
||||
#define SHADER_OPT_TEXEL1_CLAMP_T (1 << 11)
|
||||
#define CC_SHADER_OPT_POS 56
|
||||
|
||||
struct CCFeatures {
|
||||
@ -54,6 +55,7 @@ struct CCFeatures {
|
||||
bool opt_2cyc;
|
||||
bool opt_alpha_threshold;
|
||||
bool opt_invisible;
|
||||
bool opt_grayscale;
|
||||
bool used_textures[2];
|
||||
bool clamp[2][2];
|
||||
int num_inputs;
|
||||
|
@ -88,13 +88,13 @@ struct ShaderProgramD3D11 {
|
||||
static struct {
|
||||
HMODULE d3d11_module;
|
||||
PFN_D3D11_CREATE_DEVICE D3D11CreateDevice;
|
||||
|
||||
|
||||
HMODULE d3dcompiler_module;
|
||||
pD3DCompile D3DCompile;
|
||||
|
||||
|
||||
D3D_FEATURE_LEVEL feature_level;
|
||||
uint32_t msaa_num_quality_levels[D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT];
|
||||
|
||||
|
||||
ComPtr<ID3D11Device> device;
|
||||
ComPtr<IDXGISwapChain1> swap_chain;
|
||||
ComPtr<ID3D11DeviceContext> context;
|
||||
@ -448,6 +448,9 @@ static struct ShaderProgram *gfx_d3d11_create_and_load_new_shader(uint64_t shade
|
||||
if (cc_features.opt_fog) {
|
||||
ied[ied_index++] = { "FOG", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 };
|
||||
}
|
||||
if (cc_features.opt_grayscale) {
|
||||
ied[ied_index++] = { "GRAYSCALE", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 };
|
||||
}
|
||||
for (unsigned int i = 0; i < cc_features.num_inputs; i++) {
|
||||
DXGI_FORMAT format = cc_features.opt_alpha ? DXGI_FORMAT_R32G32B32A32_FLOAT : DXGI_FORMAT_R32G32B32_FLOAT;
|
||||
ied[ied_index++] = { "INPUT", i, format, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 };
|
||||
|
@ -138,6 +138,10 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
|
||||
append_line(buf, &len, " float4 fog : FOG;");
|
||||
num_floats += 4;
|
||||
}
|
||||
if (cc_features.opt_grayscale) {
|
||||
append_line(buf, &len, " float4 grayscale : GRAYSCALE;");
|
||||
num_floats += 4;
|
||||
}
|
||||
for (int i = 0; i < cc_features.num_inputs; i++) {
|
||||
len += sprintf(buf + len, " float%d input%d : INPUT%d;\r\n", cc_features.opt_alpha ? 4 : 3, i + 1, i);
|
||||
num_floats += cc_features.opt_alpha ? 4 : 3;
|
||||
@ -208,6 +212,9 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
|
||||
if (cc_features.opt_fog) {
|
||||
append_str(buf, &len, ", float4 fog : FOG");
|
||||
}
|
||||
if (cc_features.opt_grayscale) {
|
||||
append_str(buf, &len, ", float4 grayscale : GRAYSCALE");
|
||||
}
|
||||
for (int i = 0; i < cc_features.num_inputs; i++) {
|
||||
len += sprintf(buf + len, ", float%d input%d : INPUT%d", cc_features.opt_alpha ? 4 : 3, i + 1, i);
|
||||
}
|
||||
@ -228,6 +235,9 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
|
||||
if (cc_features.opt_fog) {
|
||||
append_line(buf, &len, " result.fog = fog;");
|
||||
}
|
||||
if (cc_features.opt_grayscale) {
|
||||
append_line(buf, &len, " result.grayscale = grayscale;");
|
||||
}
|
||||
for (int i = 0; i < cc_features.num_inputs; i++) {
|
||||
len += sprintf(buf + len, " result.input%d = input%d;\r\n", i + 1, i + 1);
|
||||
}
|
||||
@ -298,6 +308,11 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
|
||||
}
|
||||
}
|
||||
|
||||
if (cc_features.opt_grayscale) {
|
||||
append_line(buf, &len, "float intensity = (texel.r + texel.g + texel.b) / 3.0;");
|
||||
append_line(buf, &len, "texel.rgb = input.grayscale.rgb * intensity;");
|
||||
}
|
||||
|
||||
if (cc_features.opt_alpha && cc_features.opt_noise) {
|
||||
append_line(buf, &len, " float2 coords = screenSpace.xy * noise_scale;");
|
||||
append_line(buf, &len, " texel.a *= round(saturate(random(float3(floor(coords), noise_frame)) + texel.a - 0.5));");
|
||||
|
@ -238,6 +238,13 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
|
||||
append_line(vs_buf, &vs_len, "varying vec4 vFog;");
|
||||
num_floats += 4;
|
||||
}
|
||||
|
||||
if (cc_features.opt_grayscale) {
|
||||
append_line(vs_buf, &vs_len, "attribute vec4 aGrayscaleColor;");
|
||||
append_line(vs_buf, &vs_len, "varying vec4 vGrayscaleColor;");
|
||||
num_floats += 4;
|
||||
}
|
||||
|
||||
for (int i = 0; i < cc_features.num_inputs; i++) {
|
||||
vs_len += sprintf(vs_buf + vs_len, "attribute vec%d aInput%d;\n", cc_features.opt_alpha ? 4 : 3, i + 1);
|
||||
vs_len += sprintf(vs_buf + vs_len, "varying vec%d vInput%d;\n", cc_features.opt_alpha ? 4 : 3, i + 1);
|
||||
@ -257,6 +264,9 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
|
||||
if (cc_features.opt_fog) {
|
||||
append_line(vs_buf, &vs_len, "vFog = aFog;");
|
||||
}
|
||||
if (cc_features.opt_grayscale) {
|
||||
append_line(vs_buf, &vs_len, "vGrayscaleColor = aGrayscaleColor;");
|
||||
}
|
||||
for (int i = 0; i < cc_features.num_inputs; i++) {
|
||||
vs_len += sprintf(vs_buf + vs_len, "vInput%d = aInput%d;\n", i + 1, i + 1);
|
||||
}
|
||||
@ -279,6 +289,9 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
|
||||
if (cc_features.opt_fog) {
|
||||
append_line(fs_buf, &fs_len, "varying vec4 vFog;");
|
||||
}
|
||||
if (cc_features.opt_grayscale) {
|
||||
append_line(fs_buf, &fs_len, "varying vec4 vGrayscaleColor;");
|
||||
}
|
||||
for (int i = 0; i < cc_features.num_inputs; i++) {
|
||||
fs_len += sprintf(fs_buf + fs_len, "varying vec%d vInput%d;\n", cc_features.opt_alpha ? 4 : 3, i + 1);
|
||||
}
|
||||
@ -355,6 +368,11 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
|
||||
append_line(fs_buf, &fs_len, "texel.a *= floor(clamp(random(vec3(floor(gl_FragCoord.xy * noise_scale), float(frame_count))) + texel.a, 0.0, 1.0));");
|
||||
}
|
||||
|
||||
if (cc_features.opt_grayscale) {
|
||||
append_line(fs_buf, &fs_len, "float intensity = (texel.r + texel.g + texel.b) / 3.0;");
|
||||
append_line(fs_buf, &fs_len, "texel.rgb = vGrayscaleColor.rgb * intensity;");
|
||||
}
|
||||
|
||||
if (cc_features.opt_alpha) {
|
||||
if (cc_features.opt_alpha_threshold) {
|
||||
append_line(fs_buf, &fs_len, "if (texel.a < 8.0 / 256.0) discard;");
|
||||
@ -446,6 +464,12 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
|
||||
++cnt;
|
||||
}
|
||||
|
||||
if (cc_features.opt_grayscale) {
|
||||
prg->attrib_locations[cnt] = glGetAttribLocation(shader_program, "aGrayscaleColor");
|
||||
prg->attrib_sizes[cnt] = 4;
|
||||
++cnt;
|
||||
}
|
||||
|
||||
for (int i = 0; i < cc_features.num_inputs; i++) {
|
||||
char name[16];
|
||||
sprintf(name, "aInput%d", i + 1);
|
||||
|
@ -155,9 +155,10 @@ static struct RDP {
|
||||
|
||||
uint32_t other_mode_l, other_mode_h;
|
||||
uint64_t combine_mode;
|
||||
bool grayscale;
|
||||
|
||||
uint8_t prim_lod_fraction;
|
||||
struct RGBA env_color, prim_color, fog_color, fill_color;
|
||||
struct RGBA env_color, prim_color, fog_color, fill_color, grayscale_color;
|
||||
struct XYWidthHeight viewport, scissor;
|
||||
bool viewport_or_scissor_changed;
|
||||
void *z_buf_address;
|
||||
@ -825,22 +826,6 @@ static void import_texture(int i, int tile) {
|
||||
uint8_t siz = rdp.texture_tile[tile].siz;
|
||||
uint32_t tmem_index = rdp.texture_tile[tile].tmem_index;
|
||||
|
||||
// OTRTODO: Move it to a function to be faster
|
||||
// ModInternal::bindHook(LOOKUP_TEXTURE);
|
||||
// ModInternal::initBindHook(8,
|
||||
// HOOK_PARAMETER("gfx_api", gfx_get_current_rendering_api()),
|
||||
// HOOK_PARAMETER("path", rdp.loaded_texture[tmem_index].otr_path),
|
||||
// HOOK_PARAMETER("node", &rendering_state.textures[i]),
|
||||
// HOOK_PARAMETER("fmt", &fmt),
|
||||
// HOOK_PARAMETER("siz", &siz),
|
||||
// HOOK_PARAMETER("tile", &i),
|
||||
// HOOK_PARAMETER("palette", &rdp.texture_tile[tile].palette),
|
||||
// HOOK_PARAMETER("addr", const_cast<uint8_t*>(rdp.loaded_texture[tmem_index].addr))
|
||||
// );
|
||||
//
|
||||
// if (ModInternal::callBindHook(0))
|
||||
// return;
|
||||
|
||||
if (gfx_texture_cache_lookup(i, tile))
|
||||
{
|
||||
return;
|
||||
@ -1220,7 +1205,6 @@ static void gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t vtx3_idx, bo
|
||||
|
||||
uint64_t cc_id = rdp.combine_mode;
|
||||
|
||||
//bool use_alpha = (rdp.other_mode_l & (3 << 18)) == G_BL_1MA || (rdp.other_mode_l & (3 << 16)) == G_BL_1MA;
|
||||
bool use_alpha = (rdp.other_mode_l & (3 << 20)) == (G_BL_CLR_MEM << 20) && (rdp.other_mode_l & (3 << 16)) == (G_BL_1MA << 16);
|
||||
bool use_fog = (rdp.other_mode_l >> 30) == G_BL_CLR_FOG;
|
||||
bool texture_edge = (rdp.other_mode_l & CVG_X_ALPHA) == CVG_X_ALPHA;
|
||||
@ -1228,6 +1212,7 @@ static void gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t vtx3_idx, bo
|
||||
bool use_2cyc = (rdp.other_mode_h & (3U << G_MDSFT_CYCLETYPE)) == G_CYC_2CYCLE;
|
||||
bool alpha_threshold = (rdp.other_mode_l & (3U << G_MDSFT_ALPHACOMPARE)) == G_AC_THRESHOLD;
|
||||
bool invisible = (rdp.other_mode_l & (3 << 24)) == (G_BL_0 << 24) && (rdp.other_mode_l & (3 << 20)) == (G_BL_CLR_MEM << 20);
|
||||
bool use_grayscale = rdp.grayscale;
|
||||
|
||||
if (texture_edge) {
|
||||
use_alpha = true;
|
||||
@ -1240,12 +1225,13 @@ static void gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t vtx3_idx, bo
|
||||
if (use_2cyc) cc_id |= (uint64_t)SHADER_OPT_2CYC << CC_SHADER_OPT_POS;
|
||||
if (alpha_threshold) cc_id |= (uint64_t)SHADER_OPT_ALPHA_THRESHOLD << CC_SHADER_OPT_POS;
|
||||
if (invisible) cc_id |= (uint64_t)SHADER_OPT_INVISIBLE << CC_SHADER_OPT_POS;
|
||||
if (use_grayscale) cc_id |= (uint64_t)SHADER_OPT_GRAYSCALE << CC_SHADER_OPT_POS;
|
||||
|
||||
if (!use_alpha) {
|
||||
cc_id &= ~((0xfff << 16) | ((uint64_t)0xfff << 44));
|
||||
}
|
||||
|
||||
struct ColorCombiner* comb = gfx_lookup_or_create_color_combiner(cc_id);
|
||||
ColorCombiner* comb = gfx_lookup_or_create_color_combiner(cc_id);
|
||||
|
||||
uint32_t tm = 0;
|
||||
uint32_t tex_width[2], tex_height[2], tex_width2[2], tex_height2[2];
|
||||
@ -1407,6 +1393,13 @@ static void gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t vtx3_idx, bo
|
||||
buf_vbo[buf_vbo_len++] = v_arr[i]->color.a / 255.0f; // fog factor (not alpha)
|
||||
}
|
||||
|
||||
if (use_grayscale) {
|
||||
buf_vbo[buf_vbo_len++] = rdp.grayscale_color.r / 255.0f;
|
||||
buf_vbo[buf_vbo_len++] = rdp.grayscale_color.g / 255.0f;
|
||||
buf_vbo[buf_vbo_len++] = rdp.grayscale_color.b / 255.0f;
|
||||
buf_vbo[buf_vbo_len++] = rdp.grayscale_color.a / 255.0f; // Unused
|
||||
}
|
||||
|
||||
for (int j = 0; j < num_inputs; j++) {
|
||||
struct RGBA* color = 0;
|
||||
struct RGBA tmp;
|
||||
@ -1807,6 +1800,13 @@ static inline uint32_t alpha_comb(uint32_t a, uint32_t b, uint32_t c, uint32_t d
|
||||
return (a & 7) | ((b & 7) << 3) | ((c & 7) << 6) | ((d & 7) << 9);
|
||||
}
|
||||
|
||||
static void gfx_dp_set_grayscale_color(uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
|
||||
rdp.grayscale_color.r = r;
|
||||
rdp.grayscale_color.g = g;
|
||||
rdp.grayscale_color.b = b;
|
||||
rdp.grayscale_color.a = a;
|
||||
}
|
||||
|
||||
static void gfx_dp_set_env_color(uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
|
||||
rdp.env_color.r = r;
|
||||
rdp.env_color.g = g;
|
||||
@ -2411,8 +2411,6 @@ static void gfx_run_dl(Gfx* cmd) {
|
||||
cmd++;
|
||||
uint64_t hash = ((uint64_t)cmd->words.w0 << 32) + (uint64_t)cmd->words.w1;
|
||||
ResourceMgr_GetNameByCRC(hash, fileName);
|
||||
|
||||
|
||||
#if _DEBUG && 0
|
||||
char* tex = ResourceMgr_LoadTexByCRC(hash);
|
||||
ResourceMgr_GetNameByCRC(hash, fileName);
|
||||
@ -2453,8 +2451,8 @@ static void gfx_run_dl(Gfx* cmd) {
|
||||
gfx_dp_set_texture_image(fmt, size, width, tex, fileName);
|
||||
|
||||
cmd++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case G_SETFB:
|
||||
{
|
||||
gfx_flush();
|
||||
@ -2462,8 +2460,8 @@ static void gfx_run_dl(Gfx* cmd) {
|
||||
active_fb = framebuffers.find(cmd->words.w1);
|
||||
gfx_rapi->start_draw_to_framebuffer(active_fb->first, (float)active_fb->second.applied_height / active_fb->second.orig_height);
|
||||
gfx_rapi->clear_framebuffer();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case G_RESETFB:
|
||||
{
|
||||
gfx_flush();
|
||||
@ -2471,7 +2469,6 @@ static void gfx_run_dl(Gfx* cmd) {
|
||||
gfx_rapi->start_draw_to_framebuffer(game_renders_to_framebuffer ? game_framebuffer : 0, (float)gfx_current_dimensions.height / SCREEN_HEIGHT);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case G_SETTIMG_FB:
|
||||
{
|
||||
gfx_flush();
|
||||
@ -2481,8 +2478,13 @@ static void gfx_run_dl(Gfx* cmd) {
|
||||
|
||||
//if (texPtr != NULL)
|
||||
//gfx_dp_set_texture_image(C0(21, 3), C0(19, 2), C0(0, 10), texPtr);
|
||||
break;
|
||||
}
|
||||
case G_SETGRAYSCALE:
|
||||
{
|
||||
rdp.grayscale = cmd->words.w1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case G_LOADBLOCK:
|
||||
gfx_dp_load_block(C1(24, 3), C0(12, 12), C0(0, 12), C1(12, 12), C1(0, 12));
|
||||
break;
|
||||
@ -2510,6 +2512,9 @@ static void gfx_run_dl(Gfx* cmd) {
|
||||
case G_SETFILLCOLOR:
|
||||
gfx_dp_set_fill_color(cmd->words.w1);
|
||||
break;
|
||||
case G_SETINTENSITY:
|
||||
gfx_dp_set_grayscale_color(C1(24, 8), C1(16, 8), C1(8, 8), C1(0, 8));
|
||||
break;
|
||||
case G_SETCOMBINE:
|
||||
gfx_dp_set_combine_mode(
|
||||
color_comb(C0(20, 4), C1(28, 4), C0(15, 5), C1(15, 3)),
|
||||
|
@ -99,6 +99,7 @@ extern "C"
|
||||
extern u32 gGsFlagsMasks[4];
|
||||
extern u32 gGsFlagsShifts[4];
|
||||
extern void* gItemIcons[0x82];
|
||||
extern u8 gItemAgeReqs[];
|
||||
extern u8 gItemSlots[56];
|
||||
extern void (*gSceneCmdHandlers[26])(GlobalContext*, SceneCmd*);
|
||||
extern s16 gLinkObjectIds[2];
|
||||
|
@ -56,8 +56,6 @@ void TransitionCircle_Start(void* thisx) {
|
||||
break;
|
||||
}
|
||||
|
||||
this->texture = ResourceMgr_LoadTexByName(this->texture);
|
||||
|
||||
if (this->speed == 0) {
|
||||
this->step = 0x14;
|
||||
} else {
|
||||
|
@ -298,13 +298,13 @@ void EnPart_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
gSPSegment(POLY_OPA_DISP++, 0x09, func_80ACEAC0(globalCtx->state.gfxCtx, 225, 205, 115, 25, 20, 0));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0A, func_80ACEAC0(globalCtx->state.gfxCtx, 225, 205, 115, 25, 20, 0));
|
||||
} else if ((thisx->params == 9) && (this->displayList == ResourceMgr_LoadGfxByName(object_tite_DL_002FF0))) {
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(object_tite_Tex_001300)));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x09, ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(object_tite_Tex_001700)));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0A, ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(object_tite_Tex_001900)));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, object_tite_Tex_001300);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x09, object_tite_Tex_001700);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0A, object_tite_Tex_001900);
|
||||
} else if ((thisx->params == 10) && (this->displayList == ResourceMgr_LoadGfxByName(object_tite_DL_002FF0))) {
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(object_tite_Tex_001B00)));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x09, ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(object_tite_Tex_001F00)));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0A, ResourceMgr_LoadTexByName(SEGMENTED_TO_VIRTUAL(object_tite_Tex_002100)));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, object_tite_Tex_001B00);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x09, object_tite_Tex_001F00);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0A, object_tite_Tex_002100);
|
||||
}
|
||||
|
||||
if (this->displayList != NULL) {
|
||||
|
@ -45,11 +45,8 @@ void FileChoose_SetView(FileChooseContext* this, f32 eyeX, f32 eyeY, f32 eyeZ) {
|
||||
func_800AAA50(&this->view, 0x7F);
|
||||
}
|
||||
|
||||
Gfx* FileChoose_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, s16 point)
|
||||
Gfx* FileChoose_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, s16 point)
|
||||
{
|
||||
if (ResourceMgr_OTRSigCheck(texture))
|
||||
texture = ResourceMgr_LoadTexByName(texture);
|
||||
|
||||
gDPLoadTextureBlock(gfx++, texture, G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
@ -1500,13 +1497,13 @@ void FileChoose_LoadGame(GameState* thisx) {
|
||||
gSaveContext.naviTimer = 0;
|
||||
|
||||
// SWORDLESS LINK IS BACK BABY
|
||||
if (CVar_GetS32("gSwordlessLink", 0) != 0)
|
||||
if (CVar_GetS32("gSwordlessLink", 0) != 0)
|
||||
{
|
||||
if ((gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI) &&
|
||||
(gSaveContext.equips.buttonItems[0] != ITEM_SWORD_MASTER) &&
|
||||
(gSaveContext.equips.buttonItems[0] != ITEM_SWORD_BGS) &&
|
||||
(gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KNIFE)) {
|
||||
|
||||
|
||||
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
|
||||
swordEquipMask = _byteswap_ushort(gEquipMasks[EQUIP_SWORD]) & gSaveContext.equips.equipment;
|
||||
gSaveContext.equips.equipment &= gEquipNegMasks[EQUIP_SWORD];
|
||||
|
@ -199,7 +199,7 @@ void Title_Draw(TitleContext* this) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 170, 255, 255, 255);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 255, 128);
|
||||
|
||||
gDPLoadMultiBlock(POLY_OPA_DISP++, ResourceMgr_LoadTexByName(nintendo_rogo_static_Tex_001800), 0x100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0,
|
||||
gDPLoadMultiBlock(POLY_OPA_DISP++, nintendo_rogo_static_Tex_001800, 0x100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, 2, 11);
|
||||
|
||||
for (idx = 0, y = 94; idx < 16; idx++, y += 2)
|
||||
|
@ -64,7 +64,7 @@ void KaleidoScope_DrawEquipmentImage(GlobalContext* globalCtx, void* source, u32
|
||||
|
||||
gDPLoadSync(POLY_KAL_DISP++);
|
||||
gDPLoadTile(POLY_KAL_DISP++, G_TX_LOADTILE, 0, 0, (width - 1) << 2, (textureHeight - 1) << 2);
|
||||
|
||||
|
||||
gDPSetTextureImageFB(POLY_KAL_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, fbTest);
|
||||
gSP1Quadrangle(POLY_KAL_DISP++, 0, 2, 3, 1, 0);
|
||||
|
||||
@ -575,7 +575,14 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
|
||||
} else if ((i == 0) && (k == 2) && (gBitFlags[bit + 1] & gSaveContext.inventory.equipment)) {
|
||||
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gBrokenGiantsKnifeIconTex, 32, 32, point);
|
||||
} else if (gBitFlags[bit] & gSaveContext.inventory.equipment) {
|
||||
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[ITEM_SWORD_KOKIRI + temp], 32, 32, point);
|
||||
int itemId = ITEM_SWORD_KOKIRI + temp;
|
||||
bool not_acquired = (gItemAgeReqs[itemId] != 9) && (gItemAgeReqs[itemId] != gSaveContext.linkAge);
|
||||
if (not_acquired) {
|
||||
gsDPSetGrayscaleColor(POLY_KAL_DISP++, 100, 100, 100);
|
||||
gsSPGrayscale(POLY_KAL_DISP++, true);
|
||||
}
|
||||
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[itemId], 32, 32, point);
|
||||
gsSPGrayscale(POLY_KAL_DISP++, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -467,8 +467,15 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
gSPVertex(POLY_KAL_DISP++, &pauseCtx->itemVtx[j + 0], 4, 0);
|
||||
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[gSaveContext.inventory.items[i]], 32,
|
||||
int itemId = gSaveContext.inventory.items[i];
|
||||
bool not_acquired = (gItemAgeReqs[itemId] != 9) && (gItemAgeReqs[itemId] != gSaveContext.linkAge);
|
||||
if (not_acquired) {
|
||||
gsDPSetGrayscaleColor(POLY_KAL_DISP++, 100, 100, 100);
|
||||
gsSPGrayscale(POLY_KAL_DISP++, true);
|
||||
}
|
||||
KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[itemId], 32,
|
||||
32, 0);
|
||||
gsSPGrayscale(POLY_KAL_DISP++, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3081,14 +3081,6 @@ void KaleidoScope_Update(GlobalContext* globalCtx)
|
||||
|
||||
gSegments[8] = VIRTUAL_TO_PHYSICAL(pauseCtx->iconItemSegment);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNTU(gItemAgeReqs); i++) {
|
||||
if ((gItemAgeReqs[i] != 9) && (gItemAgeReqs[i] != ((void)0, gSaveContext.linkAge)))
|
||||
{
|
||||
gSPInvalidateTexCache(globalCtx->state.gfxCtx->polyKal.p++, ResourceMgr_LoadTexByName(gItemIcons[i]));
|
||||
KaleidoScope_GrayOutTextureRGBA32(SEGMENTED_TO_VIRTUAL(gItemIcons[i]), 0x400);
|
||||
}
|
||||
}
|
||||
|
||||
pauseCtx->iconItem24Segment = (void*)(((uintptr_t)pauseCtx->iconItemSegment + size0 + 0xF) & ~0xF);
|
||||
|
||||
#if 1
|
||||
|
Loading…
Reference in New Issue
Block a user