Introduce base weaponfunc_shoot struct and make single/auto/projectile extend it

This commit is contained in:
Ryan Dwyer
2021-04-06 00:28:33 +10:00
parent 04ec4d57a0
commit f6a9b44dae
6 changed files with 230 additions and 219 deletions
+3 -3
View File
@@ -10501,7 +10501,7 @@ s32 func0f09bc2c(struct handweaponinfo *info, s32 handnum, struct hand *hand, s3
if (func != NULL) {
switch (func->type & 0xff) {
case INVENTORYFUNCTYPE_SHOOT_SINGLE:
case INVENTORYFUNCTYPE_SHOOT:
doit = func0f09afe4(info, handnum, hand);
break;
case INVENTORYFUNCTYPE_THROW:
@@ -21740,8 +21740,8 @@ void handCalculateShotSpread(struct coord *arg0, struct coord *arg1, s32 handnum
struct weaponfunc *func = currentPlayerGetWeaponFunction(handnum);
struct player *player = g_Vars.currentplayer;
if (func != NULL && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT_SINGLE) {
struct weaponfunc_shootsingle *shootfunc = (struct weaponfunc_shootsingle *) func;
if (func != NULL && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) {
struct weaponfunc_shoot *shootfunc = (struct weaponfunc_shoot *) func;
spread = shootfunc->spread;
}
+12 -12
View File
@@ -528,8 +528,8 @@ u8 handGetSingleUnk3c(struct shorthand *hand)
{
struct weaponfunc *func = handGetWeaponFunction(hand);
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT_SINGLE) {
struct weaponfunc_shootsingle *funcshoot = (struct weaponfunc_shootsingle *)func;
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) {
struct weaponfunc_shoot *funcshoot = (struct weaponfunc_shoot *)func;
return funcshoot->unk3c;
}
@@ -553,8 +553,8 @@ f32 handGetSingleUnk34(struct shorthand *hand)
struct weaponfunc *func = handGetWeaponFunction(hand);
f32 result = 0;
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT_SINGLE) {
struct weaponfunc_shootsingle *funcshoot = (struct weaponfunc_shootsingle *)func;
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) {
struct weaponfunc_shoot *funcshoot = (struct weaponfunc_shoot *)func;
result = funcshoot->unk34;
}
@@ -567,8 +567,8 @@ f32 handGetDamage(struct shorthand *hand)
f32 damage = 0;
if (func) {
if ((func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT_SINGLE) {
struct weaponfunc_shootsingle *fullfunc = (struct weaponfunc_shootsingle *)func;
if ((func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) {
struct weaponfunc_shoot *fullfunc = (struct weaponfunc_shoot *)func;
damage = fullfunc->damage;
}
@@ -608,8 +608,8 @@ u8 handGetSingleUnk38(struct shorthand *hand)
struct weaponfunc *func = handGetWeaponFunction(hand);
u8 result = 0;
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT_SINGLE) {
struct weaponfunc_shootsingle *funcshoot = (struct weaponfunc_shootsingle *)func;
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) {
struct weaponfunc_shoot *funcshoot = (struct weaponfunc_shoot *)func;
result = funcshoot->unk38;
}
@@ -621,8 +621,8 @@ u8 handGetSingleUnk38(struct shorthand *hand)
#else
struct weaponfunc *func = handGetWeaponFunction(hand);
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT_SINGLE) {
struct weaponfunc_shootsingle *funcshoot = (struct weaponfunc_shootsingle *)func;
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) {
struct weaponfunc_shoot *funcshoot = (struct weaponfunc_shoot *)func;
return funcshoot->unk38;
}
@@ -634,8 +634,8 @@ u16 handGetSingleShootSound(struct shorthand *hand)
{
struct weaponfunc *func = handGetWeaponFunction(hand);
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT_SINGLE) {
struct weaponfunc_shootsingle *funcshoot = (struct weaponfunc_shootsingle *)func;
if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) {
struct weaponfunc_shoot *funcshoot = (struct weaponfunc_shoot *)func;
return funcshoot->shootsound;
}
+3 -3
View File
@@ -421,13 +421,13 @@ s32 func0f19a60c(s32 weaponnum, s32 funcnum)
if (func) {
if (func->type == INVENTORYFUNCTYPE_SHOOT_SINGLE) {
struct weaponfunc_shootsingle *func2 = (struct weaponfunc_shootsingle *)func;
struct weaponfunc_shoot *func2 = (struct weaponfunc_shoot *)func;
iVar4 = func2->unk24 + func2->unk25;
} else if (func->type == INVENTORYFUNCTYPE_SHOOT_AUTOMATIC) {
struct weaponfunc_shootauto *func2 = (struct weaponfunc_shootauto *)func;
struct weaponfunc_shoot *func2 = (struct weaponfunc_shoot *)func;
iVar4 = func2->unk24 + func2->unk25;
} else if (func->type == INVENTORYFUNCTYPE_SHOOT_PROJECTILE) {
struct weaponfunc_shootprojectile *func2 = (struct weaponfunc_shootprojectile *)func;
struct weaponfunc_shoot *func2 = (struct weaponfunc_shoot *)func;
iVar4 = func2->unk24 + func2->unk25;
} else if (func->type == INVENTORYFUNCTYPE_CLOSE && weaponnum != WEAPON_REAPER) {
iVar4 = 60;
+204 -170
View File
@@ -1294,15 +1294,16 @@ struct weaponfunc_shootauto invfunc_cmp150_rapidfire = {
0x00000000, // flags
&invmenupos_00011098,
0x00000000,
0x3f800000,
0x41100000,
1, // damage
9, // spread
6, 18, 0, 6,
0x40800000,
0x40400000,
0x00000000,
0x00000000,
0x03008040,
0x01000000,
0,
3,
0x8040,
1,
900,
900,
NULL,
@@ -1320,15 +1321,16 @@ struct weaponfunc_shootauto invfunc_cmp150_followlockon = {
0x00000000, // flags
&invmenupos_00011098,
0x00000000,
0x3f800000,
0x41100000,
1, // damage
9, // spread
6, 18, 0, 6,
0x40800000,
0x40400000,
0x00000000,
0x00000000,
0x03008040,
0x01000000,
0,
3,
0x8040,
1,
900,
900,
NULL,
@@ -1418,15 +1420,16 @@ struct weaponfunc_shootauto invfunc_cyclone_rapidfire = {
0x00000000, // flags
&invmenupos_00011098,
0x00000000,
0x3f4ccccd,
0x40c00000,
0.8, // damage
6, // spread
6, 18, 2, 8,
0x40a00000,
0x40000000,
0x00000000,
0x40800000,
0x0400805f,
0x01000000,
4,
4,
0x805f,
1,
900,
900,
NULL,
@@ -1444,15 +1447,16 @@ struct weaponfunc_shootauto invfunc_cyclone_magazinedischarge = {
0x00000020, // flags
&invmenupos_00011098,
0x00000000,
0x3fb33333,
0x41c80000,
1.4, // damage
25, // spread
6, 18, 2, 8,
0x40a00000,
0x40000000,
0x00000000,
0x40800000,
0x04008075,
0x01000000,
4,
4,
0x8075,
1,
2000,
2000,
NULL,
@@ -1534,15 +1538,16 @@ struct weaponfunc_shootauto invfunc_rcp120_rapidfire = {
0x00000000, // flags
&invmenupos_00011098,
0x00000000,
0x3f99999a,
0x40c00000,
1.2, // damage
6, // spread
6, 18, 0, 6,
0x40800000,
0x40400000,
0x00000000,
0x00000000,
0x0400806d,
0x01000000,
0,
4,
0x806d,
1,
1100,
1100,
NULL,
@@ -1632,15 +1637,16 @@ struct weaponfunc_shootauto invfunc_callisto_rapidfire = {
0x00000000, // flags
&invmenupos_00011098,
0x00000000,
0x3f99999a,
0x41100000,
1.2, // damage
9, // spread
6, 18, 0, 6,
0x40800000,
0x40400000,
0x00000000,
0x00000000,
0x03008063,
0x01000000,
0,
3,
0x8063,
1,
900,
900,
NULL,
@@ -1658,15 +1664,16 @@ struct weaponfunc_shootauto invfunc_callisto_highimpactshells = {
0x00000000, // flags
&invmenupos_00011098,
0x00000000,
0x4019999a,
0x41100000,
2.4, // damage
9, // spread
6, 18, 0, 6,
0x40800000,
0x40400000,
0x00000000,
0x00000000,
0x03008064,
0x05000000,
0,
3,
0x8064,
5,
300,
300,
NULL,
@@ -1745,15 +1752,16 @@ struct weaponfunc_shootauto invfunc_dragon_rapidfire = {
0x00000000, // flags
&invmenupos_00011098,
0x00000000,
0x3f8ccccd,
0x40c00000,
1.1, // damage
6, // spread
6, 18, 2, 8,
0x40a00000,
0x40000000,
0x00000000,
0x40800000,
0x04008049,
0x01000000,
4,
4,
0x8049,
1,
700,
700,
NULL,
@@ -1877,15 +1885,16 @@ struct weaponfunc_shootauto invfunc_superdragon_rapidfire = {
0x00000000, // flags
&invmenupos_00011098,
0x00000000,
0x3f99999a,
0x40c00000,
1.2, // damage
6, // spread
6, 18, 2, 8,
0x40a00000,
0x40000000,
0x00000000,
0x40800000,
0x04008049,
0x01000000,
4,
4,
0x8049,
1,
700,
700,
NULL,
@@ -1903,15 +1912,16 @@ struct weaponfunc_shootprojectile invfunc_superdragon_grenadelauncher = {
0x30000040, // flags
0x00000000,
0x00000000,
0x3f99999a,
0x40c00000,
1.2, // damage
6, // spread
5, 15, -1, 0,
0x40400000,
0x40000000,
0x00000000,
0x40800000,
0x04008073,
0x01000000,
4,
4,
0x8073,
1,
0x00000123,
0x00000000,
0x3f800000,
@@ -2012,15 +2022,16 @@ struct weaponfunc_shootauto invfunc_ar34_burstfire = {
0x00000002, // flags
&invmenupos_00011098,
0x00000000,
0x3fb33333,
0x41000000,
1.4, // damage
8, // spread
6, 18, 2, 8,
0x40a00000,
0x40000000,
0x00000000,
0x40800000,
0x05008059,
0x01000000,
4,
5,
0x8059,
1,
750,
750,
NULL,
@@ -2038,15 +2049,16 @@ struct weaponfunc_shootauto invfunc_ar34_usescope = {
0x00000002, // flags
&invmenupos_00011098,
0x00000000,
0x3fb33333,
0x41000000,
1.4, // damage
8, // spread
6, 18, 2, 8,
0x40a00000,
0x40000000,
0x00000000,
0x40800000,
0x05008059,
0x01000000,
4,
5,
0x8059,
1,
750,
750,
NULL,
@@ -2149,15 +2161,16 @@ struct weaponfunc_shootauto invfunc_k7avenger_burstfire = {
0x00000002, // flags
&invmenupos_00011098,
0x00000000,
0x3fc00000,
0x40c00000,
1.5, // damage
6, // spread
6, 18, 2, 8,
0x40a00000,
0x40000000,
0x00000000,
0x40800000,
0x0400805a,
0x01000000,
4,
4,
0x805a,
1,
950,
950,
NULL,
@@ -2175,15 +2188,16 @@ struct weaponfunc_shootauto invfunc_k7avenger_threatdetector = {
0x00082002, // flags
&invmenupos_00011098,
0x00000000,
0x3fc00000,
0x40c00000,
1.5, // damage
6, // spread
6, 18, 2, 8,
0x40a00000,
0x40000000,
0x00000000,
0x40800000,
0x0400805a,
0x01000000,
4,
4,
0x805a,
1,
950,
950,
NULL,
@@ -2293,15 +2307,16 @@ struct weaponfunc_shootauto invfunc_laptopgun_burstfire = {
0x00000002, // flags
&invmenupos_00011098,
0x00000000,
0x3f933333,
0x40c00000,
1.15, // damage
6, // spread
6, 18, 2, 8,
0x40a00000,
0x40000000,
0x00000000,
0x40800000,
0x04008044,
0x01000000,
4,
4,
0x8044,
1,
1000,
1000,
NULL,
@@ -2523,15 +2538,16 @@ struct weaponfunc_shootauto invfunc_reaper_shoot = {
0x00000002, // flags
&invmenupos_000110ac,
0x00000000,
0x3f99999a,
0x42600000,
1.2, // damage
56, // spread
3, 9, 32, 28,
0x00000000,
0x00000000,
0x00000000,
0x40800000,
0x0200803f,
0x01000000,
4,
2,
0x803f,
1,
60,
1800,
var8006d33c,
@@ -2648,15 +2664,16 @@ struct weaponfunc_shootprojectile invfunc_rockerlauncher_shoot = {
0x08000040, // flags
0x00000000,
0x00000000,
0x3f800000,
0x40c00000,
1, // damage
6, // spread
3, 12, 15, 0,
0x40400000,
0x40000000,
0x00000000,
0x40800000,
0x04008053,
0x01000000,
4,
4,
0x8053,
1,
0x0000011f,
0x00000000,
0x40066666,
@@ -2678,15 +2695,16 @@ struct weaponfunc_shootprojectile invfunc_rocketlauncher_homing = {
0x48000040, // flags
0x00000000,
0x00000000,
0x3f800000,
0x40c00000,
1, // damage
6, // spread
3, 12, 15, 0,
0x40400000,
0x40000000,
0x00000000,
0x40800000,
0x04008053,
0x01000000,
4,
4,
0x8053,
1,
0x0000011f,
0x00000000,
0x40066666,
@@ -2756,15 +2774,16 @@ struct weaponfunc_shootprojectile invfunc_slayer_shoot = {
0x08000040, // flags
0x00000000,
0x00000000,
0x3f800000,
0x40c00000,
1, // damage
6, // spread
3, 12, 15, 0,
0x40400000,
0x40000000,
0x00000000,
0x40800000,
0x04008067,
0x01000000,
4,
4,
0x8067,
1,
0x00000120,
0x00000000,
0x40833333,
@@ -2786,15 +2805,16 @@ struct weaponfunc_shootprojectile invfunc_slayer_flybywire = {
0x28000840, // flags
0x00000000,
0x00000000,
0x3f800000,
0x40c00000,
1, // damage
6, // spread
3, 12, 15, 0,
0x40400000,
0x40000000,
0x00000000,
0x40800000,
0x04008067,
0x01000000,
4,
4,
0x8067,
1,
0x00000120,
0x00000000,
0x40833333,
@@ -2874,15 +2894,16 @@ struct weaponfunc_shootprojectile invfunc_devastator_shoot = {
0x30000040, // flags
0x00000000,
0x00000000,
0x3f800000,
0x40c00000,
1, // damage
6, // spread
5, 58, -1, 0,
0x40a00000,
0x41000000,
0x00000000,
0x40800000,
0x04008073,
0x01000000,
4,
4,
0x8073,
1,
0x00000122,
0x00000000,
0x3f800000,
@@ -2904,15 +2925,16 @@ struct weaponfunc_shootprojectile invfunc_devastator_wallhugger = {
0x30000140, // flags
0x00000000,
0x00000000,
0x3f800000,
0x40c00000,
1, // damage
6, // spread
5, 58, -1, 0,
0x40a00000,
0x41000000,
0x00000000,
0x40800000,
0x04008073,
0x01000000,
4,
4,
0x8073,
1,
0x00000122,
0x00000000,
0x3f800000,
@@ -3568,15 +3590,16 @@ struct weaponfunc_shootprojectile invfunc_crossbow_lethal = {
0x00802000, // flags
0x00000000,
0x00000000,
0x42c80000,
0x40c00000,
100, // damage
6, // spread
3, 12, 15, 0,
0x40400000,
0x40000000,
0x00000000,
0x40800000,
0x04008056,
0x01000000,
4,
4,
0x8056,
1,
0x00000121,
0x00000000,
0x40066666,
@@ -3598,15 +3621,16 @@ struct weaponfunc_shootprojectile invfunc_crossbow_shoot = {
0x00802200, // flags
0x00000000,
0x00000000,
0x3f800000,
0x40c00000,
1, // damage
6, // spread
3, 12, 15, 0,
0x40400000,
0x40000000,
0x00000000,
0x40800000,
0x04008056,
0x01000000,
4,
4,
0x8056,
1,
0x00000121,
0x00000000,
0x40066666,
@@ -3988,15 +4012,16 @@ struct weaponfunc_shootauto invfunc_laser_stream = {
0x00000000, // flags
&invmenupos_00011084,
0x00000000,
0x3dcccccd,
0x00000000,
0.1, // damage
0, // spread
6, 18, 0, 6,
0x40800000,
0x40400000,
0x00000000,
0x00000000,
0x03000000,
0x01000000,
0,
3,
0,
1,
3600,
3600,
NULL,
@@ -4171,15 +4196,16 @@ struct weaponfunc_shootauto invfunc_kl01313_shoot = {
0x00000000, // flags
&invmenupos_00011098,
0x00000000,
0x3f19999a,
0x41700000,
0.6, // damage
15, // spread
0, 0, 0, 6,
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x0b00806b,
0x01000000,
0,
11,
0x806b,
1,
450,
450,
NULL,
@@ -4230,15 +4256,16 @@ struct weaponfunc_shootauto invfunc_kf7special_shoot = {
0x00000002, // flags
&invmenupos_00011098,
0x00000000,
0x3f800000,
0x41200000,
1, // damage
10, // spread
4, 12, 0, 6,
0x40900000,
0x40000000,
0x00000000,
0x40400000,
0x0400806c,
0x01000000,
3,
4,
0x806c,
1,
450,
450,
NULL,
@@ -4289,15 +4316,16 @@ struct weaponfunc_shootauto invfunc_zzt9mm_shoot = {
0x00000000, // flags
&invmenupos_00011098,
0x00000000,
0x3f800000,
0x41100000,
1, // damage
9, // spread
6, 18, 0, 6,
0x40800000,
0x40400000,
0x00000000,
0x00000000,
0x0400806d,
0x01000000,
0,
4,
0x806d,
1,
600,
600,
NULL,
@@ -4348,15 +4376,16 @@ struct weaponfunc_shootauto invfunc_dmc_shoot = {
0x00000000, // flags
&invmenupos_00011098,
0x00000000,
0x3f800000,
0x40e00000,
1, // damage
7, // spread
6, 18, 0, 6,
0x40800000,
0x40400000,
0x00000000,
0x00000000,
0x0400806e,
0x01000000,
0,
4,
0x806e,
1,
450,
450,
NULL,
@@ -4407,15 +4436,16 @@ struct weaponfunc_shootauto invfunc_ar53_shoot = {
0x00000002, // flags
&invmenupos_00011098,
0x00000000,
0x3fb33333,
0x40c00000,
1.4, // damage
6, // spread
6, 18, 2, 8,
0x40a00000,
0x40000000,
0x00000000,
0x40800000,
0x0500806f,
0x01000000,
4,
5,
0x806f,
1,
550,
550,
NULL,
@@ -4466,15 +4496,16 @@ struct weaponfunc_shootauto invfunc_rcp45_shoot = {
0x00000000, // flags
&invmenupos_00011098,
0x00000000,
0x3fe66666,
0x40c00000,
1.8, // damage
6, // spread
4, 8, 0, 3,
0x40600000,
0x40000000,
0x00000000,
0x40800000,
0x02008070,
0x01000000,
4,
2,
0x8070,
1,
600,
600,
NULL,
@@ -4565,15 +4596,16 @@ struct weaponfunc_shootauto invfunc_59_rapidfire = {
0x00000000, // flags
&invmenupos_00011098,
0x00000000,
0x3f800000,
0x40c00000,
1, // damage
6, // spread
6, 18, 2, 8,
0x40a00000,
0x40000000,
0x00000000,
0x40800000,
0x04008059,
0x02000000,
4,
4,
0x8059,
2,
900,
900,
NULL,
@@ -4624,15 +4656,16 @@ struct weaponfunc_shootauto invfunc_5a_rapidfire = {
0x00000000, // flags
&invmenupos_00011098,
0x00000000,
0x3f800000,
0x40c00000,
1, // damage
6, // spread
6, 18, 2, 8,
0x40a00000,
0x40000000,
0x00000000,
0x40800000,
0x0400803f,
0x01000000,
4,
4,
0x803f,
1,
900,
900,
NULL,
@@ -5862,15 +5895,16 @@ struct weaponfunc_shootprojectile invfunc_rocketlauncher34_primary = {
0x08000040, // flags
0x00000000,
0x00000000,
0x3f800000,
0x40c00000,
1, // damage
6, // spread
3, 12, 15, 0,
0x40400000,
0x40000000,
0x00000000,
0x40800000,
0x04008053,
0x01000000,
4,
4,
0x8053,
1,
0x0000011f,
0x00000000,
0x40066666,
+1
View File
@@ -1036,6 +1036,7 @@
#define INTROCMD_END 12
#define INVENTORYFUNCTYPE_NONE 0x0000
#define INVENTORYFUNCTYPE_SHOOT 0x0001
#define INVENTORYFUNCTYPE_SHOOT_SINGLE 0x0001
#define INVENTORYFUNCTYPE_SHOOT_AUTOMATIC 0x0101
#define INVENTORYFUNCTYPE_SHOOT_PROJECTILE 0x0201
+7 -31
View File
@@ -3109,7 +3109,7 @@ struct weaponfunc {
/*0x10*/ u32 flags;
};
struct weaponfunc_shootsingle {
struct weaponfunc_shoot {
struct weaponfunc base;
/*0x14*/ struct inventory_menupos *unk14;
/*0x18*/ u32 unk18;
@@ -3134,22 +3134,12 @@ struct weaponfunc_shootsingle {
/*0x3c*/ u8 unk3c;
};
struct weaponfunc_shootsingle {
struct weaponfunc_shoot base;
};
struct weaponfunc_shootauto {
struct weaponfunc base;
/*0x14*/ struct inventory_menupos *unk14;
/*0x18*/ u32 unk18;
/*0x1c*/ u32 unk1c;
/*0x20*/ u32 unk20;
/*0x24*/ s8 unk24;
/*0x25*/ s8 unk25;
/*0x26*/ s8 unk26;
/*0x27*/ s8 unk27;
/*0x28*/ u32 unk28;
/*0x2c*/ u32 unk2c;
/*0x30*/ u32 unk30;
/*0x34*/ u32 unk34;
/*0x38*/ u32 unk38;
/*0x3c*/ u32 unk3c;
struct weaponfunc_shoot base;
/*0x40*/ f32 initialfirerate; // rounds per minute
/*0x44*/ f32 maxfirerate; // rounds per minute
/*0x48*/ f32 *unk48;
@@ -3158,21 +3148,7 @@ struct weaponfunc_shootauto {
};
struct weaponfunc_shootprojectile {
struct weaponfunc base;
/*0x14*/ u32 unk14;
/*0x18*/ u32 unk18;
/*0x1c*/ u32 unk1c;
/*0x20*/ u32 unk20;
/*0x24*/ s8 unk24;
/*0x25*/ s8 unk25;
/*0x26*/ s8 unk26;
/*0x27*/ s8 unk27;
/*0x28*/ u32 unk28;
/*0x2c*/ u32 unk2c;
/*0x30*/ u32 unk30;
/*0x34*/ u32 unk34;
/*0x38*/ u32 unk38;
/*0x3c*/ u32 unk3c;
struct weaponfunc_shoot base;
/*0x40*/ s32 projectilemodelnum;
/*0x44*/ u32 unk44;
/*0x48*/ u32 unk48;