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) {
struct GraphNodeBackground *graphNode;
s16 backgroundIdOrColor = cur_geo_cmd_s16(0x02);
graphNode = init_graph_node_background(
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
0);
@ -783,7 +783,7 @@ void geo_layout_cmd_node_background_ext(void) {
gGraphNodePool, NULL,
BACKGROUND_CUSTOM, // background ID, or RGBA5551 color if asm function is null
(GraphNodeFunc) cur_geo_cmd_ptr(0x08), // asm function
0);
1);
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 *graphNode,
u16 background, GraphNodeFunc backgroundFunc,
s32 zero) {
u8 extended) {
if (pool != NULL) {
graphNode = dynamic_pool_alloc(pool, sizeof(struct GraphNodeBackground));
}
@ -490,14 +490,18 @@ struct GraphNodeBackground *init_graph_node_background(struct DynamicPool *pool,
if (graphNode != NULL) {
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");
background = BACKGROUND_OCEAN_SKY;
background = BACKGROUND_HAUNTED;
}
graphNode->background = (background << 16) | background;
graphNode->fnNode.func = backgroundFunc;
graphNode->unused = zero; // always 0, unused
graphNode->unused = 0; // always 0, unused
if (backgroundFunc != NULL) {
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,
GraphNodeFunc gfxFunc, s32 parameter);
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 Object *objNode, Vec3s translation,
GraphNodeFunc nodeFunc, s32 playerIndex);