Force broken romhack port missing skyboxes to BACKGROUND_HAUNTED

This commit is contained in:
MysterD 2023-10-26 16:09:36 -07:00
parent 0f60e3fe95
commit 52727ee4bb
3 changed files with 12 additions and 8 deletions

View File

@ -692,10 +692,10 @@ void geo_layout_cmd_node_generated(void) {
*/ */
void geo_layout_cmd_node_background(void) { void geo_layout_cmd_node_background(void) {
struct GraphNodeBackground *graphNode; struct GraphNodeBackground *graphNode;
s16 backgroundIdOrColor = cur_geo_cmd_s16(0x02);
graphNode = init_graph_node_background( graphNode = init_graph_node_background(
gGraphNodePool, NULL, gGraphNodePool, NULL,
cur_geo_cmd_s16(0x02), // background ID, or RGBA5551 color if asm function is null backgroundIdOrColor, // background ID, or RGBA5551 color if asm function is null
(GraphNodeFunc) cur_geo_cmd_ptr(0x04), // asm function (GraphNodeFunc) cur_geo_cmd_ptr(0x04), // asm function
0); 0);
@ -783,7 +783,7 @@ void geo_layout_cmd_node_background_ext(void) {
gGraphNodePool, NULL, gGraphNodePool, NULL,
BACKGROUND_CUSTOM, // background ID, or RGBA5551 color if asm function is null BACKGROUND_CUSTOM, // background ID, or RGBA5551 color if asm function is null
(GraphNodeFunc) cur_geo_cmd_ptr(0x08), // asm function (GraphNodeFunc) cur_geo_cmd_ptr(0x08), // asm function
0); 1);
register_scene_graph_node(&graphNode->fnNode.node); register_scene_graph_node(&graphNode->fnNode.node);

View File

@ -482,7 +482,7 @@ struct GraphNodeGenerated *init_graph_node_generated(struct DynamicPool *pool,
struct GraphNodeBackground *init_graph_node_background(struct DynamicPool *pool, struct GraphNodeBackground *init_graph_node_background(struct DynamicPool *pool,
struct GraphNodeBackground *graphNode, struct GraphNodeBackground *graphNode,
u16 background, GraphNodeFunc backgroundFunc, u16 background, GraphNodeFunc backgroundFunc,
s32 zero) { u8 extended) {
if (pool != NULL) { if (pool != NULL) {
graphNode = dynamic_pool_alloc(pool, sizeof(struct GraphNodeBackground)); graphNode = dynamic_pool_alloc(pool, sizeof(struct GraphNodeBackground));
} }
@ -490,14 +490,18 @@ struct GraphNodeBackground *init_graph_node_background(struct DynamicPool *pool,
if (graphNode != NULL) { if (graphNode != NULL) {
init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_BACKGROUND); init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_BACKGROUND);
if (backgroundFunc && background > BACKGROUND_CUSTOM) { bool invalidBackground = (extended)
? (backgroundFunc && background > BACKGROUND_CUSTOM)
: (backgroundFunc && background >= BACKGROUND_CUSTOM);
if (invalidBackground) {
LOG_ERROR("invalid background id"); LOG_ERROR("invalid background id");
background = BACKGROUND_OCEAN_SKY; background = BACKGROUND_HAUNTED;
} }
graphNode->background = (background << 16) | background; graphNode->background = (background << 16) | background;
graphNode->fnNode.func = backgroundFunc; graphNode->fnNode.func = backgroundFunc;
graphNode->unused = zero; // always 0, unused graphNode->unused = 0; // always 0, unused
if (backgroundFunc != NULL) { if (backgroundFunc != NULL) {
backgroundFunc(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool); backgroundFunc(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);

View File

@ -423,7 +423,7 @@ struct GraphNodeObjectParent *init_graph_node_object_parent(struct DynamicPool *
struct GraphNodeGenerated *init_graph_node_generated(struct DynamicPool *pool, struct GraphNodeGenerated *sp1c, struct GraphNodeGenerated *init_graph_node_generated(struct DynamicPool *pool, struct GraphNodeGenerated *sp1c,
GraphNodeFunc gfxFunc, s32 parameter); GraphNodeFunc gfxFunc, s32 parameter);
struct GraphNodeBackground *init_graph_node_background(struct DynamicPool *pool, struct GraphNodeBackground *sp1c, struct GraphNodeBackground *init_graph_node_background(struct DynamicPool *pool, struct GraphNodeBackground *sp1c,
u16 background, GraphNodeFunc backgroundFunc, s32 zero); u16 background, GraphNodeFunc backgroundFunc, u8 extended);
struct GraphNodeHeldObject *init_graph_node_held_object(struct DynamicPool *pool, struct GraphNodeHeldObject *sp1c, struct GraphNodeHeldObject *init_graph_node_held_object(struct DynamicPool *pool, struct GraphNodeHeldObject *sp1c,
struct Object *objNode, Vec3s translation, struct Object *objNode, Vec3s translation,
GraphNodeFunc nodeFunc, s32 playerIndex); GraphNodeFunc nodeFunc, s32 playerIndex);