Remove GRAPH_NODE_TYPE_FUNCTIONAL define & restore functionality using an alternative method. (#557)

Fixes Mirror Mario and similar things.
This commit is contained in:
Arceveti authored and GitHub committed 2023-01-20 00:59:18 -05:00
1 parent 9bec16d2f0
commit 7551748a35
5 files changed
+40 -75

No files matched your search

+29 -22
View File
@@ -1262,6 +1262,34 @@ void geo_try_process_children(struct GraphNode *node) {
}
}
typedef void (*GeoProcessFunc)();
// See enum 'GraphNodeTypes' in 'graph_node.h'.
static GeoProcessFunc GeoProcessJumpTable[] = {
[GRAPH_NODE_TYPE_ORTHO_PROJECTION ] = geo_process_ortho_projection,
[GRAPH_NODE_TYPE_PERSPECTIVE ] = geo_process_perspective,
[GRAPH_NODE_TYPE_MASTER_LIST ] = geo_process_master_list,
[GRAPH_NODE_TYPE_LEVEL_OF_DETAIL ] = geo_process_level_of_detail,
[GRAPH_NODE_TYPE_SWITCH_CASE ] = geo_process_switch,
[GRAPH_NODE_TYPE_CAMERA ] = geo_process_camera,
[GRAPH_NODE_TYPE_TRANSLATION_ROTATION] = geo_process_translation_rotation,
[GRAPH_NODE_TYPE_TRANSLATION ] = geo_process_translation,
[GRAPH_NODE_TYPE_ROTATION ] = geo_process_rotation,
[GRAPH_NODE_TYPE_OBJECT ] = geo_process_object,
[GRAPH_NODE_TYPE_ANIMATED_PART ] = geo_process_animated_part,
[GRAPH_NODE_TYPE_BILLBOARD ] = geo_process_billboard,
[GRAPH_NODE_TYPE_DISPLAY_LIST ] = geo_process_display_list,
[GRAPH_NODE_TYPE_SCALE ] = geo_process_scale,
[GRAPH_NODE_TYPE_SHADOW ] = geo_process_shadow,
[GRAPH_NODE_TYPE_OBJECT_PARENT ] = geo_process_object_parent,
[GRAPH_NODE_TYPE_GENERATED_LIST ] = geo_process_generated_list,
[GRAPH_NODE_TYPE_BACKGROUND ] = geo_process_background,
[GRAPH_NODE_TYPE_HELD_OBJ ] = geo_process_held_object,
[GRAPH_NODE_TYPE_CULLING_RADIUS ] = geo_try_process_children,
[GRAPH_NODE_TYPE_ROOT ] = geo_try_process_children,
[GRAPH_NODE_TYPE_START ] = geo_try_process_children,
};
/**
* Process a generic geo node and its siblings.
* The first argument is the start node, and all its siblings will
@@ -1283,28 +1311,7 @@ void geo_process_node_and_siblings(struct GraphNode *firstNode) {
if (curGraphNode->flags & GRAPH_RENDER_CHILDREN_FIRST) {
geo_try_process_children(curGraphNode);
} else {
switch (curGraphNode->type) {
case GRAPH_NODE_TYPE_ORTHO_PROJECTION: geo_process_ortho_projection ((struct GraphNodeOrthoProjection *) curGraphNode); break;
case GRAPH_NODE_TYPE_PERSPECTIVE: geo_process_perspective ((struct GraphNodePerspective *) curGraphNode); break;
case GRAPH_NODE_TYPE_MASTER_LIST: geo_process_master_list ((struct GraphNodeMasterList *) curGraphNode); break;
case GRAPH_NODE_TYPE_LEVEL_OF_DETAIL: geo_process_level_of_detail ((struct GraphNodeLevelOfDetail *) curGraphNode); break;
case GRAPH_NODE_TYPE_SWITCH_CASE: geo_process_switch ((struct GraphNodeSwitchCase *) curGraphNode); break;
case GRAPH_NODE_TYPE_CAMERA: geo_process_camera ((struct GraphNodeCamera *) curGraphNode); break;
case GRAPH_NODE_TYPE_TRANSLATION_ROTATION: geo_process_translation_rotation((struct GraphNodeTranslationRotation *) curGraphNode); break;
case GRAPH_NODE_TYPE_TRANSLATION: geo_process_translation ((struct GraphNodeTranslation *) curGraphNode); break;
case GRAPH_NODE_TYPE_ROTATION: geo_process_rotation ((struct GraphNodeRotation *) curGraphNode); break;
case GRAPH_NODE_TYPE_OBJECT: geo_process_object ((struct Object *) curGraphNode); break;
case GRAPH_NODE_TYPE_ANIMATED_PART: geo_process_animated_part ((struct GraphNodeAnimatedPart *) curGraphNode); break;
case GRAPH_NODE_TYPE_BILLBOARD: geo_process_billboard ((struct GraphNodeBillboard *) curGraphNode); break;
case GRAPH_NODE_TYPE_DISPLAY_LIST: geo_process_display_list ((struct GraphNodeDisplayList *) curGraphNode); break;
case GRAPH_NODE_TYPE_SCALE: geo_process_scale ((struct GraphNodeScale *) curGraphNode); break;
case GRAPH_NODE_TYPE_SHADOW: geo_process_shadow ((struct GraphNodeShadow *) curGraphNode); break;
case GRAPH_NODE_TYPE_OBJECT_PARENT: geo_process_object_parent ((struct GraphNodeObjectParent *) curGraphNode); break;
case GRAPH_NODE_TYPE_GENERATED_LIST: geo_process_generated_list ((struct GraphNodeGenerated *) curGraphNode); break;
case GRAPH_NODE_TYPE_BACKGROUND: geo_process_background ((struct GraphNodeBackground *) curGraphNode); break;
case GRAPH_NODE_TYPE_HELD_OBJ: geo_process_held_object ((struct GraphNodeHeldObject *) curGraphNode); break;
default: geo_try_process_children ((struct GraphNode *) curGraphNode); break;
}
GeoProcessJumpTable[curGraphNode->type](curGraphNode);
}
} else {
if (curGraphNode->type == GRAPH_NODE_TYPE_OBJECT) {