Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,143 changes: 574 additions & 569 deletions ASM/build/asm_symbols.txt

Large diffs are not rendered by default.

Binary file modified ASM/build/bundle.o
Binary file not shown.
1,097 changes: 553 additions & 544 deletions ASM/build/c_symbols.txt

Large diffs are not rendered by default.

92 changes: 83 additions & 9 deletions ASM/c/item_draw_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "z64.h"
#include "item_draw_table.h"
#include "sys_matrix.h"
#include "rainbow.h"

typedef Gfx* (*append_setup_dl_fn)(Gfx* gfx, uint32_t dl_index);
typedef void (*append_setup_dl_26_to_opa_fn)(z64_gfx_t* gfx);
Expand All @@ -18,6 +19,7 @@ typedef Gfx* (*gen_double_tile_fn)(z64_gfx_t* gfx, int32_t tile1, uint32_t x1, u
#define gen_double_tile ((gen_double_tile_fn)0x8007EB84)

extern z64_actor_t* curr_drawn_actor;
extern Gfx sSetupDL[71][6];

void draw_gi_bombchu_and_masks(z64_game_t* game, uint32_t draw_id) {
z64_gfx_t* gfx = game->common.gfx;
Expand Down Expand Up @@ -114,6 +116,13 @@ void draw_gi_silver_rupee_pouch(z64_game_t* game, uint32_t draw_id) {
gSPDisplayList(gfx->poly_opa.p++, item_draw_table[draw_id].args[6].dlist); // gGiAdultWalletRupeeInnerColorDL
gSPDisplayList(gfx->poly_opa.p++, item_draw_table[draw_id].args[7].dlist); // gGiWalletRupeeInnerDL
}
void draw_gi_various_xlu0(z64_game_t* game, uint32_t draw_id) {
z64_gfx_t* gfx = game->common.gfx;

append_setup_dl_25_to_xlu(gfx);
gSPMatrix(gfx->poly_xlu.p++, append_sys_matrix(gfx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
gSPDisplayList(gfx->poly_xlu.p++, item_draw_table[draw_id].args[0].dlist);
}

void draw_gi_various_xlu01(z64_game_t* game, uint32_t draw_id) {
z64_gfx_t* gfx = game->common.gfx;
Expand Down Expand Up @@ -365,7 +374,7 @@ void draw_gi_blue_fire_candle(z64_game_t* game, uint32_t draw_id) {
1, game->common.state_frames * 1, -(game->common.state_frames * 8), 16, 32));
duplicate_sys_matrix();
translate_sys_matrix(-8.0f, -2.0f, 0.0f, 1);
update_sys_matrix(game->mf_11DA0);
update_sys_matrix(game->billboard_mtx);
gSPMatrix(gfx->poly_xlu.p++, append_sys_matrix(gfx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
gSPDisplayList(gfx->poly_xlu.p++, item_draw_table[draw_id].args[1].dlist);
pop_sys_matrix();
Expand All @@ -386,7 +395,7 @@ void draw_gi_fairy_lantern(z64_game_t* game, uint32_t draw_id) {
0, 0, 0, 32, 32,
1, game->common.state_frames, -(game->common.state_frames * 6), 32, 32));
duplicate_sys_matrix();
update_sys_matrix(game->mf_11DA0);
update_sys_matrix(game->billboard_mtx);
gSPMatrix(gfx->poly_xlu.p++, append_sys_matrix(gfx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
gSPDisplayList(gfx->poly_xlu.p++, item_draw_table[draw_id].args[2].dlist);
pop_sys_matrix();
Expand All @@ -401,7 +410,7 @@ void draw_gi_fairy(z64_game_t* game, uint32_t draw_id) {
0, 0, 0, 32, 32,
1, game->common.state_frames, -(game->common.state_frames * 6), 32, 32));
duplicate_sys_matrix();
update_sys_matrix(game->mf_11DA0);
update_sys_matrix(game->billboard_mtx);
gSPMatrix(gfx->poly_xlu.p++, append_sys_matrix(gfx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
// Not sure how much of this is required but these are called from the bottle DL. Not including them causes it to draw weird
gDPSetRenderMode(gfx->poly_xlu.p++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2);
Expand All @@ -428,7 +437,7 @@ void draw_gi_poe_bottles(z64_game_t* game, uint32_t draw_id) {
0, 0, 0, 16, 32,
1, game->common.state_frames * 1, -(game->common.state_frames * 6), 16, 32));
duplicate_sys_matrix();
update_sys_matrix(game->mf_11DA0);
update_sys_matrix(game->billboard_mtx);
gSPMatrix(gfx->poly_xlu.p++, append_sys_matrix(gfx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
gSPDisplayList(gfx->poly_xlu.p++, item_draw_table[draw_id].args[3].dlist);
gSPDisplayList(gfx->poly_xlu.p++, item_draw_table[draw_id].args[2].dlist);
Expand Down Expand Up @@ -736,16 +745,31 @@ void draw_gi_magic_meter(z64_game_t* game, uint32_t draw_id) {
}
}

// Rainbow smoke effect
colorRGBA8_t rainbow_color;
rainbow_color.a = 0xFF;
rainbow_color.color = get_rainbow_color(game->gameplay_frames, 10);
//z64_xyzf_t translation = { .x = 0, .y = -35.0f, .z = -20.0f };
z64_xyzf_t translation = { .x = 0.0, .y = -35.0f, .z = 0.0f };
z64_xyzf_t scale = { .x = .0125f, .y = .0075f, .z = .01f };
draw_gi_flame(&gfx->poly_xlu, game, rainbow_color, rainbow_color, translation, scale);
// Parchment
append_setup_dl_25_to_xlu(gfx);
gSPMatrix(gfx->poly_xlu.p++, append_sys_matrix(gfx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
gSPDisplayList(gfx->poly_xlu.p++, item_draw_table[draw_id].args[3].dlist);
// Writing
append_setup_dl_25_to_xlu(gfx);
gSPMatrix(gfx->poly_xlu.p++, append_sys_matrix(gfx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
gSPDisplayList(gfx->poly_xlu.p++, item_draw_table[draw_id].args[4].dlist);

// Shine
append_setup_dl_25_to_xlu(gfx);
/*append_setup_dl_25_to_xlu(gfx);
gSPMatrix(gfx->poly_xlu.p++, append_sys_matrix(gfx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
gDPSetPrimColor(gfx->poly_xlu.p++, 0, 0x80, prim_color.r, prim_color.g, prim_color.b, alpha);
gDPSetEnvColor(gfx->poly_xlu.p++, env_color.r, env_color.g, env_color.b, env_color.a);
gSPDisplayList(gfx->poly_xlu.p++, item_draw_table[draw_id].args[2].dlist);
*/

// Jar
append_setup_dl_25_to_xlu(gfx);
gSPMatrix(gfx->poly_xlu.p++, append_sys_matrix(gfx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
Expand All @@ -756,8 +780,58 @@ void draw_gi_magic_meter(z64_game_t* game, uint32_t draw_id) {
append_setup_dl_25_to_xlu(gfx);
gSPMatrix(gfx->poly_xlu.p++, append_sys_matrix(gfx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
gSPDisplayList(gfx->poly_xlu.p++, item_draw_table[draw_id].args[1].dlist);
// Parchment
append_setup_dl_25_to_opa(gfx);
gSPMatrix(gfx->poly_opa.p++, append_sys_matrix(gfx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
gSPDisplayList(gfx->poly_opa.p++, item_draw_table[draw_id].args[3].dlist);
}

void draw_gi_flame(z64_disp_buf_t* dl, z64_game_t *game, colorRGBA8_t prim, colorRGBA8_t env, z64_xyzf_t translation, z64_xyzf_t scale) {
z64_gfx_t *gfx = game->common.gfx;
static const uint32_t kFlameDlist = 0x52a10; // Offset of gEffFire1DL in gameplay_keep
duplicate_sys_matrix(); // Push the matrix stack. Do this so we can apply the smoke before the rest of the model
update_sys_matrix(game->billboard_mtx); // Set the rotation to use the billboard matrix
translate_sys_matrix(translation.x, translation.y, translation.z, 1); // Translate by the amount specified
scale_sys_matrix(scale.x, scale.y, scale.z, 1); // Scale by the amount specified
gSPMatrix(dl->p++, append_sys_matrix(gfx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); // Apply the matrix

// Draw the flame effect
gSPDisplayList(dl->p++, sSetupDL[25]);
gDPSetEnvColor(dl->p++, env.r, env.g, env.b, 0);
gDPSetPrimColor(dl->p++, 0x0, 0x80, prim.r, prim.g, prim.b, 255);

gSPSegment(dl->p++, 0x08,
gen_double_tile(gfx, G_TX_RENDERTILE, 0, 0, 0x20, 0x40, 1, 0,
(-game->gameplay_frames & 0x7F) << 2, 0x20, 0x80));

gSPDisplayList(dl->p++, 0x04000000 | kFlameDlist);
pop_sys_matrix(); // Pop the matrix stack
}

/* void draw_gi_opa_with_rainbow_flame(z64_game_t* game, uint32_t draw_id) {
draw_gi_various_xlu01(game, draw_id);
colorRGBA8_t rainbow_color;
rainbow_color.a = 0xFF;
rainbow_color.color = get_rainbow_color(game->gameplay_frames, 10);

Comment thread
rrealmuto marked this conversation as resolved.
z64_xyzf_t translation = { .x = 0, .y = -35.0f, .z = -10.0f };
z64_xyzf_t scale = { .x = .0125f, .y = .0075f, .z = .01f };
draw_gi_flame(game, rainbow_color, rainbow_color, translation, scale);
}
*/

void draw_gi_xlu_with_flame(z64_game_t* game, uint32_t draw_id) {
z64_gfx_t *gfx = game->common.gfx;

z64_xyzf_t translation = { .x = 0, .y = -35.0f, .z = 0.0f };
z64_xyzf_t scale = { .x = .0125f, .y = .0075f, .z = .01f };
draw_gi_flame(&gfx->poly_xlu, game, item_draw_table[draw_id].args[1].color, item_draw_table[draw_id].args[2].color, translation, scale);

draw_gi_various_xlu0(game, draw_id);
}

void draw_gi_deku_nut_with_flame(z64_game_t* game, uint32_t draw_id) {
z64_gfx_t *gfx = game->common.gfx;

z64_xyzf_t translation = { .x = 0, .y = -35.0f, .z = -10.0f };
z64_xyzf_t scale = { .x = .0125f, .y = .0075f, .z = .01f };
draw_gi_flame(&gfx->poly_xlu, game, item_draw_table[draw_id].args[1].color, item_draw_table[draw_id].args[2].color, translation, scale);

draw_gi_deku_nut(game, draw_id);
}
3 changes: 3 additions & 0 deletions ASM/c/item_draw_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@ void draw_gi_nothing(z64_game_t* game, uint32_t draw_id);
void draw_gi_medallions(z64_game_t* game, uint32_t draw_id);
void draw_gi_stones(z64_game_t* game, uint32_t draw_id);
void draw_gi_magic_meter(z64_game_t* game, uint32_t draw_id);
void draw_gi_flame(z64_disp_buf_t* dl, z64_game_t *game, colorRGBA8_t prim, colorRGBA8_t env, z64_xyzf_t translation, z64_xyzf_t scale);
void draw_gi_xlu_with_flame(z64_game_t *game, uint32_t draw_id);
void draw_gi_deku_nut_with_flame(z64_game_t* game, uint32_t draw_id);

#endif
8 changes: 5 additions & 3 deletions ASM/c/item_draw_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ item_draw_table_entry_t item_draw_table[] = {
[0x1A] = { draw_gi_various_opa0, { 0x060004D0 } }, // Deku Stick
[0x1B] = { draw_gi_various_opa0, { 0x060003C0 } }, // Map
[0x1C] = { draw_gi_various_opa0, { 0x06000A50 } }, // Deku Shield
[0x1D] = { draw_gi_various_opa0, { 0x06000580 } }, // Small Magic Jar
[0x1E] = { draw_gi_various_opa0, { 0x06000EE0 } }, // Large Magic Jar
[0x1D] = { draw_gi_various_opa0, { 0x06000580, 0xe0d4ffFF, 0xd4ffe2FF } }, // Small Magic Jar
[0x1E] = { draw_gi_various_opa0, { 0x06000EE0, 0xe0d4ffFF, 0xd4ffe2FF } }, // Large Magic Jar
[0x1F] = { draw_gi_various_opa0, { 0x060009A0 } }, // Bomb
[0x20] = { draw_gi_various_opa0, { 0x06000B70 } }, // Stone of Agony
[0x21] = { draw_gi_wallets, { 0x06001850, 0x06001750, 0x06001790, 0x060019A0, 0x060017B0, 0x06001A28, 0x060017D0, 0x06001AD8 } }, // Adult's Wallet
Expand Down Expand Up @@ -175,7 +175,9 @@ item_draw_table_entry_t item_draw_table[] = {
[0x9D] = { draw_gi_fairy, { 0x06000EF0 } }, // Fairy (not in a bottle but uses the fairy from the bottle)
[0x9E] = { draw_gi_nothing, {} },
[0x9F] = { draw_gi_magic_meter, { 0x06000000, 0x060007B0, 0x06000FD8, 0x060009F8, 0x06001438, 0x286428FF, 0x000000FF } }, // Magic Meter Scroll
};
[0xA0] = { draw_gi_xlu_with_flame, { 0x060004D0, 0xC0C0C0FF, 0xC0C0C0FF } }, // Deku Stick Upgrade w/ Smoke Effect
[0xA1] = { draw_gi_deku_nut_with_flame, { 0x06000E90, 0xC0C0C0FF, 0xC0C0C0FF } }, // Deku Nut Upgrade w/ Smoke Effect
};

void base_draw_gi_model(z64_game_t* game, uint32_t draw_id) {
item_draw_table[draw_id].draw_func(game, draw_id);
Expand Down
12 changes: 6 additions & 6 deletions ASM/c/item_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ item_row_t item_table[GI_RANDO_MAX] = {
[GI_RUPEE_RED_LOSE] = ITEM_ROW(0x4D, BROWN_CHEST, 0x86, -1, 0x00F6, 0x017F, 0x6F, no_upgrade, no_effect, -1, -1, NULL), // Red Rupee (Chest Game)
[GI_RUPEE_PURPLE_LOSE] = ITEM_ROW(0x4D, BROWN_CHEST, 0x87, -1, 0x00F7, 0x017F, 0x71, no_upgrade, no_effect, -1, -1, NULL), // Purple Rupee (Chest Game)
[GI_HEART_PIECE_WIN] = ITEM_ROW(0x53, HEART_CHEST_SMALL, 0x7A, -1, 0x00FA, 0x00BD, 0x14, health_upgrade_cap, full_heal, -1, -1, NULL), // Piece of Heart (Chest Game)
[GI_DEKU_STICK_UPGRADE_20] = ITEM_ROW(0x53, BROWN_CHEST, 0x98, -1, 0x0090, 0x00C7, 0x1B, no_upgrade, no_effect, -1, -1, NULL), // Deku Stick Upgrade (20)
[GI_DEKU_STICK_UPGRADE_30] = ITEM_ROW(0x53, BROWN_CHEST, 0x99, -1, 0x0091, 0x00C7, 0x1B, no_upgrade, no_effect, -1, -1, NULL), // Deku Stick Upgrade (30)
[GI_DEKU_NUT_UPGRADE_30] = ITEM_ROW(0x53, BROWN_CHEST, 0x9A, -1, 0x00A7, 0x00BB, 0x12, no_upgrade, no_effect, -1, -1, NULL), // Deku Nut Upgrade (30)
[GI_DEKU_NUT_UPGRADE_40] = ITEM_ROW(0x53, BROWN_CHEST, 0x9B, -1, 0x00A8, 0x00BB, 0x12, no_upgrade, no_effect, -1, -1, NULL), // Deku Nut Upgrade (40)
[GI_DEKU_STICK_UPGRADE_20] = ITEM_ROW(0x53, BROWN_CHEST, 0x98, -1, 0x0090, 0x00C7, 0xA1, no_upgrade, no_effect, -1, -1, NULL), // Deku Stick Upgrade (20)
[GI_DEKU_STICK_UPGRADE_30] = ITEM_ROW(0x53, BROWN_CHEST, 0x99, -1, 0x0091, 0x00C7, 0xA1, no_upgrade, no_effect, -1, -1, NULL), // Deku Stick Upgrade (30)
[GI_DEKU_NUT_UPGRADE_30] = ITEM_ROW(0x53, BROWN_CHEST, 0x9A, -1, 0x00A7, 0x00BB, 0xA2, no_upgrade, no_effect, -1, -1, NULL), // Deku Nut Upgrade (30)
[GI_DEKU_NUT_UPGRADE_40] = ITEM_ROW(0x53, BROWN_CHEST, 0x9B, -1, 0x00A8, 0x00BB, 0xA2, no_upgrade, no_effect, -1, -1, NULL), // Deku Nut Upgrade (40)
[GI_BULLET_BAG_50] = ITEM_ROW(0x53, GILDED_CHEST, 0x49, -1, 0x006C, 0x017B, 0x73, no_upgrade, no_effect, -1, -1, NULL), // Bullet Bag (50)
[GI_ICE_TRAP] = ITEM_ROW(0x53, GILDED_CHEST, 0x41, -1, 0x9002, 0x0000, 0x00, no_upgrade, ice_trap_effect, -1, -1, NULL), // Ice Trap

Expand All @@ -167,8 +167,8 @@ item_row_t item_table[GI_RANDO_MAX] = {
[GI_PROGRESSIVE_SLINGSHOT] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00E7, 0x33, slingshot_upgrade, no_effect, -1, -1, NULL), // Progressive Slingshot
[GI_PROGRESSIVE_WALLET] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00D1, 0x22, wallet_upgrade, no_effect, -1, -1, NULL), // Progressive Wallet
[GI_PROGRESSIVE_SCALE] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00DB, 0x2A, scale_upgrade, no_effect, -1, -1, NULL), // Progressive Scale
[GI_PROGRESSIVE_NUT_CAPACITY] = ITEM_ROW( -1, BROWN_CHEST, -1, -1, -1, 0x00BB, 0x12, nut_upgrade, no_effect, -1, -1, NULL), // Progressive Nut Capacity
[GI_PROGRESSIVE_STICK_CAPACITY] = ITEM_ROW( -1, BROWN_CHEST, -1, -1, -1, 0x00C7, 0x1B, stick_upgrade, no_effect, -1, -1, NULL), // Progressive Stick Capacity
[GI_PROGRESSIVE_NUT_CAPACITY] = ITEM_ROW( -1, BROWN_CHEST, -1, -1, -1, 0x00BB, 0xA2, nut_upgrade, no_effect, -1, -1, NULL), // Progressive Nut Capacity
[GI_PROGRESSIVE_STICK_CAPACITY] = ITEM_ROW( -1, BROWN_CHEST, -1, -1, -1, 0x00C7, 0xA1, stick_upgrade, no_effect, -1, -1, NULL), // Progressive Stick Capacity
[GI_PROGRESSIVE_BOMBCHUS] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00D9, 0x28, bombchu_upgrade, no_effect, -1, -1, NULL), // Progressive Bombchus
[GI_PROGRESSIVE_MAGIC_METER] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x00CD, 0x1E, magic_upgrade, no_effect, -1, -1, NULL), // Progressive Magic Meter
[GI_PROGRESSIVE_OCARINA] = ITEM_ROW( -1, GILDED_CHEST, -1, -1, -1, 0x010E, 0x46, ocarina_upgrade, no_effect, -1, -1, NULL), // Progressive Ocarina
Expand Down
2 changes: 1 addition & 1 deletion ASM/c/z64.h
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,7 @@ typedef struct {
char unk_16_[0x000B]; /* 0x11CBD */
void *room_ptr; /* 0x11CC8 */
char unk_17_[0x00D4]; /* 0x11CCC */
float mf_11DA0[4][4]; /* 0x11DA0 */
float billboard_mtx[4][4]; /* 0x11DA0 */
char unk_18_[0x0004]; /* 0x11DE0 */
uint32_t gameplay_frames; /* 0x11DE4 */
uint8_t link_age; /* 0x11DE8 */
Expand Down
1 change: 1 addition & 0 deletions ASM/ootSymbols.ld
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ z64_sEquipAnimTimer = 0x8039EAB4;
z64_sEquipMoveTimer = 0x8039EAB8;
gActorOverlayTable = 0x800E8530;
Message_CloseTextbox = 0x800d6218;
sSetupDL = 0x800f7d50;
2 changes: 1 addition & 1 deletion data/generated/patch_symbols.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading