remove unused code from goddard

This commit is contained in:
CrashOveride95 committed 2021-06-26 15:31:49 -04:00
1 parent 2e534b1ab2
commit 8181edd10f
10 files changed
-896

No files matched your search

-30
View File
@@ -320,26 +320,6 @@ void split_all_timers(void) {
}
}
/**
* Unused - records the start time for all timers
*/
void start_all_timers(void) {
s32 i;
struct GdTimer *timer;
if (!sTimingActive) {
return;
}
for (i = 0; i < ARRAY_COUNT(sTimers); i++) {
timer = get_timernum(i);
if (timer->name != NULL) {
timer->start = gd_get_ostime();
}
}
}
/**
* Records the current time before performing an operation
*/
@@ -432,15 +412,6 @@ f32 get_scaled_timer_total(const char *name) {
return timer->scaledTotal;
}
/**
* Unused - returns the raw total for the specified timer
*/
f32 get_timer_total(const char *name) {
struct GdTimer *timer = get_timer_checked(name);
return (f32) timer->total;
}
/*
* Miscellaneous debug functions
@@ -849,7 +820,6 @@ struct GdFile *gd_fopen(const char *filename, const char *mode) {
for (i = 0; i < sizeof(struct UnkBufThing); i++) {
*bufbytes++ = gGdStreamBuffer[filecsr++];
}
stub_renderer_13(&buf);
fileposptr = &gGdStreamBuffer[filecsr];
filecsr += buf.size;
-1
View File
@@ -586,7 +586,6 @@ void draw_label(struct ObjLabel *label) {
position.y += label->position.y;
position.z += label->position.z;
func_801A4438(position.x, position.y, position.z);
stub_renderer_10(label->unk30);
stub_draw_label_text(strbuf);
}
-36
View File
@@ -23,39 +23,3 @@ static s32 sUnrefScnHeight = 240;
// bss
struct GdControl gGdCtrl; // @ 801B9920; processed controller info
struct GdControl gGdCtrlPrev; // @ 801B9A18; previous frame's controller info
/**
* Unused main function possibly from when this was a standalone demo
*/
u32 __main__(void) {
UNUSED u32 pad1C;
gd_printf("%x, %x\n", (u32) (uintptr_t) &D_801A8058, (u32) (uintptr_t) &gGdMoveScene);
imin("main");
gd_init();
gGdCtrl.unk88 = 0.46799f;
gGdCtrl.unkA0 = -34.0f;
gGdCtrl.unkAC = 34.0f;
gGdCtrl.unk00 = 2;
gGdCtrl.newStartPress = FALSE;
gGdCtrl.prevFrame = &gGdCtrlPrev;
imin("main - make_scene");
make_scene(); // make_scene does nothing, though
imout();
gd_init_controllers();
print_all_memtrackers();
start_timer("dlgen");
stop_timer("dlgen");
mem_stats();
while (TRUE) {
func_801A520C();
}
imout();
return 0;
}
-12
View File
@@ -537,18 +537,6 @@ void func_8018FF28(struct ObjJoint *a0, struct ObjJoint *a1) {
}
}
/**
* Unused (not called) - possibly was used to print indent levels inside
* recursive functions
*/
void print_some_spaces(s32 size) {
s32 i;
for (i = 0; i < size - 1; i++) {
gd_printf(" ");
}
}
/* 23E7B8 -> 23E938 */
s32 func_8018FFE8(struct ObjBone **a0, struct ObjJoint **a1, struct ObjJoint *a2, struct ObjJoint *a3) {
struct ObjBone *b; // 1C
-295
View File
@@ -882,128 +882,12 @@ s32 group_contains_obj(struct ObjGroup *group, struct GdObj *obj) {
return FALSE;
}
/**
* Unused (not called) - this shows details about all objects in the main object linked list
*/
void show_details(enum ObjTypeFlag type) {
enum ObjTypeFlag curObjType;
struct ListNode *curGroupLink;
struct ObjGroup *curSubGroup;
struct GdObj *curObj;
char idStrBuf[0x24];
s32 curGroupTypes;
gd_printf("\nDetails about: ");
switch (type) {
case OBJ_TYPE_GROUPS:
gd_printf("Groups\n");
break;
case OBJ_TYPE_BONES:
gd_printf("Bones\n");
break;
case OBJ_TYPE_JOINTS:
gd_printf("Joints\n");
break;
case OBJ_TYPE_PARTICLES:
gd_printf("Particles\n");
break;
default:
gd_printf("Everything?\n");
break;
}
curObj = gGdObjectList;
while (curObj != NULL) {
curObjType = curObj->type;
if (curObjType == type) {
format_object_id(idStrBuf, curObj);
switch (curObjType) {
case OBJ_TYPE_GROUPS:
gd_printf("Group %s: ", idStrBuf);
curGroupTypes = ((struct ObjGroup *) curObj)->memberTypes;
if (curGroupTypes & OBJ_TYPE_GROUPS) {
gd_printf("groups ");
}
if (curGroupTypes & OBJ_TYPE_BONES) {
gd_printf("bones ");
}
if (curGroupTypes & OBJ_TYPE_JOINTS) {
gd_printf("joints ");
}
if (curGroupTypes & OBJ_TYPE_PARTICLES) {
gd_printf("particles ");
}
if (curGroupTypes & OBJ_TYPE_CAMERAS) {
gd_printf("cameras ");
}
if (curGroupTypes & OBJ_TYPE_NETS) {
gd_printf("nets ");
}
if (curGroupTypes & OBJ_TYPE_GADGETS) {
gd_printf("gadgets ");
}
if (curGroupTypes & OBJ_TYPE_LABELS) {
gd_printf("labels ");
}
if (curGroupTypes & OBJ_TYPE_FACES) {
gd_printf("face ");
}
if (curGroupTypes & OBJ_TYPE_VERTICES) {
gd_printf("vertex ");
}
curGroupLink = ((struct ObjGroup *) curObj)->firstMember;
while (curGroupLink != NULL) {
format_object_id(idStrBuf, curGroupLink->obj);
gd_printf("%s", idStrBuf);
curGroupLink = curGroupLink->next;
}
gd_printf("\n");
break;
case OBJ_TYPE_BONES:
gd_printf("Bone %s: ", idStrBuf);
curSubGroup = ((struct ObjBone *) curObj)->unk10C;
curGroupLink = curSubGroup->firstMember;
while (curGroupLink != NULL) {
format_object_id(idStrBuf, curGroupLink->obj);
gd_printf("%s", idStrBuf);
curGroupLink = curGroupLink->next;
}
gd_printf("\n");
break;
case OBJ_TYPE_JOINTS:
gd_printf("Joint %s: ", idStrBuf);
curSubGroup = ((struct ObjJoint *) curObj)->unk1C4;
curGroupLink = curSubGroup->firstMember;
while (curGroupLink != NULL) {
format_object_id(idStrBuf, curGroupLink->obj);
gd_printf("%s", idStrBuf);
curGroupLink = curGroupLink->next;
}
gd_printf("\n");
break;
default:;
}
}
curObj = curObj->next;
}
}
/* @ 22C9B8 for 0x24 */
s32 stub_objects_2(void) {
s32 sp4 = 0;
return sp4;
}
/**
* Unused - called by __main__
*/
s32 make_scene(void) {
s32 sp4 = 0;
return sp4;
}
/* @ 22CA00 for 0x88 */
static void reset_joint_or_net(struct GdObj *obj) {
struct GdObj *localObjPtr = obj;
@@ -1027,39 +911,6 @@ void menu_cb_reset_positions(void) {
apply_to_obj_types_in_group(OBJ_TYPE_NETS, (applyproc_t) reset_joint_or_net, sCurrentMoveGrp);
}
/**
* Unused (not called) - does nothing useful
*/
struct GdObj *func_8017E2F0(struct GdObj *obj, enum ObjTypeFlag type) {
UNUSED u32 sp2C;
enum ObjTypeFlag curObjType;
struct ListNode *node;
curObjType = obj->type;
switch (curObjType) {
case OBJ_TYPE_GROUPS:
node = ((struct ObjGroup *) obj)->firstMember;
while (node != NULL) {
func_8017E2F0(node->obj, type);
node = node->next;
}
break;
case OBJ_TYPE_BONES:
break;
default:;
}
if (curObjType == type) {
return obj;
}
//! @bug Nothing is returned if a GdObj of `type` is not found
#ifdef AVOID_UB
return NULL;
#endif
}
/**
* Recursively calls `func` on all members of `group` whose type is in the
* `types` bitmask.
@@ -1224,152 +1075,6 @@ void func_8017E9EC(struct ObjNet *net) {
gd_mult_mat4f(&D_801B9DC8, &sp1C, &D_801B9DC8);
}
/**
* Unused (not called)
*/
s32 func_8017EA94(struct GdVec3f *vec, Mat4f matrix) {
if (vec->x >= matrix[2][2] && vec->x <= matrix[3][1] && vec->z >= matrix[3][0]
&& vec->z <= matrix[3][3]) {
return 1;
}
return 0;
}
/**
* Unused (not called)
*/
s32 func_8017EB24(struct GdObj *obj1, struct GdObj *obj2) {
struct GdVec3f pos1;
struct GdVec3f pos2;
struct GdBoundingBox *bbox1;
struct GdBoundingBox *bbox2;
struct GdBoundingBox sp18;
set_cur_dynobj(obj1);
d_get_world_pos(&pos1);
bbox1 = d_get_bounding_box();
set_cur_dynobj(obj2);
d_get_world_pos(&pos2);
bbox2 = d_get_bounding_box();
// bbox2 is an offset for bbox1?
sp18.minX = bbox1->minX + bbox2->minX;
sp18.minY = bbox1->minY + bbox2->minY;
sp18.minZ = bbox1->minZ + bbox2->minZ;
sp18.maxX = bbox1->maxX + bbox2->maxX;
sp18.maxY = bbox1->maxY + bbox2->maxY;
sp18.maxZ = bbox1->maxZ + bbox2->maxZ;
D_801B9E08.x = pos2.x - pos1.x;
D_801B9E08.y = pos2.y - pos1.y;
D_801B9E08.z = pos2.z - pos1.z;
if (D_801B9E08.x >= sp18.minX) {
if (D_801B9E08.x <= sp18.maxX) {
if (D_801B9E08.z >= sp18.minZ) {
if (D_801B9E08.z <= sp18.maxZ) {
return TRUE;
}
}
}
}
return FALSE;
}
/**
* Unused (not called)
*/
s32 is_obj_xz_in_bounding_box(struct GdObj *obj, struct GdBoundingBox *bbox) {
struct GdVec3f pos;
set_cur_dynobj(obj);
d_get_world_pos(&pos);
if (pos.x >= bbox->minX) {
if (pos.x <= bbox->maxX) {
if (pos.z >= bbox->minZ) {
if (pos.z <= bbox->maxZ) {
return TRUE;
}
}
}
}
return FALSE;
}
/**
* Unused (not called)
*/
s32 is_point_xz_in_bounding_box(struct GdVec3f *point, struct GdBoundingBox *bbox) {
if (point->x >= bbox->minX) {
if (point->x <= bbox->maxX) {
if (point->z >= bbox->minZ) {
if (point->z <= bbox->maxZ) {
return TRUE;
}
}
}
}
return FALSE;
}
/**
* Unused (called by func_801A71CC) - returns TRUE if any of the four corners of
* box1's X-Z plane lie within box2's X-Z plane
*/
s32 gd_plane_point_within(struct GdBoundingBox *box1, struct GdBoundingBox *box2) {
// test if min x and min z of box1 are within box2
if (box1->minX >= box2->minX) {
if (box1->minX <= box2->maxX) {
if (box1->minZ >= box2->minZ) {
if (box1->minZ <= box2->maxZ) {
return TRUE;
}
}
}
}
// test if max x and min z of box1 are within box2
if (box1->maxX >= box2->minX) {
if (box1->maxX <= box2->maxX) {
if (box1->minZ >= box2->minZ) {
if (box1->minZ <= box2->maxZ) {
return TRUE;
}
}
}
}
// test if max x and max z of box1 are within box2
if (box1->maxX >= box2->minX) {
if (box1->maxX <= box2->maxX) {
if (box1->maxZ >= box2->minZ) {
if (box1->maxZ <= box2->maxZ) {
return TRUE;
}
}
}
}
// test if min x and max z of box1 are within box2
if (box1->minX >= box2->minX) {
if (box1->minX <= box2->maxX) {
if (box1->maxZ >= box2->minZ) {
if (box1->maxZ <= box2->maxZ) {
return TRUE;
}
}
}
}
return FALSE;
}
/* @ 22D824 for 0x1BC */
s32 transform_child_objects_recursive(struct GdObj *obj, struct GdObj *parentObj) {
struct ListNode *curLink;
-55
View File
@@ -58,61 +58,6 @@ void Unknown8018B7A8(void *a0) {
d_set_world_pos(sp1C.x, sp1C.y, sp1C.z);
}
/**
* Unused - called when an item is selected from the "Default Settings" menu.
*
* @param itemId ID of the menu item that was clicked
*/
static void menu_cb_default_settings(intptr_t itemId) {
struct ObjGroup *group = (struct ObjGroup *)itemId; // Unpack pointer from menu item ID
apply_to_obj_types_in_group(OBJ_TYPE_GADGETS, (applyproc_t) reset_gadget_default, group);
apply_to_obj_types_in_group(OBJ_TYPE_VIEWS, (applyproc_t) stub_renderer_6, gGdViewsGroup);
}
/**
* Unused - appends a menu item for the group to sDefSettingsMenuStr.
*/
static void add_item_to_default_settings_menu(struct ObjGroup *group) {
char buf[0x100];
if (group->debugPrint == 1) {
// Convert pointer to integer and store it as the menu item ID.
sprintf(buf, "| %s %%x%d", group->name, (u32) (intptr_t) group);
gd_strcat(sDefSettingsMenuStr, buf);
}
}
/**
* Unused - creates a popup menu that allows the user to control some settings.
*/
long create_gui_menu(struct ObjGroup *grp) {
long dynamicsMenuId;
long defaultSettingMenuId;
long contTypeMenuId;
gd_strcpy(sDefSettingsMenuStr, "Default Settings %t %F");
apply_to_obj_types_in_group(OBJ_TYPE_GROUPS, (applyproc_t) add_item_to_default_settings_menu, grp);
defaultSettingMenuId = defpup(sDefSettingsMenuStr, &menu_cb_default_settings);
contTypeMenuId = defpup(
"Control Type %t %F"
"| U-64 Analogue Joystick %x1 "
"| Keyboard %x2 "
"| Mouse %x3",
&menu_cb_control_type);
dynamicsMenuId = defpup(
"Dynamics %t "
"|\t\t\tReset Positions %f "
"|\t\t\tSet Defaults %m "
"|\t\t\tSet Controller %m "
"|\t\t\tRe-Calibrate Controller %f "
"|\t\t\tQuit %f",
&menu_cb_reset_positions, defaultSettingMenuId, contTypeMenuId, &menu_cb_recalibrate_controller, &gd_exit);
return dynamicsMenuId;
}
/* 23A190 -> 23A250 */
struct ObjLabel *make_label(struct ObjValPtr *ptr, char *str, s32 a2, f32 x, f32 y, f32 z) {
struct ObjLabel *label = (struct ObjLabel *) make_object(OBJ_TYPE_LABELS);
-24
View File
@@ -494,30 +494,6 @@ void Unknown801835C8(struct ObjParticle *ptc) {
gd_printf("\n");
}
/**
* Unused
*/
void stub_particles_1(UNUSED s32 a) {
}
/**
* Unused
*/
void stub_particles_2(UNUSED s32 a) {
}
/**
* Unused
*/
void stub_particles_3(UNUSED s32 a, UNUSED s32 b, UNUSED s32 c) {
}
/**
* Unused
*/
void stub_particles_4(UNUSED s32 a, UNUSED s32 b, UNUSED s32 c) {
}
/* 2320A0 -> 2320D4; pad to 2320E0 */
void func_801838D0(struct ObjParticle *ptc) {
D_801B9E3C = ptc;
-420
View File
@@ -862,13 +862,6 @@ f64 gd_sqrt_d(f64 x) {
return sqrtf(x);
}
/**
* Unused
*/
f64 stub_renderer_1(UNUSED f64 x) {
return 0.0;
}
#if defined(ISVPRINT) || defined(UNF)
#define stubbed_printf osSyncPrintf
@@ -1065,13 +1058,6 @@ void branch_cur_dl_to_num(s32 dlNum) {
gSPDisplayList(next_gfx(), GD_VIRTUAL_TO_PHYSICAL(dl));
}
/**
* Unused (not called)
*/
Gfx *get_dl_gfx(s32 num) {
return sGdDLArray[num]->gfx;
}
/**
* Creates `ObjShape`s for the stars and sparkles
*/
@@ -1195,10 +1181,6 @@ void gdm_setup(void) {
imout();
}
/* 24AC18 -> 24AC2C */
void stub_renderer_2(UNUSED u32 a0) {
}
/* 24AC2C -> 24AC80; not called; orig name: Unknown8019C45C */
void print_gdm_stats(void) {
stop_memtracker("total");
@@ -2010,24 +1992,6 @@ void gd_dl_flush_vertices(void) {
func_801A0038();
}
/**
* Unused - called by func_801A520C
*/
static void func_801A01EC(void) {
if (D_801BE8B0.validCount >= D_801BE8B0.msgCount) {
osRecvMesg(&D_801BE8B0, &sGdDMACompleteMsg, OS_MESG_BLOCK);
}
osRecvMesg(&D_801BE8B0, &sGdDMACompleteMsg, OS_MESG_BLOCK);
}
/**
* Unused - called by func_801A520C
*/
static void func_801A025C(void) {
gGdFrameBufNum ^= 1;
osViSwapBuffer(sScreenView->parent->colourBufs[gGdFrameBufNum]);
}
/* 24EA88 -> 24EAF4 */
void set_render_alpha(f32 alpha) {
sAlpha = alpha * 255.0f;
@@ -2330,11 +2294,6 @@ void gd_set_one_cycle(void) {
update_render_mode();
}
/* 250B30 -> 250B44 */
void stub_renderer_3(void) {
UNUSED u32 pad[4];
}
/* 250B44 -> 250B58 */
void gddl_is_loading_stub_dl(UNUSED s32 dlLoad) {
}
@@ -2521,24 +2480,6 @@ void parse_p1_controller(void) {
}
}
void stub_renderer_4(f32 arg0) {
return;
// dead code
if (D_801BD768.x * D_801A86CC.x + arg0 * 2.0f > 160.0)
{
func_801A3370(D_801BD758.x - D_801BD768.x, -20.0f, 0.0f);
D_801BD768.x = D_801BD758.x;
}
}
/**
* Unused
*/
void Unknown801A32F4(s32 arg0) {
D_801BD774 = GD_LOWER_24(arg0) + D_801BAF28;
}
/* 251AF4 -> 251B40 */
void func_801A3324(f32 x, f32 y, f32 z) {
D_801BD768.x = x;
@@ -2557,27 +2498,6 @@ void func_801A3370(f32 x, f32 y, f32 z) {
D_801BD768.z += z;
}
/**
* Unused
*/
void Unknown801A33F8(f32 x, f32 y, f32 z) {
gd_dl_mul_trans_matrix(x - D_801BD768.x, y - D_801BD768.y, z - D_801BD768.z);
D_801BD768.x = x;
D_801BD768.y = y;
D_801BD768.z = z;
}
/**
* Unused
*/
void Unknown801A347C(f32 x, f32 y, f32 z) {
D_801A86CC.x = x;
D_801A86CC.y = y;
D_801A86CC.z = z;
gd_dl_scale(x, y, z);
}
/* 251CB0 -> 251D44; orig name: func_801A34E0 */
void border_active_view(void) {
if (sActiveView->flags & VIEW_BORDERED) {
@@ -2696,10 +2616,6 @@ void gd_setproperty(enum GdProperty prop, f32 f1, f32 f2, f32 f3) {
}
}
/* 2522B0 -> 2522C0 */
void stub_renderer_5(void) {
}
/* 2522C0 -> 25245C */
void gd_create_ortho_matrix(f32 l, f32 r, f32 b, f32 t, f32 n, f32 f) {
uintptr_t orthoMtx;
@@ -2828,41 +2744,6 @@ void gd_init_controllers(void) {
}
}
/* 252BAC -> 252BC0 */
void stub_renderer_6(UNUSED struct GdObj *obj) {
}
/**
* Unused - This is likely a stub version of the `defpup` function from the IRIX
* Graphics Library. It was used to define a popup menu. See the IRIX "Graphics
* Library Reference Manual, C Edition" for details.
*
* @param menufmt a format string defining the menu items to be added to the
* popup menu.
* @return an identifier of the menu just defined
*/
long defpup(UNUSED const char *menufmt, ...) {
//! @bug no return; function was stubbed
}
/**
* Unused - called when the user picks an item from the "Control Type" menu.
* Presumably, this would allow switching inputs between controller, keyboard,
* and mouse.
*
* @param itemId ID of the menu item that was clicked
* (1 = "U-64 Analogue Joystick", 2 = "Keyboard", 3 = "Mouse")
*/
void menu_cb_control_type(UNUSED u32 itemId) {
}
/**
* Unused - called when the user clicks the "Re-Calibrate Controller" item from
* the "Dynamics" menu.
*/
void menu_cb_recalibrate_controller(UNUSED u32 itemId) {
}
/* 252C08 -> 252C70 */
void func_801A4438(f32 x, f32 y, f32 z) {
sTextDrawPos.x = x - (sActiveView->lowerRight.x / 2.0f);
@@ -2908,43 +2789,6 @@ s32 gd_gentexture(void *texture, s32 fmt, s32 size, UNUSED u32 arg3, UNUSED u32
return dl;
}
/**
* Unused (not called)
*/
void *load_texture_from_file(const char *file, s32 fmt, s32 size, u32 arg3, u32 arg4) {
struct GdFile *txFile; // 3c
void *texture; // 38
u32 txSize; // 34
u32 i; // 30
u16 *txHalf; // 2C
u8 buf[3]; // 28
u8 alpha; // 27
s32 dl; // 20
txFile = gd_fopen(file, "r");
if (txFile == NULL) {
fatal_print("Cant load texture");
}
txSize = gd_get_file_size(txFile);
texture = gd_malloc_perm(txSize / 3 * 2);
if (texture == NULL) {
fatal_printf("Cant allocate memory for texture");
}
txHalf = (u16 *) texture;
for (i = 0; i < txSize / 3; i++) {
gd_fread((s8 *) buf, 3, 1, txFile);
alpha = 0xFF;
*txHalf = ((buf[2] >> 3) << 11) | ((buf[1] >> 3) << 6) | ((buf[0] >> 3) << 1) | (alpha >> 7);
txHalf++;
}
gd_printf("Loaded texture '%s' (%d bytes)\n", file, txSize);
gd_fclose(txFile);
dl = gd_gentexture(texture, fmt, size, arg3, arg4);
gd_printf("Generated '%s' (%d) display list ok.\n", file, dl);
return texture;
}
/* 252F88 -> 252FAC */
void Unknown801A47B8(struct ObjView *v) {
if (v->flags & VIEW_SAVE_TO_GLOBAL) {
@@ -2952,24 +2796,6 @@ void Unknown801A47B8(struct ObjView *v) {
}
}
void stub_renderer_7(void) {
}
/* 252FC4 -> 252FD8 */
void stub_renderer_8(UNUSED u32 arg0) {
}
/**
* Unused - called by func_801A520C and Unknown801A5344
*/
void func_801A4808(void) {
while (D_801A8674 != 0) {
;
}
return;
}
/* 253018 -> 253084 */
void func_801A4848(s32 linkDl) {
struct GdDisplayList *curDl;
@@ -2980,16 +2806,6 @@ void func_801A4848(s32 linkDl) {
sCurrentGdDl = curDl;
}
/**
* Unused - called by func_801A520C and Unknown801A5344
*/
void stub_renderer_9(void) {
}
/* 253094 -> 2530A8 */
void stub_renderer_10(UNUSED u32 arg0) {
}
/* 2530A8 -> 2530C0 */
void stub_draw_label_text(UNUSED char *s) {
UNUSED u32 pad2;
@@ -3002,35 +2818,6 @@ void set_active_view(struct ObjView *v) {
sActiveView = v;
}
void stub_renderer_11(void) {
}
/**
* Unused - called by func_801A520C
*/
void func_801A4918(void) {
f32 x; // c
f32 y; // 8
u32 ydiff; // 4
if (sHandView == NULL || sMenuView == NULL) {
return;
}
x = sHandView->upperLeft.x;
y = sHandView->upperLeft.y;
if (!(x > sMenuView->upperLeft.x && x < sMenuView->upperLeft.x + sMenuView->lowerRight.x
&& y > sMenuView->upperLeft.y && y < sMenuView->upperLeft.y + sMenuView->lowerRight.y)) {
return;
}
ydiff = (y - sMenuView->upperLeft.y) / 25.0f;
if (ydiff < sItemsInMenu) {
sMenuGadgets[ydiff]->drawFlags |= OBJ_HIGHLIGHTED;
}
}
/* 2532D4 -> 2533DC */
void Unknown801A4B04(void) {
if (D_801A86AC != NULL) {
@@ -3151,57 +2938,6 @@ void update_view_and_dl(struct ObjView *view) {
}
}
/**
* Unused - called by __main__
*/
void func_801A520C(void) {
UNUSED u32 pad[2];
start_timer("1frame");
start_timer("cpu");
stub_renderer_9();
reset_cur_dl_indices();
parse_p1_controller();
setup_timers();
start_timer("dlgen");
apply_to_obj_types_in_group(OBJ_TYPE_VIEWS, (applyproc_t) update_view_and_dl, gGdViewsGroup);
stop_timer("dlgen");
restart_timer("netupd");
if (!gGdCtrl.newStartPress) {
apply_to_obj_types_in_group(OBJ_TYPE_VIEWS, (applyproc_t) Proc801A5110, gGdViewsGroup);
}
split_timer("netupd");
split_timer("cpu");
func_801A4808();
restart_timer("cpu");
func_801A025C();
update_cursor();
func_801A4918();
stop_timer("1frame");
sTracked1FrameTime = get_scaled_timer_total("1frame");
split_timer("cpu");
func_801A01EC();
}
/**
* Unused
*/
void Unknown801A5344(void) {
if ((sActiveView = sScreenView) == NULL) {
return;
}
reset_cur_dl_indices();
sScreenView->gdDlNum = gd_startdisplist(8);
start_view_dl(sScreenView);
gd_set_one_cycle();
gd_enddlsplist_parent();
func_801A4848(sScreenView->gdDlNum);
stub_renderer_9();
func_801A4808();
sScreenView->gdDlNum = 0;
}
/* 253BC8 -> 2540E0 */
void gd_init(void) {
s32 i; // 34
@@ -3292,34 +3028,6 @@ void gd_init(void) {
imout();
}
/**
* Unused - reverses the characters in `str`.
*/
void reverse_string(char *str, s32 len) {
char buf[100];
s32 i;
for (i = 0; i < len; i++) {
buf[i] = str[len - i - 1];
}
for (i = 0; i < len; i++) {
str[i] = buf[i];
}
}
/* 254168 -> 25417C */
void stub_renderer_12(UNUSED s8 *arg0) {
}
/* 25417C -> 254190 */
void stub_renderer_13(UNUSED void *arg0) {
}
/* 254190 -> 2541A4 */
void stub_renderer_14(UNUSED s8 *arg0) {
}
/**
* Initializes the pick buffer. This functions like the `pick` or `gselect`
* functions from IRIS GL.
@@ -3350,18 +3058,6 @@ s32 get_cur_pickbuf_offset(UNUSED s16 *arg0) {
return sPickBufPosition / 3;
}
/* 254250 -> 254264 */
void stub_renderer_15(UNUSED u32 arg0) {
}
/* 254264 -> 254278 */
void stub_renderer_16(UNUSED u32 arg0) {
}
/* 254278 -> 254288 */
void stub_renderer_17(void) {
}
/* 254288 -> 2542B0 */
void *Unknown801A5AB8(s32 texnum) {
return sLoadedTextures[texnum];
@@ -3722,14 +3418,6 @@ void make_timer_gadgets(void) {
return;
}
/* 255600 -> 255614 */
void stub_renderer_18(UNUSED u32 a0) {
}
/* 255614 -> 255628 */
void stub_renderer_19(UNUSED u32 a0) {
}
#ifndef NO_SEGMENTED_MEMORY
/**
* Copies `size` bytes of data from ROM address `romAddr` to RAM address `vAddr`.
@@ -3829,111 +3517,3 @@ struct GdObj *load_dynlist(struct DynList *dynlist) {
return proc_dynlist(dynlist);
}
#endif
/**
* Unused (not called)
*/
void stub_renderer_20(UNUSED u32 a0) {
}
/**
* Unused (not called)
*/
void func_801A71CC(struct ObjNet *net) {
s32 i; // spB4
s32 j; // spB0
f32 spAC;
f32 spA8;
struct GdBoundingBox bbox;
UNUSED u32 pad8C;
struct ObjZone *sp88;
register struct ListNode *link; // s0 (84)
s32 sp80; // linked planes contained in zone?
s32 sp7C; // linked planes in net count?
register struct ListNode *link1; // s1 (78)
register struct ListNode *link2; // s2 (74)
register struct ListNode *link3; // s3 (70)
struct GdVec3f sp64;
UNUSED u32 pad60;
struct ObjPlane *plane; // 5c
UNUSED u32 pad58;
struct ObjZone *linkedZone; // 54
UNUSED u32 pad50;
struct ObjPlane *planeL2; // 4c
UNUSED u32 pad48;
struct ObjPlane *planeL3; // 44
if (net->unk21C == NULL) {
net->unk21C = make_group(0);
}
gd_print_bounding_box("making zones for net=", &net->boundingBox);
sp64.x = (ABS(net->boundingBox.minX) + ABS(net->boundingBox.maxX)) / 16.0f;
sp64.z = (ABS(net->boundingBox.minZ) + ABS(net->boundingBox.maxZ)) / 16.0f;
spA8 = net->boundingBox.minZ + sp64.z / 2.0f;
for (i = 0; i < 16; i++) {
spAC = net->boundingBox.minX + sp64.x / 2.0f;
for (j = 0; j < 16; j++) {
bbox.minX = spAC - (sp64.x / 2.0f);
bbox.minY = 0.0f;
bbox.minZ = spA8 - (sp64.z / 2.0f);
bbox.maxX = spAC + (sp64.x / 2.0f);
bbox.maxY = 0.0f;
bbox.maxZ = spA8 + (sp64.z / 2.0f);
sp88 = make_zone(NULL, &bbox, NULL);
addto_group(net->unk21C, &sp88->header);
sp88->unk2C = make_group(0);
spAC += sp64.x;
}
spA8 += sp64.z;
}
for (link = net->unk1CC->firstMember; link != NULL; link = link->next) {
plane = (struct ObjPlane *) link->obj;
plane->unk18 = FALSE;
}
i = 0; // acts as Zone N here... kinda
for (link1 = net->unk21C->firstMember; link1 != NULL; link1 = link1->next) {
linkedZone = (struct ObjZone *) link1->obj;
sp88 = linkedZone;
sp7C = 0;
sp80 = 0;
for (link2 = net->unk1CC->firstMember; link2 != NULL; link2 = link2->next) {
planeL2 = (struct ObjPlane *) link2->obj;
sp7C += 1;
if (gd_plane_point_within(&planeL2->boundingBox, &sp88->boundingBox)) {
planeL2->unk18 = TRUE;
addto_group(sp88->unk2C, &planeL2->header);
sp80 += 1;
}
}
if (sp80 == 0) {
stub_objects_1(net->unk21C, &linkedZone->header); // stubbed fatal function?
} else {
gd_printf("%d/%d planes in zone %d\n", sp80, sp7C, i++);
}
}
for (link3 = net->unk1CC->firstMember; link3 != NULL; link3 = link3->next) {
planeL3 = (struct ObjPlane *) link3->obj;
if (!planeL3->unk18) {
gd_print_bounding_box("plane=", &planeL3->boundingBox);
fatal_printf("plane not in any zones\n");
}
}
}
/* 255EB0 -> 255EC0 */
void stub_renderer_21(void) {
}
-5
View File
@@ -109,19 +109,14 @@ void gd_create_perspective_matrix(f32 fovy, f32 aspect, f32 near, f32 far);
s32 setup_view_buffers(const char *name, struct ObjView *view, UNUSED s32 ulx, UNUSED s32 uly,
UNUSED s32 lrx, UNUSED s32 lry);
void gd_init_controllers(void);
void stub_renderer_6(struct GdObj *obj); //apply to OBJ_TYPE_VIEWS
long defpup(UNUSED const char *menufmt, ...);
void menu_cb_control_type(u32);
void menu_cb_recalibrate_controller(u32);
void func_801A4438(f32 x, f32 y, f32 z);
void stub_renderer_10(u32 arg0);
void stub_draw_label_text(UNUSED char *s);
void set_active_view(struct ObjView *v);
void func_801A520C(void);
void gd_init(void);
void stub_renderer_12(s8 *arg0); /* convert LE bytes to BE word? */
void stub_renderer_13(UNUSED void *arg0);
void stub_renderer_14(UNUSED s8 *arg0); /* convert LE bytes to BE f32? */
void init_pick_buf(s16 *buf, s32 len);
void store_in_pickbuf(s16 data);
s32 get_cur_pickbuf_offset(UNUSED s16 *arg0);
-18
View File
@@ -934,14 +934,9 @@ void read_ARK_shape(struct ObjShape *shape, char *fileName) {
}
gd_fread(fileInfo.bytes, 0x48, 1, sGdShapeFile);
stub_renderer_12(&fileInfo.bytes[0x40]); // face count?
stub_renderer_12(&fileInfo.bytes[0x44]);
while (fileInfo.data.word40-- > 0) {
gd_fread(faceInfo.bytes, 0x10, 1, sGdShapeFile);
stub_renderer_14(&faceInfo.bytes[0x0]);
stub_renderer_14(&faceInfo.bytes[0x4]);
stub_renderer_14(&faceInfo.bytes[0x8]);
sp48.x = faceInfo.data.v[0];
sp48.y = faceInfo.data.v[1];
@@ -949,14 +944,9 @@ void read_ARK_shape(struct ObjShape *shape, char *fileName) {
sp34 = find_or_add_new_mtl(shape->mtlGroup, 0, sp48.x, sp48.y, sp48.z);
stub_renderer_12(&faceInfo.bytes[0xC]);
while (faceInfo.data.faceCount-- > 0) {
shape->faceCount++;
gd_fread(face.bytes, 0x10, 1, sGdShapeFile);
stub_renderer_14(&face.bytes[0x4]); // read word as f32?
stub_renderer_14(&face.bytes[0x8]);
stub_renderer_14(&face.bytes[0xC]);
sp44 = make_face_with_material(sp34);
@@ -964,8 +954,6 @@ void read_ARK_shape(struct ObjShape *shape, char *fileName) {
sp40 = sp44;
}
stub_renderer_12(&face.bytes[0x0]);
if (face.data.vtxCount > 3) {
while (face.data.vtxCount-- > 0) {
gd_fread(vtx.bytes, 0x18, 1, sGdShapeFile);
@@ -976,12 +964,6 @@ void read_ARK_shape(struct ObjShape *shape, char *fileName) {
while (face.data.vtxCount-- > 0) {
shape->vtxCount++;
gd_fread(vtx.bytes, 0x18, 1, sGdShapeFile);
stub_renderer_14(&vtx.bytes[0x00]);
stub_renderer_14(&vtx.bytes[0x04]);
stub_renderer_14(&vtx.bytes[0x08]);
stub_renderer_14(&vtx.bytes[0x0C]);
stub_renderer_14(&vtx.bytes[0x10]);
stub_renderer_14(&vtx.bytes[0x14]);
func_801980E8(vtx.data.v);
sp3C = gd_make_vertex(vtx.data.v[0], vtx.data.v[1], vtx.data.v[2]);