diff --git a/src/game/game_097ba0.c b/src/game/game_097ba0.c index 2f48ca39a..aa4f6c174 100644 --- a/src/game/game_097ba0.c +++ b/src/game/game_097ba0.c @@ -5818,6 +5818,206 @@ glabel var7f1ac31c ); #endif +// Mismatch: Branch logic near e9c is different (but functionally the same) +//s32 handTickIncReload(struct handweaponinfo *info, s32 handnum, struct hand *hand, s32 lvupdate) +//{ +// struct weaponfunc *func = handGetWeaponFunction(&hand->base); +// +// if (g_Vars.currentplayer->isdead) { +// hand->animmode = HANDANIMMODE_IDLE; +// hand->animload = -1; +// +// if (handSetState(handnum, HANDSTATE_IDLE)) { +// return lvupdate; +// } +// } +// +// if (hand->statecycles == 0) { +// struct hand *hand2 = &g_Vars.currentplayer->hands[1 - handnum]; +// +// hand->gs_int1 = -1; +// hand->gs_int2 = 0; +// +// if (hand2->state == HANDSTATE_RELOAD && hand2->stateframes < PALDOWN(20)) { +// hand->stateminor = 9; +// } +// } +// +// if (hand->stateminor == 9) { +// struct hand *hand2 = &g_Vars.currentplayer->hands[1 - handnum]; +// +// if (hand2->state == HANDSTATE_RELOAD && hand2->stateframes < PALDOWN(20)) { +// return 0; +// } +// +// hand->stateframes = 0; +// hand->statecycles = 0; +// hand->stateminor = 0; +// hand->statelastframe = 0; +// } +// +// // d94 +// if (hand->stateminor == 0) { +// if (hand->statecycles == 0) { +// if (func && (func->ammoindex == 0 || func->ammoindex == 1)) { +// if (info->definition->ammos[func->ammoindex]->reload_animation +// && info->weaponnum != WEAPON_COMBATKNIFE) { +// func0f0988e0(info->definition->ammos[func->ammoindex]->reload_animation, handnum, hand); +// +// hand->unk0d0e_07 = true; +// +// if (info->definition->ammos[func->ammoindex]->flags & 4) { +// hand->unk0cc8_03 = true; +// } +// +// if (info->weaponnum == WEAPON_GRENADE || info->weaponnum == WEAPON_NBOMB) { +// hand->unk0d0e_00 = 0; +// } +// } else { +// hand->stateminor++; +// } +// } else { +// if (handSetState(handnum, HANDSTATE_IDLE)) { +// return lvupdate; +// } +// } +// +// // e9c +// if (hand); +// } else { +// if (info->definition->ammos[func->ammoindex]->flags & 4) { +// if (func0f098a44(hand, 1)) { +// if ((hand->stateflags & HANDSTATEFLAG_00000010) == 0) { +// s32 value; +// +// func0f098df8(hand->base.weaponfunc, info, hand, 1, 0); +// hand->stateflags |= HANDSTATEFLAG_00000010; +// value = func0f098ca0(hand->base.weaponfunc, info, hand); +// +// if (value >= 2) { +// hand->unk0cc8_03 = false; +// } +// +// if (value == -1) { +// hand->unk0cc8_03 = false; +// } +// } +// } else { +// hand->stateflags = 0; +// } +// +// if (hand->triggeron) { +// hand->unk0cc8_03 = false; +// } +// } else { +// if ((hand->stateflags & HANDSTATEFLAG_00000010) == 0) { +// if (func0f098a44(hand, 1)) { +// func0f098df8(hand->base.weaponfunc, info, hand, 0, 0); +// hand->stateflags |= HANDSTATEFLAG_00000010; +// } +// } +// } +// +// if (hand->animmode != HANDANIMMODE_BUSY) { +// if (handSetState(handnum, HANDSTATE_IDLE)) { +// return lvupdate; +// } +// } +// } +// } +// +// if (1); +// +// if (hand->stateminor == 1) { +// if (hand->count60 > PALDOWN(15) || !hand->visible) { +// hand->mode = HANDMODE_11; +// hand->stateminor++; +// hand->pausetime60 = PALDOWN(17); +// hand->count60 = 0; +// hand->count = 0; +// } else { +// func0f099780(hand, (hand->count60 * 0.87252569198608f) / PALDOWN(16)); +// } +// } +// +// if (hand->stateminor == 2) { +// if (hand->count == 0) { +// if (info->weaponnum == WEAPON_COMBATKNIFE +// && func->ammoindex >= 0 +// && info->definition->ammos[func->ammoindex]->reload_animation) { +// func0f0988e0(info->definition->ammos[func->ammoindex]->reload_animation, handnum, hand); +// hand->unk0cc8_02 = true; +// } +// +// if ((hand->stateflags & HANDSTATEFLAG_00000010) == 0) { +// func0f098df8(hand->base.weaponfunc, info, hand, 0, 0); +// } +// +// if (g_Vars.lvupdate240 > 0 +// && g_Vars.currentplayer->cameramode != CAMERAMODE_THIRDPERSON +// && func0f09dd7c() +// && !g_PlayerInvincible +// && !g_Vars.currentplayer->isdead) { +// switch (info->weaponnum) { +// default: +// sndStart(var80095200, SFX_RELOAD_DEFAULT, 0, -1, -1, -1, -1, -1); +// break; +// case WEAPON_NONE: +// case WEAPON_UNARMED: +// case WEAPON_COMBATKNIFE: +// case WEAPON_LASER: +// case WEAPON_GRENADE: +// case WEAPON_NBOMB: +// case WEAPON_PROXIMITYMINE: +// case WEAPON_REMOTEMINE: +// case WEAPON_ECMMINE: +// case WEAPON_COMMSRIDER: +// case WEAPON_TRACERBUG: +// case WEAPON_TARGETAMPLIFIER: +// case WEAPON_BRIEFCASE2: +// break; +// } +// } +// } +// +// if (hand->count60 >= hand->pausetime60 && hand->count >= 2) { +// hand->mode = HANDMODE_12; +// hand->stateminor++; +// hand->count60 = 0; +// hand->count = 0; +// } else { +// func0f099780(hand, 0.87252569198608f); +// } +// } +// +// if (hand->stateminor == 3) { +// if (info->weaponnum == WEAPON_COMBATKNIFE) { +// hand->animmode = HANDANIMMODE_IDLE; +// } +// +// if (hand->count == 0) { +// g_Vars.currentplayer->doautoselect = false; +// } +// +// if (hand->count60 >= PALDOWN(23) +// || !weaponGetModelNum2(info->weaponnum) +// || !weaponHasFlag(info->weaponnum, WEAPONFLAG_00000040) +// || weaponHasFlag(info->weaponnum, WEAPONFLAG_00000080)) { +// hand->mode = HANDMODE_NONE; +// hand->count60 = 0; +// hand->count = 0; +// +// if (handSetState(handnum, HANDSTATE_IDLE)) { +// return lvupdate; +// } +// } else { +// func0f099780(hand, (PALDOWN(23) - hand->count60) * 0.87252569198608f / PALDOWN(23)); +// } +// } +// +// return 0; +//} + s32 handTickIncChangeFunc(struct handweaponinfo *info, s32 handnum, struct hand *hand, s32 lvupdate) { struct guncmd *cmd; diff --git a/src/game/inventory/items.c b/src/game/inventory/items.c index 04811c66b..5f6b4c1ee 100644 --- a/src/game/inventory/items.c +++ b/src/game/inventory/items.c @@ -137,7 +137,7 @@ struct inventory_ammo invammo_default = { CASING_RIFLE, 30, // clip size NULL, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_hammer = { @@ -506,7 +506,7 @@ struct inventory_ammo invammo_falcon2 = { CASING_STANDARD, 8, // clip size invanim_falcon2_reload, // reload animation - 0, // style + 0, // flags }; struct inventory_ammo invammo_falcon2scope = { @@ -514,7 +514,7 @@ struct inventory_ammo invammo_falcon2scope = { CASING_STANDARD, 8, // clip size invanim_falcon2scope_reload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_falcon2 = { @@ -711,7 +711,7 @@ struct inventory_ammo invammo_magsec = { CASING_STANDARD, 9, // clip size invanim_magsec_reload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_magsec = { @@ -902,7 +902,7 @@ struct inventory_ammo invammo_dy357 = { CASING_STANDARD, 6, // clip size invanim_dy357_reload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_dy357 = { @@ -1047,7 +1047,7 @@ struct inventory_ammo invammo_phoenix = { CASING_NONE, 8, // clip size invanim_phoenix_equiporreload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_phoenix = { @@ -1187,7 +1187,7 @@ struct inventory_ammo invammo_mauler = { CASING_NONE, 20, // clip size invanim_mauler_reload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_mauler = { @@ -1343,7 +1343,7 @@ struct inventory_ammo invammo_cmp150 = { CASING_STANDARD, 32, // clip size invanim_cmp150_reload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_cmp150 = { @@ -1469,7 +1469,7 @@ struct inventory_ammo invammo_cyclone = { CASING_NONE, 50, // clip size invanim_cyclone_equiporreload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_cyclone = { @@ -1573,7 +1573,7 @@ struct inventory_ammo invammo_rcp120 = { CASING_STANDARD, 120, // clip size invanim_rcp120_reload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_rcp120 = { @@ -1686,7 +1686,7 @@ struct inventory_ammo invammo_callisto = { CASING_NONE, 32, // clip size invanim_callisto_equiporreload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_callisto = { @@ -1788,7 +1788,7 @@ struct inventory_ammo invammo_dragon = { CASING_RIFLE, 30, // clip size invanim_dragon_reload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_dragon = { @@ -1938,7 +1938,7 @@ struct inventory_ammo invammo_superdragon = { CASING_RIFLE, 30, // clip size invanim_superdragon_reload, // reload animation - 0, // style + 0, // flags }; struct inventory_ammo invammo_superdragon_grenades = { @@ -1946,7 +1946,7 @@ struct inventory_ammo invammo_superdragon_grenades = { CASING_NONE, 6, // clip size invanim_superdragon_grenadereload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_superdragon = { @@ -2071,7 +2071,7 @@ struct inventory_ammo invammo_ar34 = { CASING_RIFLE, 30, // clip size invanim_ar34_equiporreload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_ar34 = { @@ -2210,7 +2210,7 @@ struct inventory_ammo invammo_k7avenger = { CASING_RIFLE, 25, // clip size invanim_k7avenger_reload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_k7avenger = { @@ -2343,7 +2343,7 @@ struct inventory_ammo invammo_laptopgun = { CASING_NONE, 50, // clip size invanim_laptopgun_reload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_laptopgun = { @@ -2456,7 +2456,7 @@ struct inventory_ammo invammo_shotgun = { CASING_SHOTGUN, 9, // clip size invanim_shotgun_reload, // reload animation - 0x04000000, // style + 0x04, // flags }; struct weapon invitem_shotgun = { @@ -2584,7 +2584,7 @@ struct inventory_ammo invammo_reaper = { CASING_REAPER, 200, // clip size invanim_reaper_reload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_reaper = { @@ -2721,7 +2721,7 @@ struct inventory_ammo invammo_rocketlauncher = { CASING_NONE, 1, // clip size invanim_rocketlauncher_reload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_rocketlauncher = { @@ -2831,7 +2831,7 @@ struct inventory_ammo invammo_slayer = { CASING_NONE, 1, // clip size invanim_slayer_reload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_slayer = { @@ -2951,7 +2951,7 @@ struct inventory_ammo invammo_devastator = { CASING_NONE, 8, // clip size invanim_devastator_reload, // reload animation - 0x08000000, // style + 0x08, // flags }; struct modelpartvisibility invpartvisibility_devastator[] = { @@ -3030,7 +3030,7 @@ struct inventory_ammo invammo_timedmine = { CASING_NONE, 1, // clip size invanim_mine_equiporreload, // reload animation - 0x02000000, // style + 0x02, // flags }; struct weapon invitem_timedmine = { @@ -3115,7 +3115,7 @@ struct inventory_ammo invammo_remotemine = { CASING_NONE, 1, // clip size invanim_remotemine_equiporreload, // reload animation - 0x02000000, // style + 0x02, // flags }; struct modelpartvisibility invpartvisibility_remotemine[] = { @@ -3167,7 +3167,7 @@ struct inventory_ammo invammo_proximitymine = { CASING_NONE, 1, // clip size invanim_mine_equiporreload, // reload animation - 0x02000000, // style + 0x02, // flags }; struct weapon invitem_proximitymine = { @@ -3230,7 +3230,7 @@ struct inventory_ammo invammo_ecmmine = { CASING_NONE, 1, // clip size invanim_ecmmine_equiporreload, // reload animation - 0x02000000, // style + 0x02, // flags }; struct weapon invitem_ecmmine = { @@ -3337,7 +3337,7 @@ struct inventory_ammo invammo_grenade = { CASING_NONE, 1, // clip size invanim_grenade_equiporreload, // reload animation - 0x0a000000, // style + 0x0a, // flags }; struct weapon invitem_grenade = { @@ -3398,7 +3398,7 @@ struct inventory_ammo invammo_nbomb = { CASING_NONE, 1, // clip size invanim_grenade_equiporreload, // reload animation - 0x0a000000, // style + 0x0a, // flags }; struct weapon invitem_nbomb = { @@ -3505,7 +3505,7 @@ struct inventory_ammo invammo_farsight = { CASING_NONE, 8, // clip size invanim_farsight_reload, // reload animation - 0, // style + 0, // flags }; struct modelpartvisibility invpartvisibility_farsight[] = { @@ -3647,7 +3647,7 @@ struct inventory_ammo invammo_crossbow = { CASING_NONE, 5, // clip size invanim_crossbow_reload, // reload animation - 0x04000000, // style + 0x04, // flags }; struct modelpartvisibility invpartvisibility_crossbow[] = { @@ -3772,7 +3772,7 @@ struct inventory_ammo invammo_tranquilizer = { CASING_NONE, 8, // clip size invanim_tranquilizer_reload, // reload animation - 0, // style + 0, // flags }; struct modelpartvisibility invpartvisibility_tranquilizer[] = { @@ -3812,7 +3812,7 @@ struct inventory_ammo invammo_psychosisgun = { CASING_NONE, 8, // clip size invanim_tranquilizer_reload, // reload animation - 0, // style + 0, // flags }; struct weaponfunc_shootsingle invfunc_psychosisgun_shoot = { @@ -3937,7 +3937,7 @@ struct inventory_ammo invammo_sniperrifle = { CASING_RIFLE, 8, // clip size invanim_sniperrifle_reload, // reload animation - 0, // style + 0, // flags }; struct modelpartvisibility invpartvisibility_sniperrifle[] = { @@ -4097,7 +4097,7 @@ struct inventory_ammo invammo_pp9i = { CASING_STANDARD, 7, // clip size NULL, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_pp9i = { @@ -4158,7 +4158,7 @@ struct inventory_ammo invammo_cc13 = { CASING_STANDARD, 8, // clip size NULL, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_cc13 = { @@ -4218,7 +4218,7 @@ struct inventory_ammo invammo_kl01313 = { CASING_STANDARD, 20, // clip size NULL, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_kl01313 = { @@ -4278,7 +4278,7 @@ struct inventory_ammo invammo_kf7special = { CASING_RIFLE, 30, // clip size NULL, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_kf7special = { @@ -4338,7 +4338,7 @@ struct inventory_ammo invammo_zzt9mm = { CASING_STANDARD, 32, // clip size NULL, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_zzt9mm = { @@ -4398,7 +4398,7 @@ struct inventory_ammo invammo_dmc = { CASING_STANDARD, 30, // clip size NULL, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_dmc = { @@ -4458,7 +4458,7 @@ struct inventory_ammo invammo_ar53 = { CASING_RIFLE, 30, // clip size NULL, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_ar53 = { @@ -4518,7 +4518,7 @@ struct inventory_ammo invammo_rcp45 = { CASING_STANDARD, 80, // clip size NULL, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_rcp45 = { @@ -4618,7 +4618,7 @@ struct inventory_ammo invammo_59 = { CASING_RIFLE, 27, // clip size NULL, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_59 = { @@ -4678,7 +4678,7 @@ struct inventory_ammo invammo_5a = { CASING_RIFLE, 27, // clip size NULL, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_5a = { @@ -4805,7 +4805,7 @@ struct inventory_ammo invammo_combatknife = { CASING_NONE, 1, // clip size invanim_combatknife_reload, // reload animation - 0x0a000000, // style + 0x0a, // flags }; struct weapon invitem_combatknife = { @@ -4866,7 +4866,7 @@ struct inventory_ammo invammo_bug = { CASING_NONE, 1, // clip size NULL, // reload animation - 0x02000000, // style + 0x02, // flags }; struct weapon invitem_commsrider = { @@ -5042,7 +5042,7 @@ struct inventory_ammo invammo_cloakingdevice = { CASING_NONE, 10, // clip size NULL, // reload animation - 0x01000000, // style + 0x01, // flags }; struct weapon invitem_cloakingdevice = { @@ -5101,7 +5101,7 @@ struct inventory_ammo invammo_combatboost = { CASING_NONE, 4, // clip size NULL, // reload animation - 0x01000000, // style + 0x01, // flags }; struct weapon invitem_combatboost = { @@ -5921,7 +5921,7 @@ struct inventory_ammo invammo_rocketlauncher34 = { CASING_NONE, 1, // clip size invanim_rocketlauncher_reload, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_rocketlauncher_34 = { @@ -5981,7 +5981,7 @@ struct inventory_ammo invammo_tester = { CASING_STANDARD, 8, // clip size NULL, // reload animation - 0, // style + 0, // flags }; struct weapon invitem_tester = { diff --git a/src/include/constants.h b/src/include/constants.h index 617e40797..76cfaacf8 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -976,6 +976,7 @@ #define HANDMODE_8 8 #define HANDMODE_RELOAD 9 #define HANDMODE_11 11 +#define HANDMODE_12 12 #define HANDMODE_13 13 #define HANDSTATE_IDLE 0 diff --git a/src/include/game/game_097ba0.h b/src/include/game/game_097ba0.h index 22fa3f62a..286fcfd8a 100644 --- a/src/include/game/game_097ba0.h +++ b/src/include/game/game_097ba0.h @@ -20,7 +20,7 @@ bool handIsAnimBusy(struct hand *hand); void handResetAnim(struct hand *hand); void handGetWeaponInfo(struct handweaponinfo *info, s32 handnum); s32 func0f098ca0(s32 arg0, struct handweaponinfo *info, struct hand *hand); -u32 func0f098df8(void); +void func0f098df8(s32 weaponfunc, struct handweaponinfo *info, struct hand *hand, s32 arg3, s32 arg4); void func0f098f8c(struct handweaponinfo *info, struct hand *hand); bool func0f099008(s32 handnum); bool func0f0990b0(struct weaponfunc *basefunc, struct weapon *weapon); diff --git a/src/include/types.h b/src/include/types.h index 815a2fc9a..3da4e8b24 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -2079,7 +2079,7 @@ struct hand { /*0x063c*/ s8 firing; /*0x063d*/ s8 flashon; /*0x063e*/ u8 gunon; - /*0x063f*/ u8 visible; + /*0x063f*/ s8 visible; /*0x0640*/ s8 inuse; // true if hand is holding a gun, false if not /*0x0644*/ bool triggeron; /*0x0648*/ bool triggerprev; @@ -2336,8 +2336,8 @@ struct hand { /*0x0c44*/ u32 stateflags; /*0x0c48*/ u32 unk0c48; /*0x0c4c*/ s32 stateframes; - /*0x0c50*/ u32 statecycles; - /*0x0c54*/ u32 statelastframe; + /*0x0c50*/ s32 statecycles; + /*0x0c54*/ s32 statelastframe; /*0x0c58*/ u32 unk0c58; /*0x0c5c*/ u32 unk0c5c; /*0x0c60*/ u32 unk0c60; @@ -2355,13 +2355,13 @@ struct hand { /*0x0c90*/ u32 unk0c90; /*0x0c94*/ u32 unk0c94; /*0x0c98*/ f32 gs_float1; - /*0x0c9c*/ u32 unk0c9c; - /*0x0ca0*/ u32 unk0ca0; - /*0x0ca4*/ u32 unk0ca4; - /*0x0ca8*/ u32 unk0ca8; - /*0x0cac*/ u32 unk0cac; - /*0x0cb0*/ u32 unk0cb0; - /*0x0cb4*/ u32 unk0cb4; + /*0x0c9c*/ f32 gs_float2; + /*0x0ca0*/ f32 gs_float3; + /*0x0ca4*/ f32 gs_float4; + /*0x0ca8*/ s32 gs_int1; + /*0x0cac*/ s32 gs_int2; + /*0x0cb0*/ s32 gs_int3; + /*0x0cb4*/ s32 gs_int4; /*0x0cb8*/ s32 animload; /*0x0cbc*/ s32 animframeinc; #if VERSION >= VERSION_PAL_FINAL @@ -3209,7 +3209,7 @@ struct inventory_ammo { u32 casingeject; s16 clipsize; struct guncmd *reload_animation; - u32 style; + u8 flags; }; struct modelpartvisibility {