From e4c48d6fe156fa3c699191eeb5e6681ac439e75d Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 29 May 2021 20:06:43 +1000 Subject: [PATCH] Decompile laptopDeploy --- src/game/game_00c490.c | 2 +- src/game/game_097ba0.c | 56 +-- src/game/propobj.c | 723 +++++++-------------------------- src/include/data.h | 2 +- src/include/game/game_097ba0.h | 4 +- src/include/game/propobj.h | 4 +- src/include/types.h | 15 +- 7 files changed, 176 insertions(+), 630 deletions(-) diff --git a/src/game/game_00c490.c b/src/game/game_00c490.c index 5745755d7..7a4dd0602 100644 --- a/src/game/game_00c490.c +++ b/src/game/game_00c490.c @@ -305,7 +305,7 @@ void setupInit(void) g_MaxThrownLaptops = g_Vars.normmplayerisrunning ? 12 : PLAYERCOUNT(); g_ThrownLaptops = malloc(ALIGN16(g_MaxThrownLaptops * sizeof(struct autogunobj)), MEMPOOL_STAGE); - var8006996c = malloc(ALIGN16(g_MaxThrownLaptops * 0x2c), MEMPOOL_STAGE); + g_ThrownLaptopBeams = malloc(ALIGN16(g_MaxThrownLaptops * sizeof(struct beam)), MEMPOOL_STAGE); for (i = 0; i < g_MaxThrownLaptops; i++) { g_ThrownLaptops[i].base.prop = NULL; diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index ce0d090be..72ea2e51f 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -11216,16 +11216,16 @@ void func0f09ed2c(struct defaultobj *obj, struct coord *newpos, Mtxf *arg2, f32 /** * Create a thrown projectile. */ -struct weaponobj *func0f09ee18(struct chrdata *chr, struct gset *gset, struct coord *pos, s16 *rooms, Mtxf *arg4, struct coord *arg5) +struct defaultobj *func0f09ee18(struct chrdata *chr, struct gset *gset, struct coord *pos, s16 *rooms, Mtxf *arg4, struct coord *arg5) { - struct weaponobj *thing = NULL; + struct defaultobj *obj = NULL; struct weaponfunc *basefunc; struct weaponfunc_throw *func; struct weapon *weapon = weaponFindById(gset->weaponnum); - struct weaponobj *tmpthing; - s32 playernum; + struct weaponobj *weaponobj; + struct autogunobj *autogun; f32 mf[4][4]; - u32 stack; + s32 playernum; if (weapon == NULL) { return false; @@ -11246,41 +11246,41 @@ struct weaponobj *func0f09ee18(struct chrdata *chr, struct gset *gset, struct co } if (gset->weaponnum == WEAPON_LAPTOPGUN) { - tmpthing = func0f08b27c(func->projectilemodelnum, gset, chr); + autogun = laptopDeploy(func->projectilemodelnum, gset, chr); - if (tmpthing != NULL) { - thing = tmpthing; + if (autogun != NULL) { + obj = &autogun->base; } } else { - tmpthing = func0f08b658(func->projectilemodelnum, gset, chr); + weaponobj = func0f08b658(func->projectilemodelnum, gset, chr); - if (tmpthing != NULL) { - thing = tmpthing; + if (weaponobj != NULL) { + obj = &weaponobj->base; // Note this timer is converted to 240 time immediately below - thing->timer240 = func->activatetime60; + weaponobj->timer240 = func->activatetime60; - if (thing->timer240 >= 2) { - thing->timer240 = PALDOWN(thing->timer240 * 4); + if (weaponobj->timer240 >= 2) { + weaponobj->timer240 = PALDOWN(weaponobj->timer240 * 4); } - if (thing->weaponnum == WEAPON_GRENADE || thing->weaponnum == WEAPON_NBOMB) { - propSetDangerous(thing->base.prop); + if (weaponobj->weaponnum == WEAPON_GRENADE || weaponobj->weaponnum == WEAPON_NBOMB) { + propSetDangerous(weaponobj->base.prop); } if (func->projectilemodelnum == MODEL_CHRREMOTEMINE || func->projectilemodelnum == MODEL_CHRTIMEDMINE || func->projectilemodelnum == MODEL_CHRPROXIMITYMINE || func->projectilemodelnum == MODEL_CHRECMMINE) { - thing->base.flags3 |= OBJFLAG3_00000008; + weaponobj->base.flags3 |= OBJFLAG3_00000008; } } } - if (thing != NULL) { - func0f09ebcc(&thing->base, pos, rooms, arg4, (f32 *)arg5, (Mtxf *)mf, chr->prop, pos); + if (obj != NULL) { + func0f09ebcc(obj, pos, rooms, arg4, (f32 *)arg5, (Mtxf *)mf, chr->prop, pos); - thing->base.hidden &= 0x0fffffff; + obj->hidden &= 0x0fffffff; if (g_Vars.normmplayerisrunning) { playernum = mpPlayerGetIndex(chr); @@ -11288,19 +11288,19 @@ struct weaponobj *func0f09ee18(struct chrdata *chr, struct gset *gset, struct co playernum = propGetPlayerNum(chr->prop); } - thing->base.hidden |= playernum << 28; + obj->hidden |= playernum << 28; - if (thing->base.hidden & OBJHFLAG_AIRBORNE) { - thing->base.projectile->flags |= PROJECTILEFLAG_00000002; - thing->base.projectile->unk08c = 0.1f; - thing->base.projectile->unk0b4 = PALDOWN(240); + if (obj->hidden & OBJHFLAG_AIRBORNE) { + obj->projectile->flags |= PROJECTILEFLAG_00000002; + obj->projectile->unk08c = 0.1f; + obj->projectile->unk0b4 = PALDOWN(240); - func0f0939f8(NULL, thing->base.prop, SFX_THROW, -1, + func0f0939f8(NULL, obj->prop, SFX_THROW, -1, -1, 0, 0, 0, NULL, -1, NULL, -1, -1, -1, -1); } } - return thing; + return obj; } #if PAL @@ -30582,7 +30582,7 @@ s32 currentPlayerGetAmmoQuantityForWeapon(u32 weaponnum, u32 func) return 0; } -void currentPlayerGiveAmmoForWeapon(u32 weaponnum, u32 func, u32 quantity) +void currentPlayerSetAmmoQtyForWeapon(u32 weaponnum, u32 func, u32 quantity) { struct weapon *weapon = weaponFindById(weaponnum); diff --git a/src/game/propobj.c b/src/game/propobj.c index 531aa5c6c..9cfae5539 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -157,7 +157,7 @@ f32 g_AmmoMultiplier = 1; struct padeffectobj *var80069960 = NULL; s32 var80069964 = -1; struct autogunobj *g_ThrownLaptops = NULL; -struct var8006996c *var8006996c = NULL; +struct beam *g_ThrownLaptopBeams = NULL; s32 g_MaxThrownLaptops = 0; #if VERSION < VERSION_PAL_FINAL @@ -60053,7 +60053,7 @@ bool propobjInteract(struct prop *prop) if (laptop->ammoquantity > 0 && laptop->ammoquantity != 255) { s32 newqty = currentPlayerGetAmmoQuantityForWeapon(WEAPON_LAPTOPGUN, FUNC_PRIMARY) + laptop->ammoquantity; - currentPlayerGiveAmmoForWeapon(WEAPON_LAPTOPGUN, FUNC_PRIMARY, newqty); + currentPlayerSetAmmoQtyForWeapon(WEAPON_LAPTOPGUN, FUNC_PRIMARY, newqty); } } } else { @@ -65577,563 +65577,145 @@ void func0f08b25c(struct weaponobj *weapon, struct chrdata *chr) func0f08b208(weapon, chr); } -#if VERSION >= VERSION_PAL_FINAL -GLOBAL_ASM( -glabel func0f08b27c -.late_rodata -glabel var7f1aae8c -.word 0x459c4000 -glabel var7f1aae90 -.word 0x4148f5c3 -glabel var7f1aae94 -.word 0xc148f5c3 -glabel var7f1aae98 -.word 0x3dab4b74 -.text -/* f08b27c: 27bdff58 */ addiu $sp,$sp,-168 -/* f08b280: 3c0e800a */ lui $t6,%hi(g_Vars+0x318) -/* f08b284: 8dcea2d8 */ lw $t6,%lo(g_Vars+0x318)($t6) -/* f08b288: afb00020 */ sw $s0,0x20($sp) -/* f08b28c: afbf0024 */ sw $ra,0x24($sp) -/* f08b290: afa400a8 */ sw $a0,0xa8($sp) -/* f08b294: afa500ac */ sw $a1,0xac($sp) -/* f08b298: afa600b0 */ sw $a2,0xb0($sp) -/* f08b29c: 11c00005 */ beqz $t6,.L0f08b2b4 -/* f08b2a0: 00008025 */ or $s0,$zero,$zero -/* f08b2a4: 0fc633fe */ jal mpPlayerGetIndex -/* f08b2a8: 00c02025 */ or $a0,$a2,$zero -/* f08b2ac: 10000005 */ b .L0f08b2c4 -/* f08b2b0: afa20094 */ sw $v0,0x94($sp) -.L0f08b2b4: -/* f08b2b4: 8faf00b0 */ lw $t7,0xb0($sp) -/* f08b2b8: 0fc4a25f */ jal propGetPlayerNum -/* f08b2bc: 8de4001c */ lw $a0,0x1c($t7) -/* f08b2c0: afa20094 */ sw $v0,0x94($sp) -.L0f08b2c4: -/* f08b2c4: 044000df */ bltz $v0,.L0f08b644 -/* f08b2c8: 3c188007 */ lui $t8,%hi(g_MaxThrownLaptops) -/* f08b2cc: 8f189970 */ lw $t8,%lo(g_MaxThrownLaptops)($t8) -/* f08b2d0: 0058082a */ slt $at,$v0,$t8 -/* f08b2d4: 502000dc */ beqzl $at,.L0f08b648 -/* f08b2d8: 8fbf0024 */ lw $ra,0x24($sp) -/* f08b2dc: 0fc2486d */ jal modelLoad -/* f08b2e0: 8fa400a8 */ lw $a0,0xa8($sp) -/* f08b2e4: 8faa0094 */ lw $t2,0x94($sp) -/* f08b2e8: 8fb900a8 */ lw $t9,0xa8($sp) -/* f08b2ec: 3c098008 */ lui $t1,%hi(g_ModelStates) -/* f08b2f0: 000a5880 */ sll $t3,$t2,0x2 -/* f08b2f4: 016a5823 */ subu $t3,$t3,$t2 -/* f08b2f8: 000b5880 */ sll $t3,$t3,0x2 -/* f08b2fc: 001940c0 */ sll $t0,$t9,0x3 -/* f08b300: 01284821 */ addu $t1,$t1,$t0 -/* f08b304: 3c0c8007 */ lui $t4,%hi(g_ThrownLaptops) -/* f08b308: 016a5823 */ subu $t3,$t3,$t2 -/* f08b30c: 8d29b06c */ lw $t1,%lo(g_ModelStates)($t1) -/* f08b310: 8d8c9968 */ lw $t4,%lo(g_ThrownLaptops)($t4) -/* f08b314: 000b5880 */ sll $t3,$t3,0x2 -/* f08b318: 016a5823 */ subu $t3,$t3,$t2 -/* f08b31c: 000b5880 */ sll $t3,$t3,0x2 -/* f08b320: afa900a4 */ sw $t1,0xa4($sp) -/* f08b324: 016c8021 */ addu $s0,$t3,$t4 -/* f08b328: 8e030014 */ lw $v1,0x14($s0) -/* f08b32c: 00002025 */ or $a0,$zero,$zero -/* f08b330: 24070003 */ addiu $a3,$zero,0x3 -/* f08b334: 10600007 */ beqz $v1,.L0f08b354 -/* f08b338: 24650008 */ addiu $a1,$v1,0x8 -/* f08b33c: 24660028 */ addiu $a2,$v1,0x28 -/* f08b340: 0fc4a640 */ jal explosionCreateSimple -/* f08b344: afaa0010 */ sw $t2,0x10($sp) -/* f08b348: 02002025 */ or $a0,$s0,$zero -/* f08b34c: 0fc1acd3 */ jal func0f06b34c -/* f08b350: 24050001 */ addiu $a1,$zero,0x1 -.L0f08b354: -/* f08b354: 0fc180d6 */ jal propAllocate -/* f08b358: 00000000 */ nop -/* f08b35c: afa200a0 */ sw $v0,0xa0($sp) -/* f08b360: 0fc2cc2b */ jal modelInstantiate -/* f08b364: 8fa400a4 */ lw $a0,0xa4($sp) -/* f08b368: 8fad00a0 */ lw $t5,0xa0($sp) -/* f08b36c: 00403825 */ or $a3,$v0,$zero -/* f08b370: 15a00005 */ bnez $t5,.L0f08b388 -/* f08b374: 00000000 */ nop -/* f08b378: 0fc180d6 */ jal propAllocate -/* f08b37c: afa2009c */ sw $v0,0x9c($sp) -/* f08b380: 8fa7009c */ lw $a3,0x9c($sp) -/* f08b384: afa200a0 */ sw $v0,0xa0($sp) -.L0f08b388: -/* f08b388: 14e00004 */ bnez $a3,.L0f08b39c -/* f08b38c: 00000000 */ nop -/* f08b390: 0fc2cc2b */ jal modelInstantiate -/* f08b394: 8fa400a4 */ lw $a0,0xa4($sp) -/* f08b398: 00403825 */ or $a3,$v0,$zero -.L0f08b39c: -/* f08b39c: 1200009f */ beqz $s0,.L0f08b61c -/* f08b3a0: 8fae00a0 */ lw $t6,0xa0($sp) -/* f08b3a4: 11c0009d */ beqz $t6,.L0f08b61c -/* f08b3a8: 00000000 */ nop -/* f08b3ac: 10e0009b */ beqz $a3,.L0f08b61c -/* f08b3b0: 27a20038 */ addiu $v0,$sp,0x38 -/* f08b3b4: 3c0f8007 */ lui $t7,%hi(var8006acc8) -/* f08b3b8: 25efacc8 */ addiu $t7,$t7,%lo(var8006acc8) -/* f08b3bc: 25f90054 */ addiu $t9,$t7,0x54 -/* f08b3c0: 00404025 */ or $t0,$v0,$zero -.L0f08b3c4: -/* f08b3c4: 8de10000 */ lw $at,0x0($t7) -/* f08b3c8: 25ef000c */ addiu $t7,$t7,0xc -/* f08b3cc: 2508000c */ addiu $t0,$t0,0xc -/* f08b3d0: ad01fff4 */ sw $at,-0xc($t0) -/* f08b3d4: 8de1fff8 */ lw $at,-0x8($t7) -/* f08b3d8: ad01fff8 */ sw $at,-0x8($t0) -/* f08b3dc: 8de1fffc */ lw $at,-0x4($t7) -/* f08b3e0: 15f9fff8 */ bne $t7,$t9,.L0f08b3c4 -/* f08b3e4: ad01fffc */ sw $at,-0x4($t0) -/* f08b3e8: 8de10000 */ lw $at,0x0($t7) -/* f08b3ec: 00406025 */ or $t4,$v0,$zero -/* f08b3f0: 02005025 */ or $t2,$s0,$zero -/* f08b3f4: ad010000 */ sw $at,0x0($t0) -/* f08b3f8: 8df90004 */ lw $t9,0x4($t7) -/* f08b3fc: 244b0054 */ addiu $t3,$v0,0x54 -/* f08b400: ad190004 */ sw $t9,0x4($t0) -.L0f08b404: -/* f08b404: 8d810000 */ lw $at,0x0($t4) -/* f08b408: 258c000c */ addiu $t4,$t4,0xc -/* f08b40c: 254a000c */ addiu $t2,$t2,0xc -/* f08b410: ad41fff4 */ sw $at,-0xc($t2) -/* f08b414: 8d81fff8 */ lw $at,-0x8($t4) -/* f08b418: ad41fff8 */ sw $at,-0x8($t2) -/* f08b41c: 8d81fffc */ lw $at,-0x4($t4) -/* f08b420: 158bfff8 */ bne $t4,$t3,.L0f08b404 -/* f08b424: ad41fffc */ sw $at,-0x4($t2) -/* f08b428: 8d810000 */ lw $at,0x0($t4) -/* f08b42c: 02002025 */ or $a0,$s0,$zero -/* f08b430: ad410000 */ sw $at,0x0($t2) -/* f08b434: 8d8b0004 */ lw $t3,0x4($t4) -/* f08b438: ad4b0004 */ sw $t3,0x4($t2) -/* f08b43c: 8fad00a8 */ lw $t5,0xa8($sp) -/* f08b440: a60d0004 */ sh $t5,0x4($s0) -/* f08b444: 8fa600a0 */ lw $a2,0xa0($sp) -/* f08b448: 0fc1a87b */ jal func0f06a1ec -/* f08b44c: 8fa500a4 */ lw $a1,0xa4($sp) -/* f08b450: 8fa500b0 */ lw $a1,0xb0($sp) -/* f08b454: 2403ffff */ addiu $v1,$zero,-1 -/* f08b458: afa200a0 */ sw $v0,0xa0($sp) -/* f08b45c: a603005c */ sh $v1,0x5c($s0) -/* f08b460: 3c017f1b */ lui $at,%hi(var7f1aae8c) -/* f08b464: c424ae8c */ lwc1 $f4,%lo(var7f1aae8c)($at) -/* f08b468: ae0000a4 */ sw $zero,0xa4($s0) -/* f08b46c: 44800000 */ mtc1 $zero,$f0 -/* f08b470: e6040084 */ swc1 $f4,0x84($s0) -/* f08b474: 90ae0125 */ lbu $t6,0x125($a1) -/* f08b478: a60000aa */ sh $zero,0xaa($s0) -/* f08b47c: a200005f */ sb $zero,0x5f($s0) -/* f08b480: 01c0c827 */ nor $t9,$t6,$zero -/* f08b484: a21900a8 */ sb $t9,0xa8($s0) -/* f08b488: ae030090 */ sw $v1,0x90($s0) -/* f08b48c: ae030094 */ sw $v1,0x94($s0) -/* f08b490: ae030098 */ sw $v1,0x98($s0) -/* f08b494: a200005e */ sb $zero,0x5e($s0) -/* f08b498: e6000070 */ swc1 $f0,0x70($s0) -/* f08b49c: e600007c */ swc1 $f0,0x7c($s0) -/* f08b4a0: e6000088 */ swc1 $f0,0x88($s0) -/* f08b4a4: e600008c */ swc1 $f0,0x8c($s0) -/* f08b4a8: e60000a0 */ swc1 $f0,0xa0($s0) -/* f08b4ac: 8ca402d4 */ lw $a0,0x2d4($a1) -/* f08b4b0: 00003025 */ or $a2,$zero,$zero -/* f08b4b4: 240700c8 */ addiu $a3,$zero,0xc8 -/* f08b4b8: 50800008 */ beqzl $a0,.L0f08b4dc -/* f08b4bc: 8ca4001c */ lw $a0,0x1c($a1) -/* f08b4c0: 0fc6675c */ jal aibotTryRemoveAmmoFromReserve -/* f08b4c4: 2405000e */ addiu $a1,$zero,0xe -/* f08b4c8: 44800000 */ mtc1 $zero,$f0 -/* f08b4cc: a20200a9 */ sb $v0,0xa9($s0) -/* f08b4d0: 1000002a */ b .L0f08b57c -/* f08b4d4: 2403ffff */ addiu $v1,$zero,-1 -/* f08b4d8: 8ca4001c */ lw $a0,0x1c($a1) -.L0f08b4dc: -/* f08b4dc: 24010006 */ addiu $at,$zero,0x6 -/* f08b4e0: 3c08800a */ lui $t0,%hi(g_Vars+0x28c) -/* f08b4e4: 908f0000 */ lbu $t7,0x0($a0) -/* f08b4e8: 240a00ff */ addiu $t2,$zero,0xff -/* f08b4ec: 55e10023 */ bnel $t7,$at,.L0f08b57c -/* f08b4f0: a20a00a9 */ sb $t2,0xa9($s0) -/* f08b4f4: 8d08a24c */ lw $t0,%lo(g_Vars+0x28c)($t0) -/* f08b4f8: 0fc4a25f */ jal propGetPlayerNum -/* f08b4fc: afa80030 */ sw $t0,0x30($sp) -/* f08b500: 0fc4a24b */ jal setCurrentPlayerNum -/* f08b504: 00402025 */ or $a0,$v0,$zero -/* f08b508: 2404000e */ addiu $a0,$zero,0xe -/* f08b50c: 0fc2a69d */ jal currentPlayerGetAmmoQuantityForWeapon -/* f08b510: 00002825 */ or $a1,$zero,$zero -/* f08b514: 284100c8 */ slti $at,$v0,0xc8 -/* f08b518: 14200004 */ bnez $at,.L0f08b52c -/* f08b51c: 00403025 */ or $a2,$v0,$zero -/* f08b520: 240900c8 */ addiu $t1,$zero,0xc8 -/* f08b524: 10000002 */ b .L0f08b530 -/* f08b528: a20900a9 */ sb $t1,0xa9($s0) -.L0f08b52c: -/* f08b52c: a20200a9 */ sb $v0,0xa9($s0) -.L0f08b530: -/* f08b530: 24040013 */ addiu $a0,$zero,0x13 -/* f08b534: 0fc41b99 */ jal cheatIsActive -/* f08b538: afa60034 */ sw $a2,0x34($sp) -/* f08b53c: 10400004 */ beqz $v0,.L0f08b550 -/* f08b540: 8fa60034 */ lw $a2,0x34($sp) -/* f08b544: 240b00ff */ addiu $t3,$zero,0xff -/* f08b548: 10000003 */ b .L0f08b558 -/* f08b54c: a20b00a9 */ sb $t3,0xa9($s0) -.L0f08b550: -/* f08b550: 920c00a9 */ lbu $t4,0xa9($s0) -/* f08b554: 00cc3023 */ subu $a2,$a2,$t4 -.L0f08b558: -/* f08b558: 2404000e */ addiu $a0,$zero,0xe -/* f08b55c: 0fc2a6b1 */ jal currentPlayerGiveAmmoForWeapon -/* f08b560: 00002825 */ or $a1,$zero,$zero -/* f08b564: 0fc4a24b */ jal setCurrentPlayerNum -/* f08b568: 8fa40030 */ lw $a0,0x30($sp) -/* f08b56c: 44800000 */ mtc1 $zero,$f0 -/* f08b570: 10000002 */ b .L0f08b57c -/* f08b574: 2403ffff */ addiu $v1,$zero,-1 -/* f08b578: a20a00a9 */ sb $t2,0xa9($s0) -.L0f08b57c: -/* f08b57c: 8fad0094 */ lw $t5,0x94($sp) -/* f08b580: 3c188007 */ lui $t8,%hi(var8006996c) -/* f08b584: 8f18996c */ lw $t8,%lo(var8006996c)($t8) -/* f08b588: 000d7080 */ sll $t6,$t5,0x2 -/* f08b58c: 01cd7023 */ subu $t6,$t6,$t5 -/* f08b590: 000e7080 */ sll $t6,$t6,0x2 -/* f08b594: 01cd7023 */ subu $t6,$t6,$t5 -/* f08b598: 000e7080 */ sll $t6,$t6,0x2 -/* f08b59c: 01d8c821 */ addu $t9,$t6,$t8 -/* f08b5a0: ae19009c */ sw $t9,0x9c($s0) -/* f08b5a4: a3230000 */ sb $v1,0x0($t9) -/* f08b5a8: e6000060 */ swc1 $f0,0x60($s0) -/* f08b5ac: e6000074 */ swc1 $f0,0x74($s0) -/* f08b5b0: e600006c */ swc1 $f0,0x6c($s0) -/* f08b5b4: e6000078 */ swc1 $f0,0x78($s0) -/* f08b5b8: 3c017f1b */ lui $at,%hi(var7f1aae90) -/* f08b5bc: c426ae90 */ lwc1 $f6,%lo(var7f1aae90)($at) -/* f08b5c0: 3c017f1b */ lui $at,%hi(var7f1aae94) -/* f08b5c4: e6060064 */ swc1 $f6,0x64($s0) -/* f08b5c8: c428ae94 */ lwc1 $f8,%lo(var7f1aae94)($at) -/* f08b5cc: 3c017f1b */ lui $at,%hi(var7f1aae98) -/* f08b5d0: e6080068 */ swc1 $f8,0x68($s0) -/* f08b5d4: c42aae98 */ lwc1 $f10,%lo(var7f1aae98)($at) -/* f08b5d8: 3c012108 */ lui $at,0x2108 -/* f08b5dc: e60a0080 */ swc1 $f10,0x80($s0) -/* f08b5e0: 8fa800a0 */ lw $t0,0xa0($sp) -/* f08b5e4: 910b003f */ lbu $t3,0x3f($t0) -/* f08b5e8: 356c0020 */ ori $t4,$t3,0x20 -/* f08b5ec: a10c003f */ sb $t4,0x3f($t0) -/* f08b5f0: 8e0e0008 */ lw $t6,0x8($s0) -/* f08b5f4: 8e0a0040 */ lw $t2,0x40($s0) -/* f08b5f8: 8e190010 */ lw $t9,0x10($s0) -/* f08b5fc: 01c1c025 */ or $t8,$t6,$at -/* f08b600: 3c010801 */ lui $at,0x801 -/* f08b604: 354d0010 */ ori $t5,$t2,0x10 -/* f08b608: 03217825 */ or $t7,$t9,$at -/* f08b60c: ae0d0040 */ sw $t5,0x40($s0) -/* f08b610: ae180008 */ sw $t8,0x8($s0) -/* f08b614: 1000000b */ b .L0f08b644 -/* f08b618: ae0f0010 */ sw $t7,0x10($s0) -.L0f08b61c: -/* f08b61c: 50e00004 */ beqzl $a3,.L0f08b630 -/* f08b620: 8fa900a0 */ lw $t1,0xa0($sp) -/* f08b624: 0fc2cc33 */ jal modelFree -/* f08b628: 00e02025 */ or $a0,$a3,$zero -/* f08b62c: 8fa900a0 */ lw $t1,0xa0($sp) -.L0f08b630: -/* f08b630: 51200004 */ beqzl $t1,.L0f08b644 -/* f08b634: 00008025 */ or $s0,$zero,$zero -/* f08b638: 0fc1810e */ jal propFree -/* f08b63c: 01202025 */ or $a0,$t1,$zero -/* f08b640: 00008025 */ or $s0,$zero,$zero -.L0f08b644: -/* f08b644: 8fbf0024 */ lw $ra,0x24($sp) -.L0f08b648: -/* f08b648: 02001025 */ or $v0,$s0,$zero -/* f08b64c: 8fb00020 */ lw $s0,0x20($sp) -/* f08b650: 03e00008 */ jr $ra -/* f08b654: 27bd00a8 */ addiu $sp,$sp,0xa8 -); -#else -GLOBAL_ASM( -glabel func0f08b27c -.late_rodata -glabel var7f1aae8c -.word 0x459c4000 -glabel var7f1aae90 -.word 0x4148f5c3 -glabel var7f1aae94 -.word 0xc148f5c3 -glabel var7f1aae98 -.word 0x3d8ebee0 -.text -/* f08b27c: 27bdff58 */ addiu $sp,$sp,-168 -/* f08b280: 3c0e800a */ lui $t6,%hi(g_Vars+0x318) -/* f08b284: 8dcea2d8 */ lw $t6,%lo(g_Vars+0x318)($t6) -/* f08b288: afb00020 */ sw $s0,0x20($sp) -/* f08b28c: afbf0024 */ sw $ra,0x24($sp) -/* f08b290: afa400a8 */ sw $a0,0xa8($sp) -/* f08b294: afa500ac */ sw $a1,0xac($sp) -/* f08b298: afa600b0 */ sw $a2,0xb0($sp) -/* f08b29c: 11c00005 */ beqz $t6,.L0f08b2b4 -/* f08b2a0: 00008025 */ or $s0,$zero,$zero -/* f08b2a4: 0fc633fe */ jal mpPlayerGetIndex -/* f08b2a8: 00c02025 */ or $a0,$a2,$zero -/* f08b2ac: 10000005 */ b .L0f08b2c4 -/* f08b2b0: afa20094 */ sw $v0,0x94($sp) -.L0f08b2b4: -/* f08b2b4: 8faf00b0 */ lw $t7,0xb0($sp) -/* f08b2b8: 0fc4a25f */ jal propGetPlayerNum -/* f08b2bc: 8de4001c */ lw $a0,0x1c($t7) -/* f08b2c0: afa20094 */ sw $v0,0x94($sp) -.L0f08b2c4: -/* f08b2c4: 044000df */ bltz $v0,.L0f08b644 -/* f08b2c8: 3c188007 */ lui $t8,%hi(g_MaxThrownLaptops) -/* f08b2cc: 8f189970 */ lw $t8,%lo(g_MaxThrownLaptops)($t8) -/* f08b2d0: 0058082a */ slt $at,$v0,$t8 -/* f08b2d4: 502000dc */ beqzl $at,.L0f08b648 -/* f08b2d8: 8fbf0024 */ lw $ra,0x24($sp) -/* f08b2dc: 0fc2486d */ jal modelLoad -/* f08b2e0: 8fa400a8 */ lw $a0,0xa8($sp) -/* f08b2e4: 8faa0094 */ lw $t2,0x94($sp) -/* f08b2e8: 8fb900a8 */ lw $t9,0xa8($sp) -/* f08b2ec: 3c098008 */ lui $t1,%hi(g_ModelStates) -/* f08b2f0: 000a5880 */ sll $t3,$t2,0x2 -/* f08b2f4: 016a5823 */ subu $t3,$t3,$t2 -/* f08b2f8: 000b5880 */ sll $t3,$t3,0x2 -/* f08b2fc: 001940c0 */ sll $t0,$t9,0x3 -/* f08b300: 01284821 */ addu $t1,$t1,$t0 -/* f08b304: 3c0c8007 */ lui $t4,%hi(g_ThrownLaptops) -/* f08b308: 016a5823 */ subu $t3,$t3,$t2 -/* f08b30c: 8d29b06c */ lw $t1,%lo(g_ModelStates)($t1) -/* f08b310: 8d8c9968 */ lw $t4,%lo(g_ThrownLaptops)($t4) -/* f08b314: 000b5880 */ sll $t3,$t3,0x2 -/* f08b318: 016a5823 */ subu $t3,$t3,$t2 -/* f08b31c: 000b5880 */ sll $t3,$t3,0x2 -/* f08b320: afa900a4 */ sw $t1,0xa4($sp) -/* f08b324: 016c8021 */ addu $s0,$t3,$t4 -/* f08b328: 8e030014 */ lw $v1,0x14($s0) -/* f08b32c: 00002025 */ or $a0,$zero,$zero -/* f08b330: 24070003 */ addiu $a3,$zero,0x3 -/* f08b334: 10600007 */ beqz $v1,.L0f08b354 -/* f08b338: 24650008 */ addiu $a1,$v1,0x8 -/* f08b33c: 24660028 */ addiu $a2,$v1,0x28 -/* f08b340: 0fc4a640 */ jal explosionCreateSimple -/* f08b344: afaa0010 */ sw $t2,0x10($sp) -/* f08b348: 02002025 */ or $a0,$s0,$zero -/* f08b34c: 0fc1acd3 */ jal func0f06b34c -/* f08b350: 24050001 */ addiu $a1,$zero,0x1 -.L0f08b354: -/* f08b354: 0fc180d6 */ jal propAllocate -/* f08b358: 00000000 */ nop -/* f08b35c: afa200a0 */ sw $v0,0xa0($sp) -/* f08b360: 0fc2cc2b */ jal modelInstantiate -/* f08b364: 8fa400a4 */ lw $a0,0xa4($sp) -/* f08b368: 8fad00a0 */ lw $t5,0xa0($sp) -/* f08b36c: 00403825 */ or $a3,$v0,$zero -/* f08b370: 15a00005 */ bnez $t5,.L0f08b388 -/* f08b374: 00000000 */ nop -/* f08b378: 0fc180d6 */ jal propAllocate -/* f08b37c: afa2009c */ sw $v0,0x9c($sp) -/* f08b380: 8fa7009c */ lw $a3,0x9c($sp) -/* f08b384: afa200a0 */ sw $v0,0xa0($sp) -.L0f08b388: -/* f08b388: 14e00004 */ bnez $a3,.L0f08b39c -/* f08b38c: 00000000 */ nop -/* f08b390: 0fc2cc2b */ jal modelInstantiate -/* f08b394: 8fa400a4 */ lw $a0,0xa4($sp) -/* f08b398: 00403825 */ or $a3,$v0,$zero -.L0f08b39c: -/* f08b39c: 1200009f */ beqz $s0,.L0f08b61c -/* f08b3a0: 8fae00a0 */ lw $t6,0xa0($sp) -/* f08b3a4: 11c0009d */ beqz $t6,.L0f08b61c -/* f08b3a8: 00000000 */ nop -/* f08b3ac: 10e0009b */ beqz $a3,.L0f08b61c -/* f08b3b0: 27a20038 */ addiu $v0,$sp,0x38 -/* f08b3b4: 3c0f8007 */ lui $t7,%hi(var8006acc8) -/* f08b3b8: 25efacc8 */ addiu $t7,$t7,%lo(var8006acc8) -/* f08b3bc: 25f90054 */ addiu $t9,$t7,0x54 -/* f08b3c0: 00404025 */ or $t0,$v0,$zero -.L0f08b3c4: -/* f08b3c4: 8de10000 */ lw $at,0x0($t7) -/* f08b3c8: 25ef000c */ addiu $t7,$t7,0xc -/* f08b3cc: 2508000c */ addiu $t0,$t0,0xc -/* f08b3d0: ad01fff4 */ sw $at,-0xc($t0) -/* f08b3d4: 8de1fff8 */ lw $at,-0x8($t7) -/* f08b3d8: ad01fff8 */ sw $at,-0x8($t0) -/* f08b3dc: 8de1fffc */ lw $at,-0x4($t7) -/* f08b3e0: 15f9fff8 */ bne $t7,$t9,.L0f08b3c4 -/* f08b3e4: ad01fffc */ sw $at,-0x4($t0) -/* f08b3e8: 8de10000 */ lw $at,0x0($t7) -/* f08b3ec: 00406025 */ or $t4,$v0,$zero -/* f08b3f0: 02005025 */ or $t2,$s0,$zero -/* f08b3f4: ad010000 */ sw $at,0x0($t0) -/* f08b3f8: 8df90004 */ lw $t9,0x4($t7) -/* f08b3fc: 244b0054 */ addiu $t3,$v0,0x54 -/* f08b400: ad190004 */ sw $t9,0x4($t0) -.L0f08b404: -/* f08b404: 8d810000 */ lw $at,0x0($t4) -/* f08b408: 258c000c */ addiu $t4,$t4,0xc -/* f08b40c: 254a000c */ addiu $t2,$t2,0xc -/* f08b410: ad41fff4 */ sw $at,-0xc($t2) -/* f08b414: 8d81fff8 */ lw $at,-0x8($t4) -/* f08b418: ad41fff8 */ sw $at,-0x8($t2) -/* f08b41c: 8d81fffc */ lw $at,-0x4($t4) -/* f08b420: 158bfff8 */ bne $t4,$t3,.L0f08b404 -/* f08b424: ad41fffc */ sw $at,-0x4($t2) -/* f08b428: 8d810000 */ lw $at,0x0($t4) -/* f08b42c: 02002025 */ or $a0,$s0,$zero -/* f08b430: ad410000 */ sw $at,0x0($t2) -/* f08b434: 8d8b0004 */ lw $t3,0x4($t4) -/* f08b438: ad4b0004 */ sw $t3,0x4($t2) -/* f08b43c: 8fad00a8 */ lw $t5,0xa8($sp) -/* f08b440: a60d0004 */ sh $t5,0x4($s0) -/* f08b444: 8fa600a0 */ lw $a2,0xa0($sp) -/* f08b448: 0fc1a87b */ jal func0f06a1ec -/* f08b44c: 8fa500a4 */ lw $a1,0xa4($sp) -/* f08b450: 8fa500b0 */ lw $a1,0xb0($sp) -/* f08b454: 2403ffff */ addiu $v1,$zero,-1 -/* f08b458: afa200a0 */ sw $v0,0xa0($sp) -/* f08b45c: a603005c */ sh $v1,0x5c($s0) -/* f08b460: 3c017f1b */ lui $at,%hi(var7f1aae8c) -/* f08b464: c424ae8c */ lwc1 $f4,%lo(var7f1aae8c)($at) -/* f08b468: ae0000a4 */ sw $zero,0xa4($s0) -/* f08b46c: 44800000 */ mtc1 $zero,$f0 -/* f08b470: e6040084 */ swc1 $f4,0x84($s0) -/* f08b474: 90ae0125 */ lbu $t6,0x125($a1) -/* f08b478: a60000aa */ sh $zero,0xaa($s0) -/* f08b47c: a200005f */ sb $zero,0x5f($s0) -/* f08b480: 01c0c827 */ nor $t9,$t6,$zero -/* f08b484: a21900a8 */ sb $t9,0xa8($s0) -/* f08b488: ae030090 */ sw $v1,0x90($s0) -/* f08b48c: ae030094 */ sw $v1,0x94($s0) -/* f08b490: ae030098 */ sw $v1,0x98($s0) -/* f08b494: a200005e */ sb $zero,0x5e($s0) -/* f08b498: e6000070 */ swc1 $f0,0x70($s0) -/* f08b49c: e600007c */ swc1 $f0,0x7c($s0) -/* f08b4a0: e6000088 */ swc1 $f0,0x88($s0) -/* f08b4a4: e600008c */ swc1 $f0,0x8c($s0) -/* f08b4a8: e60000a0 */ swc1 $f0,0xa0($s0) -/* f08b4ac: 8ca402d4 */ lw $a0,0x2d4($a1) -/* f08b4b0: 00003025 */ or $a2,$zero,$zero -/* f08b4b4: 240700c8 */ addiu $a3,$zero,0xc8 -/* f08b4b8: 50800008 */ beqzl $a0,.L0f08b4dc -/* f08b4bc: 8ca4001c */ lw $a0,0x1c($a1) -/* f08b4c0: 0fc6675c */ jal aibotTryRemoveAmmoFromReserve -/* f08b4c4: 2405000e */ addiu $a1,$zero,0xe -/* f08b4c8: 44800000 */ mtc1 $zero,$f0 -/* f08b4cc: a20200a9 */ sb $v0,0xa9($s0) -/* f08b4d0: 1000002a */ b .L0f08b57c -/* f08b4d4: 2403ffff */ addiu $v1,$zero,-1 -/* f08b4d8: 8ca4001c */ lw $a0,0x1c($a1) -.L0f08b4dc: -/* f08b4dc: 24010006 */ addiu $at,$zero,0x6 -/* f08b4e0: 3c08800a */ lui $t0,%hi(g_Vars+0x28c) -/* f08b4e4: 908f0000 */ lbu $t7,0x0($a0) -/* f08b4e8: 240a00ff */ addiu $t2,$zero,0xff -/* f08b4ec: 55e10023 */ bnel $t7,$at,.L0f08b57c -/* f08b4f0: a20a00a9 */ sb $t2,0xa9($s0) -/* f08b4f4: 8d08a24c */ lw $t0,%lo(g_Vars+0x28c)($t0) -/* f08b4f8: 0fc4a25f */ jal propGetPlayerNum -/* f08b4fc: afa80030 */ sw $t0,0x30($sp) -/* f08b500: 0fc4a24b */ jal setCurrentPlayerNum -/* f08b504: 00402025 */ or $a0,$v0,$zero -/* f08b508: 2404000e */ addiu $a0,$zero,0xe -/* f08b50c: 0fc2a69d */ jal currentPlayerGetAmmoQuantityForWeapon -/* f08b510: 00002825 */ or $a1,$zero,$zero -/* f08b514: 284100c8 */ slti $at,$v0,0xc8 -/* f08b518: 14200004 */ bnez $at,.L0f08b52c -/* f08b51c: 00403025 */ or $a2,$v0,$zero -/* f08b520: 240900c8 */ addiu $t1,$zero,0xc8 -/* f08b524: 10000002 */ b .L0f08b530 -/* f08b528: a20900a9 */ sb $t1,0xa9($s0) -.L0f08b52c: -/* f08b52c: a20200a9 */ sb $v0,0xa9($s0) -.L0f08b530: -/* f08b530: 24040013 */ addiu $a0,$zero,0x13 -/* f08b534: 0fc41b99 */ jal cheatIsActive -/* f08b538: afa60034 */ sw $a2,0x34($sp) -/* f08b53c: 10400004 */ beqz $v0,.L0f08b550 -/* f08b540: 8fa60034 */ lw $a2,0x34($sp) -/* f08b544: 240b00ff */ addiu $t3,$zero,0xff -/* f08b548: 10000003 */ b .L0f08b558 -/* f08b54c: a20b00a9 */ sb $t3,0xa9($s0) -.L0f08b550: -/* f08b550: 920c00a9 */ lbu $t4,0xa9($s0) -/* f08b554: 00cc3023 */ subu $a2,$a2,$t4 -.L0f08b558: -/* f08b558: 2404000e */ addiu $a0,$zero,0xe -/* f08b55c: 0fc2a6b1 */ jal currentPlayerGiveAmmoForWeapon -/* f08b560: 00002825 */ or $a1,$zero,$zero -/* f08b564: 0fc4a24b */ jal setCurrentPlayerNum -/* f08b568: 8fa40030 */ lw $a0,0x30($sp) -/* f08b56c: 44800000 */ mtc1 $zero,$f0 -/* f08b570: 10000002 */ b .L0f08b57c -/* f08b574: 2403ffff */ addiu $v1,$zero,-1 -/* f08b578: a20a00a9 */ sb $t2,0xa9($s0) -.L0f08b57c: -/* f08b57c: 8fad0094 */ lw $t5,0x94($sp) -/* f08b580: 3c188007 */ lui $t8,%hi(var8006996c) -/* f08b584: 8f18996c */ lw $t8,%lo(var8006996c)($t8) -/* f08b588: 000d7080 */ sll $t6,$t5,0x2 -/* f08b58c: 01cd7023 */ subu $t6,$t6,$t5 -/* f08b590: 000e7080 */ sll $t6,$t6,0x2 -/* f08b594: 01cd7023 */ subu $t6,$t6,$t5 -/* f08b598: 000e7080 */ sll $t6,$t6,0x2 -/* f08b59c: 01d8c821 */ addu $t9,$t6,$t8 -/* f08b5a0: ae19009c */ sw $t9,0x9c($s0) -/* f08b5a4: a3230000 */ sb $v1,0x0($t9) -/* f08b5a8: e6000060 */ swc1 $f0,0x60($s0) -/* f08b5ac: e6000074 */ swc1 $f0,0x74($s0) -/* f08b5b0: e600006c */ swc1 $f0,0x6c($s0) -/* f08b5b4: e6000078 */ swc1 $f0,0x78($s0) -/* f08b5b8: 3c017f1b */ lui $at,%hi(var7f1aae90) -/* f08b5bc: c426ae90 */ lwc1 $f6,%lo(var7f1aae90)($at) -/* f08b5c0: 3c017f1b */ lui $at,%hi(var7f1aae94) -/* f08b5c4: e6060064 */ swc1 $f6,0x64($s0) -/* f08b5c8: c428ae94 */ lwc1 $f8,%lo(var7f1aae94)($at) -/* f08b5cc: 3c017f1b */ lui $at,%hi(var7f1aae98) -/* f08b5d0: e6080068 */ swc1 $f8,0x68($s0) -/* f08b5d4: c42aae98 */ lwc1 $f10,%lo(var7f1aae98)($at) -/* f08b5d8: 3c012108 */ lui $at,0x2108 -/* f08b5dc: e60a0080 */ swc1 $f10,0x80($s0) -/* f08b5e0: 8fa800a0 */ lw $t0,0xa0($sp) -/* f08b5e4: 910b003f */ lbu $t3,0x3f($t0) -/* f08b5e8: 356c0020 */ ori $t4,$t3,0x20 -/* f08b5ec: a10c003f */ sb $t4,0x3f($t0) -/* f08b5f0: 8e0e0008 */ lw $t6,0x8($s0) -/* f08b5f4: 8e0a0040 */ lw $t2,0x40($s0) -/* f08b5f8: 8e190010 */ lw $t9,0x10($s0) -/* f08b5fc: 01c1c025 */ or $t8,$t6,$at -/* f08b600: 3c010801 */ lui $at,0x801 -/* f08b604: 354d0010 */ ori $t5,$t2,0x10 -/* f08b608: 03217825 */ or $t7,$t9,$at -/* f08b60c: ae0d0040 */ sw $t5,0x40($s0) -/* f08b610: ae180008 */ sw $t8,0x8($s0) -/* f08b614: 1000000b */ b .L0f08b644 -/* f08b618: ae0f0010 */ sw $t7,0x10($s0) -.L0f08b61c: -/* f08b61c: 50e00004 */ beqzl $a3,.L0f08b630 -/* f08b620: 8fa900a0 */ lw $t1,0xa0($sp) -/* f08b624: 0fc2cc33 */ jal modelFree -/* f08b628: 00e02025 */ or $a0,$a3,$zero -/* f08b62c: 8fa900a0 */ lw $t1,0xa0($sp) -.L0f08b630: -/* f08b630: 51200004 */ beqzl $t1,.L0f08b644 -/* f08b634: 00008025 */ or $s0,$zero,$zero -/* f08b638: 0fc1810e */ jal propFree -/* f08b63c: 01202025 */ or $a0,$t1,$zero -/* f08b640: 00008025 */ or $s0,$zero,$zero -.L0f08b644: -/* f08b644: 8fbf0024 */ lw $ra,0x24($sp) -.L0f08b648: -/* f08b648: 02001025 */ or $v0,$s0,$zero -/* f08b64c: 8fb00020 */ lw $s0,0x20($sp) -/* f08b650: 03e00008 */ jr $ra -/* f08b654: 27bd00a8 */ addiu $sp,$sp,0xa8 -); -#endif +struct autogunobj *laptopDeploy(s32 modelnum, struct gset *gset, struct chrdata *chr) +{ + struct modelfiledata *filedata; + struct prop *prop; + struct model *model; + struct autogunobj *laptop = NULL; + s32 index; + + if (g_Vars.normmplayerisrunning) { + index = mpPlayerGetIndex(chr); + } else { + index = propGetPlayerNum(chr->prop); + } + + if (index >= 0 && index < g_MaxThrownLaptops) { + modelLoad(modelnum); + filedata = g_ModelStates[modelnum].filedata; + laptop = &g_ThrownLaptops[index]; + + if (laptop->base.prop) { + explosionCreateSimple(NULL, &laptop->base.prop->pos, laptop->base.prop->rooms, EXPLOSIONTYPE_3, index); + func0f06b34c(laptop, true); + } + + prop = propAllocate(); + model = modelInstantiate(filedata); + + if (prop == NULL) { + prop = propAllocate(); + } + + if (model == NULL) { + model = modelInstantiate(filedata); + } + + if (laptop && prop && model) { + struct defaultobj tmp = { + 256, // extrascale + 0, // hidden2 + OBJTYPE_AUTOGUN, // type + 0, // modelnum + 1, // pad + 0, // 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 + }; + + laptop->base = tmp; + laptop->base.modelnum = modelnum; + + prop = func0f06a1ec(&laptop->base, filedata, prop, model); + + laptop->targetpad = -1; + laptop->aimdist = 5000; + laptop->unka4 = 0; + laptop->targetteam = ~chr->team & 0xff; + laptop->nextchrtest = 0; + laptop->firecount = 0; + laptop->lastseebond60 = -1; + laptop->lastaimbond60 = -1; + laptop->allowsoundframe = -1; + laptop->firing = false; + laptop->yspeed = 0; + laptop->xspeed = 0; + laptop->barrelspeed = 0; + laptop->barrelrot = 0; + laptop->shotbondsum = 0; + + if (chr->aibot) { + laptop->ammoquantity = aibotTryRemoveAmmoFromReserve(chr->aibot, WEAPON_LAPTOPGUN, FUNC_PRIMARY, 200); + } else if (chr->prop->type == PROPTYPE_PLAYER) { + s32 qty; + s32 prevplayernum = g_Vars.currentplayernum; + + setCurrentPlayerNum(propGetPlayerNum(chr->prop)); + qty = currentPlayerGetAmmoQuantityForWeapon(WEAPON_LAPTOPGUN, FUNC_PRIMARY); + + if (qty >= 200) { + laptop->ammoquantity = 200; + } else { + laptop->ammoquantity = qty; + } + + if (cheatIsActive(CHEAT_UNLIMITEDAMMOLAPTOP)) { + laptop->ammoquantity = 255; + } else { + qty -= laptop->ammoquantity; + } + + currentPlayerSetAmmoQtyForWeapon(WEAPON_LAPTOPGUN, FUNC_PRIMARY, qty); + setCurrentPlayerNum(prevplayernum); + } else { + laptop->ammoquantity = 255; + } + + laptop->beam = &g_ThrownLaptopBeams[index]; + laptop->beam->age = -1; + laptop->yzero = 0; + laptop->xzero = 0; + laptop->yrot = 0; + laptop->xrot = 0; + laptop->ymaxleft = 12.56f; + laptop->ymaxright = -12.56f; + laptop->maxspeed = PALUPF(0.0697f); + + prop->unk3f_02 = true; + + laptop->base.hidden |= OBJHFLAG_TAGGED; + laptop->base.flags |= OBJFLAG_00080000 | OBJFLAG_01000000 | OBJFLAG_20000000; + laptop->base.flags3 |= OBJFLAG3_00010000 | OBJFLAG3_08000000; + } else { + if (model) { + modelFree(model); + } + + if (prop) { + propFree(prop); + } + + laptop = NULL; + } + } + + return laptop; +} #if VERSION >= VERSION_NTSC_1_0 GLOBAL_ASM( @@ -66582,29 +66164,6 @@ glabel var7f1aaf24 ); #endif -u32 var8006acc8 = 0x0100000d; -u32 var8006accc = 0x00000001; -u32 var8006acd0 = 0x00000000; -u32 var8006acd4 = 0x00000000; -u32 var8006acd8 = 0x00000000; -u32 var8006acdc = 0x00000000; -u32 var8006ace0 = 0x00000000; -u32 var8006ace4 = 0x3f800000; -u32 var8006ace8 = 0x00000000; -u32 var8006acec = 0x00000000; -u32 var8006acf0 = 0x00000000; -u32 var8006acf4 = 0x3f800000; -u32 var8006acf8 = 0x00000000; -u32 var8006acfc = 0x00000000; -u32 var8006ad00 = 0x00000000; -u32 var8006ad04 = 0x3f800000; -u32 var8006ad08 = 0x00000000; -u32 var8006ad0c = 0x00000000; -u32 var8006ad10 = 0x00000000; -u32 var8006ad14 = 0x000003e8; -u32 var8006ad18 = 0xffffff00; -u32 var8006ad1c = 0xffffff00; -u32 var8006ad20 = 0x0fff0000; u32 var8006ad24 = 0x01000008; u32 var8006ad28 = 0x0000ffff; u32 var8006ad2c = 0x00000001; diff --git a/src/include/data.h b/src/include/data.h index 5c297d7df..7a03636cb 100644 --- a/src/include/data.h +++ b/src/include/data.h @@ -254,7 +254,7 @@ extern f32 g_AmmoMultiplier; extern struct padeffectobj *var80069960; extern s32 var80069964; extern struct autogunobj *g_ThrownLaptops; -extern struct var8006996c *var8006996c; +extern struct beam *g_ThrownLaptopBeams; extern s32 g_MaxThrownLaptops; extern struct prop *g_Lifts[MAX_LIFTS]; extern u32 g_TvCmdlist00[]; diff --git a/src/include/game/game_097ba0.h b/src/include/game/game_097ba0.h index a2624d6ef..ca21e0094 100644 --- a/src/include/game/game_097ba0.h +++ b/src/include/game/game_097ba0.h @@ -71,7 +71,7 @@ bool func0f09eae4(void); s32 func0f09ebbc(void); void func0f09ebcc(struct defaultobj *obj, struct coord *coord, s16 *rooms, Mtxf *matrix1, f32 *arg4, Mtxf *matrix2, struct prop *prop, struct coord *pos); void func0f09ed2c(struct defaultobj *obj, struct coord *coord, Mtxf *arg2, f32 *arg3, Mtxf *arg4); -struct weaponobj *func0f09ee18(struct chrdata *chr, struct gset *gset, struct coord *pos, s16 *rooms, Mtxf *arg4, struct coord *arg5); +struct defaultobj *func0f09ee18(struct chrdata *chr, struct gset *gset, struct coord *pos, s16 *rooms, Mtxf *arg4, struct coord *arg5); void handCreateThrownProjectile(s32 handnum, struct gset *gset); void func0f09f848(s32 handnum); void func0f09f974(s32 handnum, struct weaponfunc_shootprojectile *func); @@ -160,7 +160,7 @@ bool ammotypeAllowsUnlimitedAmmo(u32 ammotype); void currentPlayerGiveUnlimitedAmmo(bool force); u32 weaponGetAmmoType(u32 weaponnum, u32 func); s32 currentPlayerGetAmmoQuantityForWeapon(u32 weaponnum, u32 func); -void currentPlayerGiveAmmoForWeapon(u32 weaponnum, u32 func, u32 quantity); +void currentPlayerSetAmmoQtyForWeapon(u32 weaponnum, u32 func, u32 quantity); s32 weaponGetAmmoCapacity(s32 weaponnum, s32 func); Gfx *handRenderHudString(Gfx *gdl, char *text, s32 x, bool halign, s32 y, s32 valign, u32 colour); Gfx *handRenderHudInteger(Gfx *gdl, s32 value, s32 x, bool halign, s32 y, s32 valign, u32 colour); diff --git a/src/include/game/propobj.h b/src/include/game/propobj.h index 1b95663b7..8040abad0 100644 --- a/src/include/game/propobj.h +++ b/src/include/game/propobj.h @@ -14,7 +14,7 @@ extern f32 var8006994c; extern f32 var80069950; extern f32 var80069954; extern f32 var80069958; -extern struct var8006996c *var8006996c; +extern struct beam *g_ThrownLaptopBeams; void alarmActivate(void); void alarmDeactivate(void); @@ -285,7 +285,7 @@ u32 func0f08ae54(struct defaultobj *obj, struct chrdata *chr); 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 autogunobj *laptopDeploy(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); diff --git a/src/include/types.h b/src/include/types.h index 5507688d0..50bc37131 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -1770,6 +1770,7 @@ struct autogunobj { // objtype 0x0d /*0xa4*/ u32 unka4; /*0xa8*/ u8 targetteam; /*0xa9*/ u8 ammoquantity; + /*0xaa*/ u16 nextchrtest; }; struct linkgunsobj { // objtype 0x0e @@ -6785,20 +6786,6 @@ struct var8009ce60 { /*0x5c*/ u32 unk5c; }; -struct var8006996c { - /*0x00*/ u32 unk00; - /*0x04*/ u32 unk04; - /*0x08*/ u32 unk08; - /*0x0c*/ u32 unk0c; - /*0x10*/ u32 unk10; - /*0x14*/ u32 unk14; - /*0x18*/ u32 unk18; - /*0x1c*/ u32 unk1c; - /*0x20*/ u32 unk20; - /*0x24*/ u32 unk24; - /*0x28*/ u32 unk28; -}; - struct nbomb { struct coord pos; s32 age240;