Re-implement painting changes from develop/arceveti/general & sm64v2

This commit is contained in:
Arceveti
2022-01-14 15:30:13 -08:00
parent e63d20b420
commit 449ebc0a7a
10 changed files with 432 additions and 580 deletions

View File

@@ -89,8 +89,8 @@ const GeoLayout castle_geo_001088[] = {
GEO_OPEN_NODE(),
GEO_DISPLAY_LIST(LAYER_OPAQUE, inside_castle_seg7_dl_0703A6C8),
GEO_DISPLAY_LIST(LAYER_ALPHA, inside_castle_seg7_dl_0703A808),
GEO_DISPLAY_LIST(LAYER_OPAQUE, inside_castle_seg7_dl_070234C0),
GEO_DISPLAY_LIST(LAYER_OPAQUE, inside_castle_seg7_dl_07023520),
GEO_DISPLAY_LIST(LAYER_OPAQUE, inside_castle_seg7_dl_ccm_fake_painting_1),
GEO_DISPLAY_LIST(LAYER_OPAQUE, inside_castle_seg7_dl_ccm_fake_painting_2),
GEO_ASM( 0, geo_painting_update),
GEO_ASM(PAINTING_ID(1, 1), geo_painting_draw),
GEO_CLOSE_NODE(),
@@ -231,8 +231,8 @@ const GeoLayout castle_geo_001348[] = {
GEO_ASM( 0, geo_exec_inside_castle_light),
GEO_DISPLAY_LIST(LAYER_OPAQUE, inside_castle_seg7_dl_0703A6C8),
GEO_DISPLAY_LIST(LAYER_ALPHA, inside_castle_seg7_dl_0703A808),
GEO_DISPLAY_LIST(LAYER_OPAQUE, inside_castle_seg7_dl_070234C0),
GEO_DISPLAY_LIST(LAYER_OPAQUE, inside_castle_seg7_dl_07023520),
GEO_DISPLAY_LIST(LAYER_OPAQUE, inside_castle_seg7_dl_ccm_fake_painting_1),
GEO_DISPLAY_LIST(LAYER_OPAQUE, inside_castle_seg7_dl_ccm_fake_painting_2),
GEO_ASM( 0, geo_painting_update),
GEO_ASM(PAINTING_ID(1, 1), geo_painting_draw),
GEO_CLOSE_NODE(),

View File

@@ -55,10 +55,8 @@ extern const GeoLayout castle_geo_001BB0[];
extern const GeoLayout castle_geo_001C10[];
// leveldata
extern const Gfx inside_castle_seg7_dl_070225D8[];
extern const Gfx inside_castle_seg7_dl_07022610[];
extern const Gfx inside_castle_seg7_dl_070234C0[];
extern const Gfx inside_castle_seg7_dl_07023520[];
extern const Gfx inside_castle_seg7_dl_ccm_fake_painting_1[];
extern const Gfx inside_castle_seg7_dl_ccm_fake_painting_2[];
extern struct Painting bob_painting;
extern struct Painting ccm_painting;
extern struct Painting wf_painting;

File diff suppressed because it is too large Load Diff

View File

@@ -1,59 +1,21 @@
#include "game/paintings.h"
// 0x070241B8 - 0x070241D0
static const Lights1 hmc_seg7_lights_070241B8 = gdSPDefLights1(
0x50, 0x50, 0x50,
0xff, 0xff, 0xff, 0x32, 0x32, 0x32
// 0x070241D0 - 0x070241E8
static const Lights1 hmc_seg7_lights_cotmc_pool = gdSPDefLights1(
0x40, 0x40, 0x80,
0x64, 0x64, 0xff, 0x28, 0x28, 0x28
);
// 0x070241D0 - 0x070241E8
// No gdSPDefLights1 macro defined because of odd different light value (0xff and 0xfa)
static const Lights1 hmc_seg7_lights_070241D0 = {
{{ {0x40, 0x40, 0x80}, 0, {0x40, 0x40, 0x80}, 0} },
{{{ {0x64, 0x64, 0xff}, 0, {0x64, 0x64, 0xfa}, 0, {0x28, 0x28, 0x28},0} }}
};
// Appears to lock 4 of the sides when shimmering and in use. Unused.
// 0x070241E8 - 0x07024228
static const Vtx hmc_seg7_vertex_070241E8[] = {
{{{ 0, 0, 0}, 0, { -32, 990}, {0x00, 0x00, 0x7f, 0xff}}},
{{{ 614, 0, 0}, 0, { 6100, 990}, {0x00, 0x00, 0x7f, 0xff}}},
{{{ 614, 614, 0}, 0, { 6100, -5142}, {0x00, 0x00, 0x7f, 0xff}}},
{{{ 0, 614, 0}, 0, { -32, -5142}, {0x00, 0x00, 0x7f, 0xff}}},
};
// 0x07024228 - 0x07024268
static const Vtx hmc_seg7_vertex_07024228[] = {
static const Vtx hmc_seg7_vertex_cotmc_pool[] = {
{{{ 0, 0, 0}, 0, { 0, 0}, {0x00, 0x00, 0x7f, 0xff}}},
{{{ 614, 0, 0}, 0, { 0, 0}, {0x00, 0x00, 0x7f, 0xff}}},
{{{ 614, 614, 0}, 0, { 0, 0}, {0x00, 0x00, 0x7f, 0xff}}},
{{{ 0, 614, 0}, 0, { 0, 0}, {0x00, 0x00, 0x7f, 0xff}}},
};
// Unused
// 0x07024268 - 0x070242A0
const Gfx hmc_seg7_dl_07024268[] = {
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_MODULATERGB, G_CC_MODULATERGB),
gsSPLight(&hmc_seg7_lights_070241B8.l, 1),
gsSPLight(&hmc_seg7_lights_070241B8.a, 2),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsSPVertex(hmc_seg7_vertex_070241E8, 4, 0),
gsSPEndDisplayList(),
};
// Unused
// 0x070242A0 - 0x070242D0
const Gfx hmc_seg7_dl_070242A0[] = {
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF),
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
gsSPEndDisplayList(),
};
// 0x070242D0 - 0x070242F0
static const Gfx hmc_seg7_painting_dl_070242D0[] = {
static const Gfx hmc_seg7_painting_dl_cotmc_normal_ripple[] = {
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0, G_TX_RENDERTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, 5, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (32 - 1) << G_TEXTURE_IMAGE_FRAC, (32 - 1) << G_TEXTURE_IMAGE_FRAC),
@@ -61,7 +23,7 @@ static const Gfx hmc_seg7_painting_dl_070242D0[] = {
};
// 0x070242F0 - 0x07024CD2
static const PaintingData hmc_seg7_pool_texture_map_070242F0[] = {
static const PaintingData hmc_seg7_pool_texture_map_cotmc[] = {
157, // num mappings
// Format:
// mesh vtx ID, texture X, texture Y
@@ -493,28 +455,28 @@ static const PaintingData hmc_seg7_pool_texture_map_070242F0[] = {
};
// 0x07024CD4
static const PaintingData *const hmc_seg7_painting_texture_maps_07024CD4[] = {
hmc_seg7_pool_texture_map_070242F0,
static const PaintingData *const hmc_seg7_painting_texture_maps_cotmc[] = {
hmc_seg7_pool_texture_map_cotmc,
};
// 0x07024CE0 - 0x070254E0
ALIGNED8 static const Texture hmc_seg7_texture_07024CE0[] = {
ALIGNED8 static const Texture hmc_seg7_texture_cotmc_pool_env[] = {
#include "levels/hmc/7.rgba16.inc.c"
};
// 0x070254E0 - 0x07025518
static const Gfx hmc_seg7_painting_dl_070254E0[] = {
static const Gfx hmc_seg7_painting_dl_cotmc_normal[] = {
gsDPPipeSync(),
gsSPLight(&hmc_seg7_lights_070241D0.l, 1),
gsSPLight(&hmc_seg7_lights_070241D0.a, 2),
gsSPVertex(hmc_seg7_vertex_07024228, 4, 0),
gsSPLight(&hmc_seg7_lights_cotmc_pool.l, 1),
gsSPLight(&hmc_seg7_lights_cotmc_pool.a, 2),
gsSPVertex(hmc_seg7_vertex_cotmc_pool, 4, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSPEndDisplayList(),
};
// 0x07025518 - 0x07025594
const Texture *const hmc_seg7_painting_textures_07025518[] = {
hmc_seg7_texture_07024CE0,
const Texture *const hmc_seg7_painting_textures_cotmc[] = {
hmc_seg7_texture_cotmc_pool_env,
};
// 0x0702551C (PaintingData)
@@ -533,11 +495,11 @@ struct Painting cotmc_painting = {
/* Ripple Dispersion */ 0.0f, 15.0f, 15.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ hmc_seg7_painting_dl_070254E0,
/* Texture Maps */ hmc_seg7_painting_texture_maps_07024CD4,
/* Textures */ hmc_seg7_painting_textures_07025518,
/* Normal DList */ hmc_seg7_painting_dl_cotmc_normal,
/* Texture Maps */ hmc_seg7_painting_texture_maps_cotmc,
/* Textures */ hmc_seg7_painting_textures_cotmc,
/* Texture w, h */ 32, 32,
/* Ripple DList */ hmc_seg7_painting_dl_070242D0,
/* Ripple DList */ hmc_seg7_painting_dl_cotmc_normal_ripple,
/* Ripple Trigger */ RIPPLE_TRIGGER_CONTINUOUS,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */

View File

@@ -72,9 +72,7 @@ extern const Gfx hmc_seg7_dl_07023090[];
extern const Gfx hmc_seg7_dl_07023BC8[];
extern const Gfx hmc_seg7_dl_07023E10[];
extern const Gfx hmc_seg7_dl_07024110[];
extern const Gfx hmc_seg7_dl_07024268[];
extern const Gfx hmc_seg7_dl_070242A0[];
extern const Texture *const hmc_seg7_painting_textures_07025518[];
extern const Texture *const hmc_seg7_painting_textures_cotmc[];
extern struct Painting cotmc_painting;
extern const Collision hmc_seg7_collision_level[];
extern const MacroObject hmc_seg7_macro_objs[];

View File

@@ -1,13 +1,13 @@
#include "game/paintings.h"
// 0x070122F0 - 0x07012308
static const Lights1 ttm_seg7_lights_070122F0 = gdSPDefLights1(
static const Lights1 ttm_seg7_lights_slide_painting = gdSPDefLights1(
0x50, 0x50, 0x50,
0xff, 0xff, 0xff, 0x32, 0x32, 0x32
);
// 0x07012308 - 0x07012388
static const Vtx ttm_seg7_vertex_07012308[] = {
static const Vtx ttm_seg7_vertex_slide_painting[] = {
{{{ 0, 0, 0}, 0, { -32, 992}, {0x00, 0x00, 0x7f, 0xff}}},
{{{ 614, 0, 0}, 0, { 2012, 992}, {0x00, 0x00, 0x7f, 0xff}}},
{{{ 614, 307, 0}, 0, { 2012, 0}, {0x00, 0x00, 0x7f, 0xff}}},
@@ -19,24 +19,24 @@ static const Vtx ttm_seg7_vertex_07012308[] = {
};
// 0x07012388 - 0x070123A0
const Gfx ttm_seg7_dl_07012388[] = {
const Gfx ttm_seg7_sub_dl_slide_painting_bottom[] = {
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSPEndDisplayList(),
};
// 0x070123A0 - 0x070123B8
const Gfx ttm_seg7_dl_070123A0[] = {
const Gfx ttm_seg7_sub_dl_slide_painting_top[] = {
gsSP2Triangles( 4, 5, 6, 0x0, 4, 6, 7, 0x0),
gsSPEndDisplayList(),
};
// 0x070123B8 - 0x07012410
const Gfx ttm_seg7_dl_070123B8[] = {
const Gfx ttm_seg7_sub_dl_slide_painting_normal_begin[] = {
gsDPPipeSync(),
gsSPSetGeometryMode(G_LIGHTING | G_SHADING_SMOOTH),
gsDPSetCombineMode(G_CC_MODULATERGB, G_CC_MODULATERGB),
gsSPLight(&ttm_seg7_lights_070122F0.l, 1),
gsSPLight(&ttm_seg7_lights_070122F0.a, 2),
gsSPLight(&ttm_seg7_lights_slide_painting.l, 1),
gsSPLight(&ttm_seg7_lights_slide_painting.a, 2),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD),
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 16, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_CLAMP, 6, G_TX_NOLOD),
@@ -46,7 +46,7 @@ const Gfx ttm_seg7_dl_070123B8[] = {
};
// 0x07012410 - 0x07012430
const Gfx ttm_seg7_dl_07012410[] = {
const Gfx ttm_seg7_sub_dl_slide_painting_normal_end[] = {
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF),
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
@@ -54,7 +54,7 @@ const Gfx ttm_seg7_dl_07012410[] = {
};
// 0x07012430 - 0x07012450
static const Gfx ttm_seg7_painting_dl_07012430[] = {
static const Gfx ttm_seg7_painting_dl_slide_normal_ripple[] = {
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 16, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_CLAMP, 6, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (64 - 1) << G_TEXTURE_IMAGE_FRAC, (32 - 1) << G_TEXTURE_IMAGE_FRAC),
@@ -529,23 +529,23 @@ UNUSED static const u64 ttm_unused_0 = 0x0;
// 0x07012E98 - 0x07012EF8
static const Gfx ttm_seg7_painting_dl_07012E98[] = {
gsSPDisplayList(ttm_seg7_dl_070123B8),
gsSPVertex(ttm_seg7_vertex_07012308, 8, 0),
static const Gfx ttm_seg7_painting_dl_slide_normal[] = {
gsSPDisplayList(ttm_seg7_sub_dl_slide_painting_normal_begin),
gsSPVertex(ttm_seg7_vertex_slide_painting, 8, 0),
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, ttm_seg7_texture_07004000),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 64 * 32 - 1, CALC_DXT(64, G_IM_SIZ_16b_BYTES)),
gsSPDisplayList(ttm_seg7_dl_07012388),
gsSPDisplayList(ttm_seg7_sub_dl_slide_painting_bottom),
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, ttm_seg7_texture_07003000),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 64 * 32 - 1, CALC_DXT(64, G_IM_SIZ_16b_BYTES)),
gsSPDisplayList(ttm_seg7_dl_070123A0),
gsSPDisplayList(ttm_seg7_dl_07012410),
gsSPDisplayList(ttm_seg7_sub_dl_slide_painting_top),
gsSPDisplayList(ttm_seg7_sub_dl_slide_painting_normal_end),
gsSPEndDisplayList(),
};
// 0x07012EF8 - 0x07012F78
ALIGNED8 static const Texture *const ttm_seg7_painting_textures_07012EF8[] = {
ALIGNED8 static const Texture *const ttm_seg7_painting_textures_slide[] = {
ttm_seg7_texture_07004000, ttm_seg7_texture_07003000,
};
@@ -565,11 +565,11 @@ struct Painting ttm_slide_painting = {
/* Ripple Dispersion */ 0.0f, 40.0f, 30.0f,
/* Curr Ripple Timer */ 0.0f,
/* Curr Ripple x, y */ 0.0f, 0.0f,
/* Normal DList */ ttm_seg7_painting_dl_07012E98,
/* Normal DList */ ttm_seg7_painting_dl_slide_normal,
/* Texture Maps */ ttm_seg7_painting_texture_maps_07012E88,
/* Textures */ ttm_seg7_painting_textures_07012EF8,
/* Textures */ ttm_seg7_painting_textures_slide,
/* Texture w, h */ 64, 32,
/* Ripple DList */ ttm_seg7_painting_dl_07012430,
/* Ripple DList */ ttm_seg7_painting_dl_slide_normal_ripple,
/* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY,
/* Alpha */ 0xFF,
/* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */

View File

@@ -67,10 +67,10 @@ extern const Gfx ttm_seg7_dl_07011608[];
extern const Gfx ttm_seg7_dl_07011C78[];
extern const Gfx ttm_seg7_dl_07011D78[];
extern const Gfx ttm_seg7_dl_07012270[];
extern const Gfx ttm_seg7_dl_07012388[];
extern const Gfx ttm_seg7_dl_070123A0[];
extern const Gfx ttm_seg7_dl_070123B8[];
extern const Gfx ttm_seg7_dl_07012410[];
extern const Gfx ttm_seg7_sub_dl_slide_painting_bottom[];
extern const Gfx ttm_seg7_sub_dl_slide_painting_top[];
extern const Gfx ttm_seg7_sub_dl_slide_painting_normal_begin[];
extern const Gfx ttm_seg7_sub_dl_slide_painting_normal_end[];
extern struct Painting ttm_slide_painting;
extern const Gfx ttm_seg7_dl_07013430[];
extern const Gfx ttm_seg7_dl_07013608[];

View File

@@ -9577,31 +9577,27 @@ void cutscene_enter_painting(struct Camera *c) {
struct Surface *floor, *highFloor;
Vec3f paintingPos, focus, focusOffset;
Vec3s paintingAngle;
f32 floorHeight;
cutscene_event(cutscene_enter_painting_stub, c, 0, 0);
// Zoom in
set_fov_function(CAM_FOV_APP_20);
sStatusFlags |= CAM_FLAG_SMOOTH_MOVEMENT;
if (gRipplingPainting != NULL) {
paintingAngle[0] = 0;
paintingAngle[1] = (s32)((gRipplingPainting->yaw / 360.f) * 65536.f); // convert degrees to IAU
paintingAngle[1] = (s32)((gRipplingPainting->yaw / 360.0f) * 65536.0f); // convert degrees to IAU
paintingAngle[2] = 0;
focusOffset[0] = gRipplingPainting->size / 2;
focusOffset[0] = gRipplingPainting->size * 0.5f;
focusOffset[1] = focusOffset[0];
focusOffset[2] = 0;
paintingPos[0] = gRipplingPainting->posX;
paintingPos[1] = gRipplingPainting->posY;
paintingPos[2] = gRipplingPainting->posZ;
vec3f_copy(paintingPos, gRipplingPainting->pos);
offset_rotated(focus, paintingPos, focusOffset, paintingAngle);
approach_vec3f_asymptotic(c->focus, focus, 0.1f, 0.1f, 0.1f);
focusOffset[2] = -(((gRipplingPainting->size * 1000.f) / 2) / 307.f);
focusOffset[2] = -(((gRipplingPainting->size * 1000.0f) / 2) / 307.0f);
offset_rotated(focus, paintingPos, focusOffset, paintingAngle);
floorHeight = find_floor(focus[0], focus[1] + 500.f, focus[2], &highFloor) + 125.f;
f32 floorHeight = find_floor(focus[0], focus[1] + 500.0f, focus[2], &highFloor) + 125.0f;
if (focus[1] < floorHeight) {
focus[1] = floorHeight;
@@ -9613,10 +9609,11 @@ void cutscene_enter_painting(struct Camera *c) {
approach_vec3f_asymptotic(c->pos, focus, 0.9f, 0.9f, 0.9f);
}
find_floor(sMarioCamState->pos[0], sMarioCamState->pos[1] + 50.f, sMarioCamState->pos[2], &floor);
find_floor(sMarioCamState->pos[0], sMarioCamState->pos[1] + 50.0f, sMarioCamState->pos[2], &floor);
if ((floor->type < SURFACE_PAINTING_WOBBLE_A6) || (floor->type > SURFACE_PAINTING_WARP_F9)) {
c->cutscene = 0;
if ((floor->type < SURFACE_PAINTING_WOBBLE_A6)
|| (floor->type > SURFACE_PAINTING_WARP_F9)) {
c->cutscene = CUTSCENE_NONE;
gCutsceneTimer = CUTSCENE_STOP;
sStatusFlags |= CAM_FLAG_SMOOTH_MOVEMENT;
}

File diff suppressed because it is too large Load Diff

View File

@@ -63,9 +63,7 @@ struct Painting {
f32 yaw;
/// The painting's position
f32 posX;
f32 posY;
f32 posZ;
Vec3f pos;
/// Controls how high the peaks of the ripple are.
f32 currRippleMag;
@@ -114,11 +112,11 @@ struct Painting {
Alpha alpha;
/// True if Mario was under the painting's y coordinate last frame
s8 marioWasUnder;
u8 marioWasUnder : 1;
/// True if Mario is currently under the painting's y coordinate
s8 marioIsUnder;
u8 marioIsUnder : 1;
/// True if Mario just went under the painting's y coordinate on this frame
s8 marioWentUnder;
u8 marioWentUnder : 1;
/// Uniformly scales the painting to a multiple of PAINTING_SIZE.
/// By default a painting is 614.0 x 614.0