diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 4135c06a7..4be2d89f0 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -4239,8 +4239,8 @@ bool aiTryEquipWeapon(void) if (g_Vars.chrdata->bodynum != BODY_CASSANDRA || mainGetStageNum() != STAGE_MBR) #endif { - flags &= ~0x10000000; - flags |= 0x20000000; + flags &= ~OBJFLAG_WEAPON_10000000; + flags |= OBJFLAG_20000000; } prop = chrGiveWeapon(g_Vars.chrdata, model, cmd[4], flags); @@ -4605,7 +4605,7 @@ bool aiDuplicateChr(void) if (srcweapon1prop) { srcweapon1 = srcweapon1prop->weapon; - cloneweapon1prop = chrGiveWeapon(clone, srcweapon1->base.modelnum, srcweapon1->weaponnum, 0x10000000); + cloneweapon1prop = chrGiveWeapon(clone, srcweapon1->base.modelnum, srcweapon1->weaponnum, OBJFLAG_WEAPON_10000000); if (cloneweapon1prop) { cloneweapon1 = cloneweapon1prop->weapon; @@ -12159,7 +12159,7 @@ bool aiChrSetCutsceneWeapon(void) } } else { if (chr->weapons_held[0] == NULL && chr->weapons_held[1] == NULL && fallback_model_id >= 0) { - func0f08b8e8(chr, fallback_model_id, cmd[4], 0, 0, 0); + weaponCreateForChr(chr, fallback_model_id, cmd[4], 0, 0, 0); } } } else { @@ -12167,11 +12167,11 @@ bool aiChrSetCutsceneWeapon(void) chrSetObjHiddenFlag4OnWeapon(chr, 0); if (model_id >= 0) { - func0f08b8e8(chr, model_id, cmd[3], 0, 0, 0); + weaponCreateForChr(chr, model_id, cmd[3], 0, 0, 0); } if (fallback_model_id >= 0) { - func0f08b8e8(chr, fallback_model_id, cmd[4], 0x10000000, 0, 0); + weaponCreateForChr(chr, fallback_model_id, cmd[4], 0x10000000, 0, 0); } } } diff --git a/src/game/game_00b820.c b/src/game/game_00b820.c index c89f2fa98..dadbb80e2 100644 --- a/src/game/game_00b820.c +++ b/src/game/game_00b820.c @@ -522,7 +522,7 @@ glabel debugLoadAllAilistModels /* f00c120: 92080003 */ lbu $t0,0x3($s0) /* f00c124: 0018ca00 */ sll $t9,$t8,0x8 /* f00c128: 03281025 */ or $v0,$t9,$t0 -/* f00c12c: 0fc2486d */ jal propLoad +/* f00c12c: 0fc2486d */ jal modelLoad /* f00c130: 3044ffff */ andi $a0,$v0,0xffff /* f00c134: 5040002a */ beqzl $v0,.L0f00c1e0 /* f00c138: 02002025 */ or $a0,$s0,$zero @@ -556,7 +556,7 @@ glabel debugLoadAllAilistModels .L0f00c1a0: /* f00c1a0: 920c0003 */ lbu $t4,0x3($s0) /* f00c1a4: 000a5a00 */ sll $t3,$t2,0x8 -/* f00c1a8: 0fc2486d */ jal propLoad +/* f00c1a8: 0fc2486d */ jal modelLoad /* f00c1ac: 016c2025 */ or $a0,$t3,$t4 /* f00c1b0: 0fc04558 */ jal weaponLoadProjectileModels /* f00c1b4: 92040004 */ lbu $a0,0x4($s0) @@ -568,7 +568,7 @@ glabel debugLoadAllAilistModels .L0f00c1cc: /* f00c1cc: 920f0003 */ lbu $t7,0x3($s0) /* f00c1d0: 000d7200 */ sll $t6,$t5,0x8 -/* f00c1d4: 0fc2486d */ jal propLoad +/* f00c1d4: 0fc2486d */ jal modelLoad /* f00c1d8: 01cf2025 */ or $a0,$t6,$t7 /* f00c1dc: 02002025 */ or $a0,$s0,$zero .L0f00c1e0: @@ -617,7 +617,7 @@ glabel debugLoadAllAilistModels // case AICMD_DROPITEM: // 120 // id = cmd[3] | (cmd[2] << 8); // -// if (propLoad(id & 0xffff)) { +// if (modelLoad(id & 0xffff)) { // // empty // } // break; @@ -638,7 +638,7 @@ glabel debugLoadAllAilistModels // } // break; // case AICMD_EQUIPWEAPON: // 19c -// if (propLoad(cmd[3] | (cmd[2] << 8))) { +// if (modelLoad(cmd[3] | (cmd[2] << 8))) { // // empty // } // if (weaponLoadProjectileModels(cmd[4])) { @@ -646,7 +646,7 @@ glabel debugLoadAllAilistModels // } // break; // case AICMD_EQUIPHAT: // 1c8 -// if (propLoad(cmd[3] | (cmd[2] << 8))) { +// if (modelLoad(cmd[3] | (cmd[2] << 8))) { // // empty // } // break; diff --git a/src/game/game_00c490.c b/src/game/game_00c490.c index 185f03900..5745755d7 100644 --- a/src/game/game_00c490.c +++ b/src/game/game_00c490.c @@ -397,7 +397,7 @@ glabel var7f1a7f80 /* f00cef0: afbf0034 */ sw $ra,0x34($sp) /* f00cef4: afa5014c */ sw $a1,0x14c($sp) /* f00cef8: 84840004 */ lh $a0,0x4($a0) -/* f00cefc: 0fc2486d */ jal propLoad +/* f00cefc: 0fc2486d */ jal modelLoad /* f00cf00: afa40140 */ sw $a0,0x140($sp) /* f00cf04: 960e0000 */ lhu $t6,0x0($s0) /* f00cf08: 3c03800a */ lui $v1,%hi(g_Vars) @@ -1349,7 +1349,7 @@ void setupSingleMonitor(struct singlemonitorobj *monitor, s32 cmdindex) Mtxf sp64; Mtxf sp24; - propLoad(modelnum); + modelLoad(modelnum); scale = monitor->base.extrascale * (1.0f / 256.0f); @@ -1482,7 +1482,7 @@ glabel var7f1a926cpf /* f00e364: 84840004 */ lh $a0,0x4($a0) /* f00e368: 240effff */ li $t6,-1 /* f00e36c: afae01bc */ sw $t6,0x1bc($sp) -/* f00e370: 0fc2482d */ jal propLoad +/* f00e370: 0fc2482d */ jal modelLoad /* f00e374: afa401c0 */ sw $a0,0x1c0($sp) /* f00e378: 960f0070 */ lhu $t7,0x70($s0) /* f00e37c: 31f80040 */ andi $t8,$t7,0x40 @@ -1877,7 +1877,7 @@ glabel var7f1a8064 /* f00e37c: 84840004 */ lh $a0,0x4($a0) /* f00e380: 240effff */ addiu $t6,$zero,-1 /* f00e384: afae01bc */ sw $t6,0x1bc($sp) -/* f00e388: 0fc2486d */ jal propLoad +/* f00e388: 0fc2486d */ jal modelLoad /* f00e38c: afa401c0 */ sw $a0,0x1c0($sp) /* f00e390: 960f0070 */ lhu $t7,0x70($s0) /* f00e394: 31f80040 */ andi $t8,$t7,0x40 @@ -2263,7 +2263,7 @@ glabel var7f1a8064 // s32 portalnum = -1; // 1bc // struct pad pad; // 168 // -// propLoad(modelnum); +// modelLoad(modelnum); // // if (door->doorflags & DOORFLAG_0040) { // func0f116068(door->base.pad); @@ -3053,7 +3053,7 @@ void setupParseObjects(s32 stagenum) } obj->numtiles = 1; - propLoad(modelnum); + modelLoad(modelnum); modelstate = &g_ModelStates[modelnum]; if (modelstate->filedata) { @@ -3211,7 +3211,7 @@ void setupParseObjects(s32 stagenum) if (ammoqty > 0 && withobjs && (obj->flags2 & diffflag) == 0) { for (i = 0; i < 19; i++) { if (crate->slots[i].quantity > 0 && crate->slots[i].modelnum != 0xffff) { - propLoad(crate->slots[i].modelnum); + modelLoad(crate->slots[i].modelnum); } } diff --git a/src/game/game_011110.c b/src/game/game_011110.c index a56f1fd3f..2ea11f1fd 100644 --- a/src/game/game_011110.c +++ b/src/game/game_011110.c @@ -365,13 +365,13 @@ bool weaponLoadProjectileModels(s32 weaponnum) struct weaponfunc_shootprojectile *func = (struct weaponfunc_shootprojectile *)genericfunc; if (func->projectilemodelnum >= 0) { - result |= propLoad(func->projectilemodelnum); + result |= modelLoad(func->projectilemodelnum); } } else if (genericfunc->type == INVENTORYFUNCTYPE_THROW) { struct weaponfunc_throw *func = (struct weaponfunc_throw *)genericfunc; if (func->projectilemodelnum >= 0) { - result |= propLoad(func->projectilemodelnum); + result |= modelLoad(func->projectilemodelnum); } } } diff --git a/src/game/game_091e10.c b/src/game/game_091e10.c index fe1110c2e..9ba69c4f5 100644 --- a/src/game/game_091e10.c +++ b/src/game/game_091e10.c @@ -198,7 +198,7 @@ glabel setupGetCommandOffset /* f0921b0: 27bd0028 */ addiu $sp,$sp,0x28 ); -bool propLoad(s32 propnum) +bool modelLoad(s32 propnum) { if (g_ModelStates[propnum].filedata == NULL) { g_ModelStates[propnum].filedata = fileLoad(g_ModelStates[propnum].fileid); diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index 3518f7514..ce0d090be 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -17075,7 +17075,7 @@ void currentPlayerLoseGun(struct prop *attackerprop) modelnum = weaponGetModel(weaponnum); if (modelnum >= 0 && drop) { - struct prop *prop2 = func0f08b8e8(chr, modelnum, weaponnum, 0x20000000, 0, 0); + struct prop *prop2 = weaponCreateForChr(chr, modelnum, weaponnum, 0x20000000, 0, 0); if (prop2 && prop2->obj) { struct defaultobj *obj = prop2->obj; diff --git a/src/game/game_0b28d0.c b/src/game/game_0b28d0.c index 594cefca5..05891eba0 100644 --- a/src/game/game_0b28d0.c +++ b/src/game/game_0b28d0.c @@ -609,7 +609,7 @@ glabel func0f0b2b64 ); GLOBAL_ASM( -glabel func0f0b30ac +glabel modelInstantiate /* f0b30ac: 27bdffe8 */ addiu $sp,$sp,-24 /* f0b30b0: afbf0014 */ sw $ra,0x14($sp) /* f0b30b4: 0fc2cad9 */ jal func0f0b2b64 diff --git a/src/game/game_0b69d0.c b/src/game/game_0b69d0.c index c9f153f5a..c25ba56ce 100644 --- a/src/game/game_0b69d0.c +++ b/src/game/game_0b69d0.c @@ -2323,7 +2323,7 @@ glabel var7f1ad5b4 /* f0b948c: 8fa6006c */ lw $a2,0x6c($sp) /* f0b9490: 00003825 */ or $a3,$zero,$zero /* f0b9494: afaf0010 */ sw $t7,0x10($sp) -/* f0b9498: 0fc22e3a */ jal func0f08b8e8 +/* f0b9498: 0fc22e3a */ jal weaponCreateForChr /* f0b949c: afa90014 */ sw $t1,0x14($sp) .L0f0b94a0: /* f0b94a0: 0fc29c3e */ jal func0f0a70f8 @@ -2965,7 +2965,7 @@ glabel var7f1ad5b4 /* f0b7168: 8fa6006c */ lw $a2,0x6c($sp) /* f0b716c: 00003825 */ or $a3,$zero,$zero /* f0b7170: afb90010 */ sw $t9,0x10($sp) -/* f0b7174: 0fc22844 */ jal func0f08b8e8 +/* f0b7174: 0fc22844 */ jal weaponCreateForChr /* f0b7178: afb80014 */ sw $t8,0x14($sp) .NB0f0b717c: /* f0b717c: 0fc2938f */ jal func0f0a70f8 @@ -13115,7 +13115,7 @@ glabel var7f1ad6ac // chr->cloakfadefrac = 0; // // chrGiveWeapon(chr, MODEL_CHRDY357TRENT, WEAPON_DY357LX, 0); -// chrGiveWeapon(chr, MODEL_CHRDY357, WEAPON_DY357MAGNUM, 0x10000000); +// chrGiveWeapon(chr, MODEL_CHRDY357, WEAPON_DY357MAGNUM, OBJFLAG_WEAPON_10000000); // } // } // diff --git a/src/game/game_127910.c b/src/game/game_127910.c index 299c21ac7..b37074d9a 100644 --- a/src/game/game_127910.c +++ b/src/game/game_127910.c @@ -1029,7 +1029,7 @@ void func0f128d20(s32 hand) flags = 0x10000000; } - func0f08b8e8(chr, modelnum, weaponnum, flags, 0, 0); + weaponCreateForChr(chr, modelnum, weaponnum, flags, 0, 0); } } } diff --git a/src/game/game_190260.c b/src/game/game_190260.c index 33452e590..e15bf4233 100644 --- a/src/game/game_190260.c +++ b/src/game/game_190260.c @@ -4225,7 +4225,7 @@ void aibotLoseGun(struct chrdata *chr, struct prop *attackerprop) s32 modelnum = weaponGetModel(chr->aibot->weaponnum); if (modelnum >= 0) { - prop = func0f08b8e8(chr, modelnum, chr->aibot->weaponnum, 0x20000000, 0, 0); + prop = weaponCreateForChr(chr, modelnum, chr->aibot->weaponnum, 0x20000000, 0, 0); } } diff --git a/src/game/game_197c00.c b/src/game/game_197c00.c index b93ba8232..1b76e48e6 100644 --- a/src/game/game_197c00.c +++ b/src/game/game_197c00.c @@ -994,7 +994,7 @@ bool aibotSwitchToWeapon(struct chrdata *chr, s32 weaponnum, s32 funcnum) // This function assumes weaponGetModel returns a negative value for // WEAPON_UNARMED which is a dangerous assumption to make, but correct. if (modelnum >= 0 && item && item->type == INVITEMTYPE_DUAL && chr->weapons_held[1] == NULL) { - chrGiveWeapon(chr, modelnum, weaponnum, 0x10000000); + chrGiveWeapon(chr, modelnum, weaponnum, OBJFLAG_WEAPON_10000000); aibotReloadWeapon(chr, HAND_LEFT, false); } } @@ -1036,7 +1036,7 @@ void func0f19978c(struct chrdata *chr, s32 weaponnum, u8 arg2) s32 modelnum = weaponGetModel(item->type_weap.weapon1); if (modelnum > 0) { - struct prop *prop = func0f08b8e8(chr, modelnum, item->type_weap.weapon1, 0x20000000, 0, 0); + struct prop *prop = weaponCreateForChr(chr, modelnum, item->type_weap.weapon1, 0x20000000, 0, 0); if (prop) { propobjSetDropped(prop, DROPREASON_1); diff --git a/src/game/propobj.c b/src/game/propobj.c index b4a63d23b..4880722e8 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -5253,7 +5253,7 @@ glabel func0f06a1ec .L0f06a214: /* f06a214: 14e00005 */ bnez $a3,.L0f06a22c /* f06a218: 8fa40024 */ lw $a0,0x24($sp) -/* f06a21c: 0fc2cc2b */ jal func0f0b30ac +/* f06a21c: 0fc2cc2b */ jal modelInstantiate /* f06a220: afa60028 */ sw $a2,0x28($sp) /* f06a224: 8fa60028 */ lw $a2,0x28($sp) /* f06a228: 00403825 */ or $a3,$v0,$zero @@ -64026,7 +64026,7 @@ void hatLoadAndApplyToChr(struct hatobj *hat, struct chrdata *chr) u32 stack; s32 modelnum = hat->base.modelnum; - propLoad(modelnum); + modelLoad(modelnum); hatApplyToChr(hat, chr, g_ModelStates[modelnum].filedata, NULL, 0); } @@ -64046,7 +64046,7 @@ glabel chrTryEquipHat /* f089dec: afb00020 */ sw $s0,0x20($sp) /* f089df0: afa500a4 */ sw $a1,0xa4($sp) /* f089df4: afa600a8 */ sw $a2,0xa8($sp) -/* f089df8: 0fc2486d */ jal propLoad +/* f089df8: 0fc2486d */ jal modelLoad /* f089dfc: 00a02025 */ or $a0,$a1,$zero /* f089e00: 8fae00a4 */ lw $t6,0xa4($sp) /* f089e04: 3c188008 */ lui $t8,%hi(g_ModelStates) @@ -64056,7 +64056,7 @@ glabel chrTryEquipHat /* f089e14: 0fc180d6 */ jal propAllocate /* f089e18: afb8009c */ sw $t8,0x9c($sp) /* f089e1c: 00408025 */ or $s0,$v0,$zero -/* f089e20: 0fc2cc2b */ jal func0f0b30ac +/* f089e20: 0fc2cc2b */ jal modelInstantiate /* f089e24: 8fa4009c */ lw $a0,0x9c($sp) /* f089e28: 00408825 */ or $s1,$v0,$zero /* f089e2c: 2e040001 */ sltiu $a0,$s0,0x1 @@ -64071,7 +64071,7 @@ glabel chrTryEquipHat .L0f089e50: /* f089e50: 16200004 */ bnez $s1,.L0f089e64 /* f089e54: 00000000 */ nop -/* f089e58: 0fc2cc2b */ jal func0f0b30ac +/* f089e58: 0fc2cc2b */ jal modelInstantiate /* f089e5c: 8fa4009c */ lw $a0,0x9c($sp) /* f089e60: 00408825 */ or $s1,$v0,$zero .L0f089e64: @@ -65657,7 +65657,7 @@ void func0f08b208(struct weaponobj *weapon, struct chrdata *chr) u32 stack; s32 modelnum = weapon->base.modelnum; - propLoad(modelnum); + modelLoad(modelnum); func0f08b108(weapon, chr, g_ModelStates[modelnum].filedata, 0, 0); } @@ -65705,7 +65705,7 @@ glabel var7f1aae98 /* f08b2d0: 0058082a */ slt $at,$v0,$t8 /* f08b2d4: 502000dc */ beqzl $at,.L0f08b648 /* f08b2d8: 8fbf0024 */ lw $ra,0x24($sp) -/* f08b2dc: 0fc2486d */ jal propLoad +/* f08b2dc: 0fc2486d */ jal modelLoad /* f08b2e0: 8fa400a8 */ lw $a0,0xa8($sp) /* f08b2e4: 8faa0094 */ lw $t2,0x94($sp) /* f08b2e8: 8fb900a8 */ lw $t9,0xa8($sp) @@ -65739,7 +65739,7 @@ glabel var7f1aae98 /* f08b354: 0fc180d6 */ jal propAllocate /* f08b358: 00000000 */ nop /* f08b35c: afa200a0 */ sw $v0,0xa0($sp) -/* f08b360: 0fc2cc2b */ jal func0f0b30ac +/* f08b360: 0fc2cc2b */ jal modelInstantiate /* f08b364: 8fa400a4 */ lw $a0,0xa4($sp) /* f08b368: 8fad00a0 */ lw $t5,0xa0($sp) /* f08b36c: 00403825 */ or $a3,$v0,$zero @@ -65752,7 +65752,7 @@ glabel var7f1aae98 .L0f08b388: /* f08b388: 14e00004 */ bnez $a3,.L0f08b39c /* f08b38c: 00000000 */ nop -/* f08b390: 0fc2cc2b */ jal func0f0b30ac +/* f08b390: 0fc2cc2b */ jal modelInstantiate /* f08b394: 8fa400a4 */ lw $a0,0xa4($sp) /* f08b398: 00403825 */ or $a3,$v0,$zero .L0f08b39c: @@ -65983,7 +65983,7 @@ glabel var7f1aae98 /* f08b2d0: 0058082a */ slt $at,$v0,$t8 /* f08b2d4: 502000dc */ beqzl $at,.L0f08b648 /* f08b2d8: 8fbf0024 */ lw $ra,0x24($sp) -/* f08b2dc: 0fc2486d */ jal propLoad +/* f08b2dc: 0fc2486d */ jal modelLoad /* f08b2e0: 8fa400a8 */ lw $a0,0xa8($sp) /* f08b2e4: 8faa0094 */ lw $t2,0x94($sp) /* f08b2e8: 8fb900a8 */ lw $t9,0xa8($sp) @@ -66017,7 +66017,7 @@ glabel var7f1aae98 /* f08b354: 0fc180d6 */ jal propAllocate /* f08b358: 00000000 */ nop /* f08b35c: afa200a0 */ sw $v0,0xa0($sp) -/* f08b360: 0fc2cc2b */ jal func0f0b30ac +/* f08b360: 0fc2cc2b */ jal modelInstantiate /* f08b364: 8fa400a4 */ lw $a0,0xa4($sp) /* f08b368: 8fad00a0 */ lw $t5,0xa0($sp) /* f08b36c: 00403825 */ or $a3,$v0,$zero @@ -66030,7 +66030,7 @@ glabel var7f1aae98 .L0f08b388: /* f08b388: 14e00004 */ bnez $a3,.L0f08b39c /* f08b38c: 00000000 */ nop -/* f08b390: 0fc2cc2b */ jal func0f0b30ac +/* f08b390: 0fc2cc2b */ jal modelInstantiate /* f08b394: 8fa400a4 */ lw $a0,0xa4($sp) /* f08b398: 00403825 */ or $a3,$v0,$zero .L0f08b39c: @@ -66305,7 +66305,7 @@ glabel var7f1aaf24 /* f08b664: afb00014 */ sw $s0,0x14($sp) /* f08b668: afa400a0 */ sw $a0,0xa0($sp) /* f08b66c: afa500a4 */ sw $a1,0xa4($sp) -/* f08b670: 0fc2486d */ jal propLoad +/* f08b670: 0fc2486d */ jal modelLoad /* f08b674: afa600a8 */ sw $a2,0xa8($sp) /* f08b678: 8fae00a0 */ lw $t6,0xa0($sp) /* f08b67c: 3c188008 */ lui $t8,%hi(g_ModelStates) @@ -66315,7 +66315,7 @@ glabel var7f1aaf24 /* f08b68c: 0fc180d6 */ jal propAllocate /* f08b690: afb8009c */ sw $t8,0x9c($sp) /* f08b694: 00408825 */ or $s1,$v0,$zero -/* f08b698: 0fc2cc2b */ jal func0f0b30ac +/* f08b698: 0fc2cc2b */ jal modelInstantiate /* f08b69c: 8fa4009c */ lw $a0,0x9c($sp) /* f08b6a0: 2e240001 */ sltiu $a0,$s1,0x1 /* f08b6a4: 2c450001 */ sltiu $a1,$v0,0x1 @@ -66332,7 +66332,7 @@ glabel var7f1aaf24 .L0f08b6d0: /* f08b6d0: 14e00004 */ bnez $a3,.L0f08b6e4 /* f08b6d4: 00000000 */ nop -/* f08b6d8: 0fc2cc2b */ jal func0f0b30ac +/* f08b6d8: 0fc2cc2b */ jal modelInstantiate /* f08b6dc: 8fa4009c */ lw $a0,0x9c($sp) /* f08b6e0: 00403825 */ or $a3,$v0,$zero .L0f08b6e4: @@ -66530,7 +66530,7 @@ glabel var7f1aaf24 /* f089e9c: afb00014 */ sw $s0,0x14($sp) /* f089ea0: afa400a0 */ sw $a0,0xa0($sp) /* f089ea4: afa500a4 */ sw $a1,0xa4($sp) -/* f089ea8: 0fc241fe */ jal propLoad +/* f089ea8: 0fc241fe */ jal modelLoad /* f089eac: afa600a8 */ sw $a2,0xa8($sp) /* f089eb0: 8fae00a0 */ lw $t6,0xa0($sp) /* f089eb4: 3c188008 */ lui $t8,0x8008 @@ -66540,7 +66540,7 @@ glabel var7f1aaf24 /* f089ec4: 0fc17d86 */ jal propAllocate /* f089ec8: afb8009c */ sw $t8,0x9c($sp) /* f089ecc: 00408825 */ or $s1,$v0,$zero -/* f089ed0: 0fc2c383 */ jal func0f0b30ac +/* f089ed0: 0fc2c383 */ jal modelInstantiate /* f089ed4: 8fa4009c */ lw $a0,0x9c($sp) /* f089ed8: 2e240001 */ sltiu $a0,$s1,0x1 /* f089edc: 2c450001 */ sltiu $a1,$v0,0x1 @@ -66557,7 +66557,7 @@ glabel var7f1aaf24 .NB0f089f08: /* f089f08: 14e00004 */ bnez $a3,.NB0f089f1c /* f089f0c: 00000000 */ sll $zero,$zero,0x0 -/* f089f10: 0fc2c383 */ jal func0f0b30ac +/* f089f10: 0fc2c383 */ jal modelInstantiate /* f089f14: 8fa4009c */ lw $a0,0x9c($sp) /* f089f18: 00403825 */ or $a3,$v0,$zero .NB0f089f1c: @@ -66760,178 +66760,103 @@ void chrSetObjHiddenFlag4OnWeapon(struct chrdata *chr, s32 hand) } } -u32 var8006ad90 = 0x01000008; -u32 var8006ad94 = 0x00000000; -u32 var8006ad98 = 0x00004001; -u32 var8006ad9c = 0x00000000; -u32 var8006ada0 = 0x00000000; -u32 var8006ada4 = 0x00000000; -u32 var8006ada8 = 0x00000000; -u32 var8006adac = 0x3f800000; -u32 var8006adb0 = 0x00000000; -u32 var8006adb4 = 0x00000000; -u32 var8006adb8 = 0x00000000; -u32 var8006adbc = 0x3f800000; -u32 var8006adc0 = 0x00000000; -u32 var8006adc4 = 0x00000000; -u32 var8006adc8 = 0x00000000; -u32 var8006adcc = 0x3f800000; -u32 var8006add0 = 0x00000000; -u32 var8006add4 = 0x00000000; -u32 var8006add8 = 0x00000000; -u32 var8006addc = 0x000003e8; -u32 var8006ade0 = 0xffffff00; -u32 var8006ade4 = 0xffffff00; -u32 var8006ade8 = 0x0fff0000; -u32 var8006adec = 0x00000000; -u32 var8006adf0 = 0x00ffffff; -u32 var8006adf4 = 0x00000000; +struct prop *weaponCreateForChr(struct chrdata *chr, s32 modelnum, s32 weaponnum, u32 flags, struct weaponobj *obj, struct modelfiledata *filedata) +{ + struct prop *prop; + struct model *model; -GLOBAL_ASM( -glabel func0f08b8e8 -/* f08b8e8: 27bdff60 */ addiu $sp,$sp,-160 -/* f08b8ec: 8fae00b4 */ lw $t6,0xb4($sp) -/* f08b8f0: afbf002c */ sw $ra,0x2c($sp) -/* f08b8f4: afb20028 */ sw $s2,0x28($sp) -/* f08b8f8: afb10024 */ sw $s1,0x24($sp) -/* f08b8fc: afb00020 */ sw $s0,0x20($sp) -/* f08b900: afa400a0 */ sw $a0,0xa0($sp) -/* f08b904: afa500a4 */ sw $a1,0xa4($sp) -/* f08b908: afa600a8 */ sw $a2,0xa8($sp) -/* f08b90c: 15c00009 */ bnez $t6,.L0f08b934 -/* f08b910: afa700ac */ sw $a3,0xac($sp) -/* f08b914: 0fc2486d */ jal propLoad -/* f08b918: 00a02025 */ or $a0,$a1,$zero -/* f08b91c: 8faf00a4 */ lw $t7,0xa4($sp) -/* f08b920: 3c198008 */ lui $t9,%hi(g_ModelStates) -/* f08b924: 000fc0c0 */ sll $t8,$t7,0x3 -/* f08b928: 0338c821 */ addu $t9,$t9,$t8 -/* f08b92c: 8f39b06c */ lw $t9,%lo(g_ModelStates)($t9) -/* f08b930: afb900b4 */ sw $t9,0xb4($sp) -.L0f08b934: -/* f08b934: 0fc180d6 */ jal propAllocate -/* f08b938: 00000000 */ nop -/* f08b93c: 00409025 */ or $s2,$v0,$zero -/* f08b940: 0fc2cc2b */ jal func0f0b30ac -/* f08b944: 8fa400b4 */ lw $a0,0xb4($sp) -/* f08b948: 8fb000b0 */ lw $s0,0xb0($sp) -/* f08b94c: 00408825 */ or $s1,$v0,$zero -/* f08b950: 2e440001 */ sltiu $a0,$s2,0x1 -/* f08b954: 16000004 */ bnez $s0,.L0f08b968 -/* f08b958: 2c450001 */ sltiu $a1,$v0,0x1 -/* f08b95c: 0fc227e3 */ jal func0f089f8c -/* f08b960: 8fa600b4 */ lw $a2,0xb4($sp) -/* f08b964: 00408025 */ or $s0,$v0,$zero -.L0f08b968: -/* f08b968: 16400004 */ bnez $s2,.L0f08b97c -/* f08b96c: 00000000 */ nop -/* f08b970: 0fc180d6 */ jal propAllocate -/* f08b974: 00000000 */ nop -/* f08b978: 00409025 */ or $s2,$v0,$zero -.L0f08b97c: -/* f08b97c: 16200004 */ bnez $s1,.L0f08b990 -/* f08b980: 00000000 */ nop -/* f08b984: 0fc2cc2b */ jal func0f0b30ac -/* f08b988: 8fa400b4 */ lw $a0,0xb4($sp) -/* f08b98c: 00408825 */ or $s1,$v0,$zero -.L0f08b990: -/* f08b990: 1200003b */ beqz $s0,.L0f08ba80 -/* f08b994: 00000000 */ nop -/* f08b998: 12400039 */ beqz $s2,.L0f08ba80 -/* f08b99c: 00000000 */ nop -/* f08b9a0: 12200037 */ beqz $s1,.L0f08ba80 -/* f08b9a4: 27a20030 */ addiu $v0,$sp,0x30 -/* f08b9a8: 3c088007 */ lui $t0,%hi(var8006ad90) -/* f08b9ac: 2508ad90 */ addiu $t0,$t0,%lo(var8006ad90) -/* f08b9b0: 250a0060 */ addiu $t2,$t0,0x60 -/* f08b9b4: 00405825 */ or $t3,$v0,$zero -.L0f08b9b8: -/* f08b9b8: 8d010000 */ lw $at,0x0($t0) -/* f08b9bc: 2508000c */ addiu $t0,$t0,0xc -/* f08b9c0: 256b000c */ addiu $t3,$t3,0xc -/* f08b9c4: ad61fff4 */ sw $at,-0xc($t3) -/* f08b9c8: 8d01fff8 */ lw $at,-0x8($t0) -/* f08b9cc: ad61fff8 */ sw $at,-0x8($t3) -/* f08b9d0: 8d01fffc */ lw $at,-0x4($t0) -/* f08b9d4: 150afff8 */ bne $t0,$t2,.L0f08b9b8 -/* f08b9d8: ad61fffc */ sw $at,-0x4($t3) -/* f08b9dc: 8d010000 */ lw $at,0x0($t0) -/* f08b9e0: 00407025 */ or $t6,$v0,$zero -/* f08b9e4: 02007825 */ or $t7,$s0,$zero -/* f08b9e8: ad610000 */ sw $at,0x0($t3) -/* f08b9ec: 8d0a0004 */ lw $t2,0x4($t0) -/* f08b9f0: 244d0060 */ addiu $t5,$v0,0x60 -/* f08b9f4: ad6a0004 */ sw $t2,0x4($t3) -.L0f08b9f8: -/* f08b9f8: 8dc10000 */ lw $at,0x0($t6) -/* f08b9fc: 25ce000c */ addiu $t6,$t6,0xc -/* f08ba00: 25ef000c */ addiu $t7,$t7,0xc -/* f08ba04: ade1fff4 */ sw $at,-0xc($t7) -/* f08ba08: 8dc1fff8 */ lw $at,-0x8($t6) -/* f08ba0c: ade1fff8 */ sw $at,-0x8($t7) -/* f08ba10: 8dc1fffc */ lw $at,-0x4($t6) -/* f08ba14: 15cdfff8 */ bne $t6,$t5,.L0f08b9f8 -/* f08ba18: ade1fffc */ sw $at,-0x4($t7) -/* f08ba1c: 8dc10000 */ lw $at,0x0($t6) -/* f08ba20: 02002025 */ or $a0,$s0,$zero -/* f08ba24: 02403825 */ or $a3,$s2,$zero -/* f08ba28: ade10000 */ sw $at,0x0($t7) -/* f08ba2c: 8dcd0004 */ lw $t5,0x4($t6) -/* f08ba30: aded0004 */ sw $t5,0x4($t7) -/* f08ba34: 8fb800a8 */ lw $t8,0xa8($sp) -/* f08ba38: a200005f */ sb $zero,0x5f($s0) -/* f08ba3c: a200005e */ sb $zero,0x5e($s0) -/* f08ba40: a200005d */ sb $zero,0x5d($s0) -/* f08ba44: a218005c */ sb $t8,0x5c($s0) -/* f08ba48: 8fb900a4 */ lw $t9,0xa4($sp) -/* f08ba4c: a6190004 */ sh $t9,0x4($s0) -/* f08ba50: 8fa900ac */ lw $t1,0xac($sp) -/* f08ba54: 352a4000 */ ori $t2,$t1,0x4000 -/* f08ba58: ae0a0008 */ sw $t2,0x8($s0) -/* f08ba5c: 8fa800a0 */ lw $t0,0xa0($sp) -/* f08ba60: 850b0000 */ lh $t3,0x0($t0) -/* f08ba64: a60b0006 */ sh $t3,0x6($s0) -/* f08ba68: afb10010 */ sw $s1,0x10($sp) -/* f08ba6c: 8fa600b4 */ lw $a2,0xb4($sp) -/* f08ba70: 0fc22c42 */ jal func0f08b108 -/* f08ba74: 8fa500a0 */ lw $a1,0xa0($sp) -/* f08ba78: 1000000e */ b .L0f08bab4 -/* f08ba7c: 00409025 */ or $s2,$v0,$zero -.L0f08ba80: -/* f08ba80: 12200003 */ beqz $s1,.L0f08ba90 -/* f08ba84: 00000000 */ nop -/* f08ba88: 0fc2cc33 */ jal modelFree -/* f08ba8c: 02202025 */ or $a0,$s1,$zero -.L0f08ba90: -/* f08ba90: 12400004 */ beqz $s2,.L0f08baa4 -/* f08ba94: 00000000 */ nop -/* f08ba98: 0fc1810e */ jal propFree -/* f08ba9c: 02402025 */ or $a0,$s2,$zero -/* f08baa0: 00009025 */ or $s2,$zero,$zero -.L0f08baa4: -/* f08baa4: 52000004 */ beqzl $s0,.L0f08bab8 -/* f08baa8: 8fbf002c */ lw $ra,0x2c($sp) -/* f08baac: ae000014 */ sw $zero,0x14($s0) -/* f08bab0: ae000018 */ sw $zero,0x18($s0) -.L0f08bab4: -/* f08bab4: 8fbf002c */ lw $ra,0x2c($sp) -.L0f08bab8: -/* f08bab8: 02401025 */ or $v0,$s2,$zero -/* f08babc: 8fb20028 */ lw $s2,0x28($sp) -/* f08bac0: 8fb00020 */ lw $s0,0x20($sp) -/* f08bac4: 8fb10024 */ lw $s1,0x24($sp) -/* f08bac8: 03e00008 */ jr $ra -/* f08bacc: 27bd00a0 */ addiu $sp,$sp,0xa0 -); + if (filedata == NULL) { + modelLoad(modelnum); + filedata = g_ModelStates[modelnum].filedata; + } + + prop = propAllocate(); + model = modelInstantiate(filedata); + + if (obj == NULL) { + obj = func0f089f8c(prop == NULL, model == NULL, filedata); + } + + if (prop == NULL) { + prop = propAllocate(); + } + + if (model == NULL) { + model = modelInstantiate(filedata); + } + + if (obj && prop && model) { + struct weaponobj tmp = { + 256, // extrascale + 0, // hidden2 + OBJTYPE_WEAPON, // type + 0, // modelnum + 0, // pad + OBJFLAG_00000001 | OBJFLAG_ASSIGNEDTOCHR, // flags + 0, // flags2 + 0, // flags3 + NULL, // prop + NULL, // model + 1, 0, 0, // realrot + 0, 1, 0, + 0, 0, 1, + 0, // hidden + NULL, // geo + NULL, // projectile + 0, // damage + 1000, // maxdamage + 0xff, 0xff, 0xff, 0x00, // shadecol + 0xff, 0xff, 0xff, 0x00, // nextcol + 0x0fff, // floorcol + 0, // tiles + 0, // weaponnum + 0, // unk5d + 0, // unk5e + 0, // gunfunc + 0, // unk60 + -1, // dualweaponnum + -1, // timer240 + NULL, // dualweapon + }; + + *obj = tmp; + + obj->weaponnum = weaponnum; + obj->gunfunc = FUNC_PRIMARY; + obj->unk5e = 0; + obj->unk5d = 0; + obj->base.modelnum = modelnum; + obj->base.flags = flags | OBJFLAG_ASSIGNEDTOCHR; + obj->base.pad = chr->chrnum; + + prop = func0f08b108(obj, chr, filedata, prop, model); + } else { + if (model) { + modelFree(model); + } + + if (prop) { + propFree(prop); + prop = NULL; + } + + if (obj) { + obj->base.prop = NULL; + obj->base.model = NULL; + } + } + + return prop; +} struct prop *chrGiveWeapon(struct chrdata *chr, s32 model, s32 weaponnum, u32 flags) { - return func0f08b8e8(chr, model, weaponnum, flags, 0, 0); + return weaponCreateForChr(chr, model, weaponnum, flags, NULL, NULL); } struct prop *func0f08baf4(struct chrdata *chr, s32 weaponnum, u32 flags) { - return func0f08b8e8(chr, weaponGetModel(weaponnum), weaponnum, flags, 0, 0); + return weaponCreateForChr(chr, weaponGetModel(weaponnum), weaponnum, flags, NULL, NULL); } GLOBAL_ASM( @@ -70947,7 +70872,7 @@ void func0f091250(s32 weaponnum) u32 stack2; chr = g_Vars.currentplayer->prop->chr; - prop = func0f08b8e8(chr, weaponGetModel(weaponnum), weaponnum, 0x20000000, 0, 0); + prop = weaponCreateForChr(chr, weaponGetModel(weaponnum), weaponnum, OBJFLAG_20000000, NULL, NULL); if (prop) { propobjSetDropped(prop, DROPREASON_1); diff --git a/src/game/title.c b/src/game/title.c index 0995f5743..8fd6f08dc 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -1593,7 +1593,7 @@ glabel titleInitPdLogo /* f016ee0: 024c9023 */ subu $s2,$s2,$t4 /* f016ee4: 0c008b49 */ jal modelCalculateRwDataLen /* f016ee8: 8e240268 */ lw $a0,0x268($s1) -/* f016eec: 0fc2cc2b */ jal func0f0b30ac +/* f016eec: 0fc2cc2b */ jal modelInstantiate /* f016ef0: 8e240268 */ lw $a0,0x268($s1) /* f016ef4: 3c038006 */ lui $v1,%hi(var80062508) /* f016ef8: 24632508 */ addiu $v1,$v1,%lo(var80062508) @@ -1629,7 +1629,7 @@ glabel titleInitPdLogo /* f016f70: 02489023 */ subu $s2,$s2,$t0 /* f016f74: 0c008b49 */ jal modelCalculateRwDataLen /* f016f78: 8e240270 */ lw $a0,0x270($s1) -/* f016f7c: 0fc2cc2b */ jal func0f0b30ac +/* f016f7c: 0fc2cc2b */ jal modelInstantiate /* f016f80: 8e240270 */ lw $a0,0x270($s1) /* f016f84: 3c038006 */ lui $v1,%hi(var8006250c) /* f016f88: 2463250c */ addiu $v1,$v1,%lo(var8006250c) @@ -1735,7 +1735,7 @@ glabel titleInitPdLogo // remaining -= size; // modelCalculateRwDataLen(g_ModelStates[MODEL_PDTWO].filedata); // -// var80062508 = func0f0b30ac(g_ModelStates[MODEL_PDTWO].filedata); +// var80062508 = modelInstantiate(g_ModelStates[MODEL_PDTWO].filedata); // modelSetScale(var80062508, 1); // modelSetRootPosition(var80062508, &coord); // } @@ -1748,7 +1748,7 @@ glabel titleInitPdLogo // remaining -= size; // modelCalculateRwDataLen(g_ModelStates[MODEL_PDTHREE].filedata); // -// var8006250c = func0f0b30ac(g_ModelStates[MODEL_PDTHREE].filedata); +// var8006250c = modelInstantiate(g_ModelStates[MODEL_PDTHREE].filedata); // modelSetScale(var8006250c, 1); // modelSetRootPosition(var8006250c, &coord); // } @@ -5349,7 +5349,7 @@ void titleInitNintendoLogo(void) g_ModelStates[MODEL_NINTENDOLOGO].filedata = func0f1a7794(g_ModelStates[MODEL_NINTENDOLOGO].fileid, nextaddr, 0x47800, 0); modelCalculateRwDataLen(g_ModelStates[MODEL_NINTENDOLOGO].filedata); - g_TitleModel = func0f0b30ac(g_ModelStates[MODEL_NINTENDOLOGO].filedata); + g_TitleModel = modelInstantiate(g_ModelStates[MODEL_NINTENDOLOGO].filedata); modelSetScale(g_TitleModel, 1); modelSetRootPosition(g_TitleModel, &coord); var800624f4 = 1; @@ -6030,7 +6030,7 @@ void titleInitRareLogo(void) g_ModelStates[MODEL_RARELOGO].filedata = func0f1a7794(g_ModelStates[MODEL_RARELOGO].fileid, nextaddr, 0x47800, 0); modelCalculateRwDataLen(g_ModelStates[MODEL_RARELOGO].filedata); - g_TitleModel = func0f0b30ac(g_ModelStates[MODEL_RARELOGO].filedata); + g_TitleModel = modelInstantiate(g_ModelStates[MODEL_RARELOGO].filedata); modelSetScale(g_TitleModel, 1); modelSetRootPosition(g_TitleModel, &coord); diff --git a/src/include/game/game_091e10.h b/src/include/game/game_091e10.h index 8502a2c34..10d3a26df 100644 --- a/src/include/game/game_091e10.h +++ b/src/include/game/game_091e10.h @@ -8,7 +8,7 @@ u32 setupGetCommandLength(u32 *cmd); u32 *setupGetPtrToCommandByIndex(u32 cmdindex); s32 tagGetCommandIndex(struct tag *tag); u32 setupGetCommandOffset(struct prop *prop); -bool propLoad(s32 propnum); +bool modelLoad(s32 propnum); bool func0f09220c(struct defaultobj *obj, struct coord *pos, f32 *realrot, struct coord *arg3, struct coord *arg4); bool func0f092304(struct defaultobj *obj, struct coord *arg1, struct coord *arg2); void func0f09233c(struct defaultobj *obj, struct coord *pos, f32 *realrot, s16 *rooms); diff --git a/src/include/game/game_0b28d0.h b/src/include/game/game_0b28d0.h index 6e69edb65..aea4991bd 100644 --- a/src/include/game/game_0b28d0.h +++ b/src/include/game/game_0b28d0.h @@ -7,9 +7,9 @@ u32 func0f0b28d0(void); void func0f0b2904(void); u32 func0f0b2b64(void); -struct model *func0f0b30ac(void *modelfiledata); +struct model *modelInstantiate(struct modelfiledata *modelfiledata); void modelFree(struct model *model); -struct model *func0f0b3280(void *modelfiledata); +struct model *func0f0b3280(struct modelfiledata *modelfiledata); void func0f0b32a0(struct model *model, struct modelnode *node, struct modelfiledata *headfiledata); struct anim *func0f0b32e4(void); void animTurnOff(struct anim *anim); diff --git a/src/include/game/propobj.h b/src/include/game/propobj.h index fb015756f..83d3ee962 100644 --- a/src/include/game/propobj.h +++ b/src/include/game/propobj.h @@ -267,7 +267,7 @@ struct prop *hatApplyToChr(struct hatobj *hat, struct chrdata *chr, struct model void hatLoadAndApplyToChr(struct hatobj *hat, struct chrdata *chr); void hatAssignToChr(struct hatobj *hat, struct chrdata *chr); u32 chrTryEquipHat(struct chrdata *chr, u32 model, u32 flags); -u32 func0f089f8c(void); +struct weaponobj *func0f089f8c(bool arg0, bool arg1, struct modelfiledata *filedata); u32 func0f08a38c(void); struct ammocrateobj *func0f08a724(void); u32 func0f08a88c(void); @@ -282,14 +282,14 @@ void propweaponSetDual(struct weaponobj *weapon1, struct weaponobj *weapon2); u32 func0f08adc8(void); u32 func0f08ae0c(void); u32 func0f08ae54(struct defaultobj *obj, struct chrdata *chr); -u32 func0f08b108(struct weaponobj *weapon, struct chrdata *chr, struct modelfiledata *modelfiledata, u32 arg3, u32 arg4); +struct prop *func0f08b108(struct weaponobj *weapon, struct chrdata *chr, struct modelfiledata *modelfiledata, struct prop *prop, struct model *model); void func0f08b208(struct weaponobj *weapon, struct chrdata *chr); void func0f08b25c(struct weaponobj *weapon, struct chrdata *chr); struct weaponobj *func0f08b27c(s32 modelnum, struct gset *gset, struct chrdata *chr); struct weaponobj *func0f08b658(s32 modelnum, struct gset *gset, struct chrdata *chr); struct weaponobj *func0f08b880(s32 modelnum, s32 weaponnum, struct chrdata *chr); void chrSetObjHiddenFlag4OnWeapon(struct chrdata *chr, s32 hand); -struct prop *func0f08b8e8(struct chrdata *chr, s32 modelnum, s32 weaponnum, u32 flags, s32 arg4, s32 arg5); +struct prop *weaponCreateForChr(struct chrdata *chr, s32 modelnum, s32 weaponnum, u32 flags, struct weaponobj *obj, struct modelfiledata *filedata); struct prop *chrGiveWeapon(struct chrdata *chr, s32 model, s32 weaponnum, u32 flags); u32 func0f08bb3c(void); void weaponSetGunfireVisible(struct prop *prop, bool visible, s16 room);