From 3a6ae92d2daa5b2da7c5f13a33ffeb23e645e2b4 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 8 Sep 2024 18:36:45 +1000 Subject: [PATCH] Use consistent prefix for gset functions --- src/game/activemenu.c | 12 +-- src/game/activemenutick.c | 4 +- src/game/bondgun.c | 190 +++++++++++++++++++------------------- src/game/bondmove.c | 20 ++-- src/game/bot.c | 8 +- src/game/botact.c | 6 +- src/game/botinv.c | 4 +- src/game/chr.c | 4 +- src/game/chraction.c | 8 +- src/game/chraicommands.c | 2 +- src/game/gset.c | 130 +++++++++++++------------- src/game/gunfx.c | 4 +- src/game/hudmsg.c | 4 +- src/game/inv.c | 16 ++-- src/game/lv.c | 4 +- src/game/mainmenu.c | 30 +++--- src/game/mplayer/ingame.c | 4 +- src/game/mpstats.c | 6 +- src/game/player.c | 12 +-- src/game/prop.c | 14 +-- src/game/propobj.c | 22 ++--- src/game/sight.c | 4 +- src/game/training.c | 2 +- src/game/trainingmenus.c | 4 +- src/game/wallhit.c | 2 +- src/include/game/gset.h | 46 ++++----- 26 files changed, 281 insertions(+), 281 deletions(-) diff --git a/src/game/activemenu.c b/src/game/activemenu.c index 585e64e9a..1d8d23f70 100644 --- a/src/game/activemenu.c +++ b/src/game/activemenu.c @@ -324,15 +324,15 @@ void am_apply(s32 slot) pass = true; if (weaponnum) { - state = current_player_get_device_state(weaponnum); + state = gset_get_device_state(weaponnum); if (state != DEVICESTATE_UNEQUIPPED) { pass = false; if (state == DEVICESTATE_INACTIVE) { - current_player_set_device_active(weaponnum, true); + gset_set_device_active(weaponnum, true); } else { - current_player_set_device_active(weaponnum, false); + gset_set_device_active(weaponnum, false); } } } @@ -450,7 +450,7 @@ void am_get_slot_details(s32 slot, u32 *flags, char *label) weaponnum = inv_get_weapon_num_by_index(g_AmMenus[g_AmIndex].invindexes[slot]); - if (current_player_get_device_state(weaponnum) == DEVICESTATE_ACTIVE) { + if (gset_get_device_state(weaponnum) == DEVICESTATE_ACTIVE) { *flags |= AMSLOTFLAG_ACTIVE; } @@ -466,8 +466,8 @@ void am_get_slot_details(s32 slot, u32 *flags, char *label) if (slot == 4) { strcpy(label, lang_get(L_MISC_171)); // "Function" } else if (slot == 1 || slot == 7) { - prifunc = weapon_get_function(&g_Vars.currentplayer->hands[HAND_RIGHT].gset, FUNC_PRIMARY); - secfunc = weapon_get_function(&g_Vars.currentplayer->hands[HAND_RIGHT].gset, FUNC_SECONDARY); + prifunc = gset_get_funcdef_by_gset_funcnum(&g_Vars.currentplayer->hands[HAND_RIGHT].gset, FUNC_PRIMARY); + secfunc = gset_get_funcdef_by_gset_funcnum(&g_Vars.currentplayer->hands[HAND_RIGHT].gset, FUNC_SECONDARY); if (slot == 1) { if (!secfunc || !FUNCISSEC()) { diff --git a/src/game/activemenutick.c b/src/game/activemenutick.c index cf4253065..e2afaf665 100644 --- a/src/game/activemenutick.c +++ b/src/game/activemenutick.c @@ -307,8 +307,8 @@ void am_tick(void) // If weapon has no functions, skip past function screen if (g_AmMenus[g_AmIndex].screenindex == 1) { - struct weaponfunc *pri = weapon_get_function(&g_Vars.currentplayer->hands[0].gset, FUNC_PRIMARY); - struct weaponfunc *sec = weapon_get_function(&g_Vars.currentplayer->hands[0].gset, FUNC_SECONDARY); + struct weaponfunc *pri = gset_get_funcdef_by_gset_funcnum(&g_Vars.currentplayer->hands[0].gset, FUNC_PRIMARY); + struct weaponfunc *sec = gset_get_funcdef_by_gset_funcnum(&g_Vars.currentplayer->hands[0].gset, FUNC_SECONDARY); if (!pri && !sec) { am_change_screen(gotonextscreen); diff --git a/src/game/bondgun.c b/src/game/bondgun.c index 12cec287a..46acf1bea 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -220,7 +220,7 @@ void bgun_rumble(s32 handnum, s32 weaponnum) contpad1hasrumble = pak_get_type(contpad1) == PAKTYPE_RUMBLE; contpad2hasrumble = pak_get_type(contpad2) == PAKTYPE_RUMBLE; - if (!weapon_has_flag(weaponnum, WEAPONFLAG_DUALWIELD)) { + if (!gset_has_weapon_flag(weaponnum, WEAPONFLAG_DUALWIELD)) { singlewield = true; } @@ -424,7 +424,7 @@ void bgun_execute_gun_vis_commands(struct hand *hand, struct modeldef *modeldef, void bgun_update_ammo_visibility(struct hand *hand, struct modeldef *modeldef) { - struct weapon *weapon = weapon_find_by_id(hand->gset.weaponnum); + struct weapon *weapon = gset_get_weapondef(hand->gset.weaponnum); s32 i; s32 j; @@ -862,7 +862,7 @@ void bgun_get_weapon_info(struct handweaponinfo *info, s32 handnum) s32 bgun_get_ammo_state(s32 funcnum, struct handweaponinfo *info, struct hand *hand) { s32 state = GUNAMMOSTATE_CLIPFULL; - struct weaponfunc *func = weapon_get_function(&hand->gset, funcnum); + struct weaponfunc *func = gset_get_funcdef_by_gset_funcnum(&hand->gset, funcnum); if (!func) { return GUNAMMOSTATE_DEPLETED; @@ -903,7 +903,7 @@ s32 bgun_get_ammo_state(s32 funcnum, struct handweaponinfo *info, struct hand *h void bgun0f098df8(s32 weaponfunc, struct handweaponinfo *info, struct hand *hand, u8 onebullet, u8 checkunequipped) { - struct weaponfunc *func = weapon_get_function(&hand->gset, weaponfunc); + struct weaponfunc *func = gset_get_funcdef_by_gset_funcnum(&hand->gset, weaponfunc); if (func && func->ammoindex != -1) { s32 ammoindex = func->ammoindex; @@ -959,7 +959,7 @@ void bgun0f098f8c(struct handweaponinfo *info, struct hand *hand) s32 i; for (i = 0; i < 2; i++) { - if (weapon_get_function(&hand->gset, i)) { + if (gset_get_funcdef_by_gset_funcnum(&hand->gset, i)) { bgun0f098df8(i, info, hand, 0, 1); } } @@ -1023,8 +1023,8 @@ bool bgun0f0990b0(struct weaponfunc *basefunc, struct weapon *weapon) bool bgun0f099188(struct hand *hand, s32 gunfunc) { - struct weaponfunc *func = weapon_get_function(&hand->gset, gunfunc); - struct weapon *weapon = weapon_find_by_id(hand->gset.weaponnum); + struct weaponfunc *func = gset_get_funcdef_by_gset_funcnum(&hand->gset, gunfunc); + struct weapon *weapon = gset_get_weapondef(hand->gset.weaponnum); if (bgun_is_using_secondary_function() == gunfunc) { return false; @@ -1102,7 +1102,7 @@ s32 bgun_tick_inc_idle(struct handweaponinfo *info, s32 handnum, struct hand *ha // Attempted to shoot with no ammo // Consider switching to another weapon - if (weapon_has_flag(info->weaponnum, WEAPONFLAG_THROWABLE) + if (gset_has_weapon_flag(info->weaponnum, WEAPONFLAG_THROWABLE) && (info->weaponnum != WEAPON_REMOTEMINE || handnum != HAND_LEFT) && bgun_set_state(handnum, HANDSTATE_AUTOSWITCH)) { return lvupdate; @@ -1116,7 +1116,7 @@ s32 bgun_tick_inc_idle(struct handweaponinfo *info, s32 handnum, struct hand *ha if (bgun0f099188(hand, 1 - hand->gset.weaponfunc) && info->weaponnum != WEAPON_REAPER) { if (info->gunctrl->wantammo) { - func = weapon_get_function(&hand->gset, 1 - hand->gset.weaponfunc); + func = gset_get_funcdef_by_gset_funcnum(&hand->gset, 1 - hand->gset.weaponfunc); if ((func->type & 0xff) != INVENTORYFUNCTYPE_MELEE) { ammostate2 = GUNAMMOSTATE_DEPLETED; @@ -1129,7 +1129,7 @@ s32 bgun_tick_inc_idle(struct handweaponinfo *info, s32 handnum, struct hand *ha if (ammostate2 <= GUNAMMOSTATE_DEPLETED) { hand->unk0cc8_08 = true; } else { - if (!weapon_has_flag(info->weaponnum, WEAPONFLAG_KEEPFUNCWHENEMPTY) || hand->gset.weaponfunc == FUNC_SECONDARY) { + if (!gset_has_weapon_flag(info->weaponnum, WEAPONFLAG_KEEPFUNCWHENEMPTY) || hand->gset.weaponfunc == FUNC_SECONDARY) { hand->unk0cc8_07 = true; if (bgun_set_state(handnum, HANDSTATE_CHANGEFUNC)) { @@ -1354,7 +1354,7 @@ bool bgun_is_reloading(struct hand *hand) s32 bgun_tick_inc_reload(struct handweaponinfo *info, s32 handnum, struct hand *hand, s32 lvupdate) { u32 stack; - struct weaponfunc *func = gset_get_weapon_function(&hand->gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(&hand->gset); if (g_Vars.currentplayer->isdead) { hand->animmode = HANDANIMMODE_IDLE; @@ -1538,9 +1538,9 @@ s32 bgun_tick_inc_reload(struct handweaponinfo *info, s32 handnum, struct hand * } if (hand->count60 >= TICKS(23) - || !weapon_get_file_num2(info->weaponnum) - || !weapon_has_flag(info->weaponnum, WEAPONFLAG_00000040) - || weapon_has_flag(info->weaponnum, WEAPONFLAG_00000080)) { + || !gset_get_filenum2(info->weaponnum) + || !gset_has_weapon_flag(info->weaponnum, WEAPONFLAG_00000040) + || gset_has_weapon_flag(info->weaponnum, WEAPONFLAG_00000080)) { hand->mode = HANDMODE_NONE; hand->count60 = 0; hand->count = 0; @@ -1563,10 +1563,10 @@ s32 bgun_tick_inc_changefunc(struct handweaponinfo *info, s32 handnum, struct ha if (hand->statecycles == 0) { if (hand->gset.weaponfunc == FUNC_PRIMARY) { - cmd = gset_get_pri_to_sec_anim(&hand->gset); + cmd = gset_get_pritosec_anim(&hand->gset); hand->gset.weaponfunc = FUNC_SECONDARY; } else { - cmd = gset_get_sec_to_pri_anim(&hand->gset); + cmd = gset_get_sectopri_anim(&hand->gset); hand->gset.weaponfunc = FUNC_PRIMARY; } @@ -1974,7 +1974,7 @@ bool bgun_tick_recoil(struct hand *hand, struct handweaponinfo *info, s32 handnu hand->rotxend = BADDTOR(360) - BADDTOR3(recoilangle); - hand->posend.x = (hand_get_xpos(handnum) - hand->aimpos.x) * recoildist / 1000.0f; + hand->posend.x = (gset_get_xpos(handnum) - hand->aimpos.x) * recoildist / 1000.0f; hand->posend.y = 0; hand->posend.z = (weapondef->posz - hand->aimpos.z) * recoildist / 1000.0f; @@ -2011,7 +2011,7 @@ bool bgun_tick_inc_attacking_shoot(struct handweaponinfo *info, s32 handnum, str { static u32 var80070128 = 99; - struct weaponfunc *func = gset_get_weapon_function(&hand->gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(&hand->gset); bool canfireagain; s32 sp64; s32 sp60; @@ -2110,7 +2110,7 @@ bool bgun_tick_inc_attacking_shoot(struct handweaponinfo *info, s32 handnum, str bool bgun_tick_inc_attacking_throw(s32 handnum, struct hand *hand) { - struct weaponfunc_throw *func = (struct weaponfunc_throw *) gset_get_weapon_function(&hand->gset); + struct weaponfunc_throw *func = (struct weaponfunc_throw *) gset_get_funcdef_by_gset(&hand->gset); if (func == NULL) { return true; @@ -2222,7 +2222,7 @@ u32 var80070130 = 0x00000000; bool bgun_tick_inc_attacking_melee(s32 handnum, struct hand *hand) { - struct weaponfunc *func = gset_get_weapon_function(&hand->gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(&hand->gset); if (func == NULL) { return true; @@ -2330,7 +2330,7 @@ bool bgun_tick_inc_attacking_melee(s32 handnum, struct hand *hand) bool bgun_tick_inc_attacking_special(struct hand *hand) { - struct weaponfunc_special *func = (struct weaponfunc_special *) gset_get_weapon_function(&hand->gset); + struct weaponfunc_special *func = (struct weaponfunc_special *) gset_get_funcdef_by_gset(&hand->gset); if (!func) { return true; @@ -2401,7 +2401,7 @@ s32 bgun_tick_inc_attackempty(struct handweaponinfo *info, s32 handnum, struct h struct weaponfunc *func = NULL; if (info->definition) { - func = gset_get_weapon_function(&hand->gset); + func = gset_get_funcdef_by_gset(&hand->gset); } if (func && func->fire_animation) { @@ -2531,7 +2531,7 @@ s32 bgun_tick_inc_attack(struct handweaponinfo *info, s32 handnum, struct hand * u32 stack2; if (info->definition) { - func = gset_get_weapon_function(&hand->gset); + func = gset_get_funcdef_by_gset(&hand->gset); } if (func != NULL) { @@ -2678,7 +2678,7 @@ s32 bgun_tick_inc_changegun(struct handweaponinfo *info, s32 handnum, struct han if (hand->stateminor == HANDSTATEMINOR_CHANGEGUN_UNEQUIP) { bool skipanim = false; - if (weapon_has_flag(info->weaponnum, WEAPONFLAG_THROWABLE) + if (gset_has_weapon_flag(info->weaponnum, WEAPONFLAG_THROWABLE) && !(info->weaponnum == WEAPON_REMOTEMINE && handnum == HAND_LEFT) && bgun_get_ammo_state(FUNC_PRIMARY, info, hand) <= GUNAMMOSTATE_DEPLETED) { skipanim = true; @@ -2808,7 +2808,7 @@ s32 bgun_tick_inc_changegun(struct handweaponinfo *info, s32 handnum, struct han delay = TICKS(12); } - if (weapon_has_flag(hand->gset.weaponnum, WEAPONFLAG_00004000)) { + if (gset_has_weapon_flag(hand->gset.weaponnum, WEAPONFLAG_00004000)) { hand->animmode = HANDANIMMODE_IDLE; } else if (weapon->equip_animation) { delay = 1; @@ -2821,7 +2821,7 @@ s32 bgun_tick_inc_changegun(struct handweaponinfo *info, s32 handnum, struct han bgun0f098f8c(info, hand); - if (weapon_has_flag(info->weaponnum, WEAPONFLAG_THROWABLE) + if (gset_has_weapon_flag(info->weaponnum, WEAPONFLAG_THROWABLE) && (info->weaponnum != WEAPON_REMOTEMINE || handnum != HAND_LEFT) && bgun_get_ammo_state(FUNC_PRIMARY, info, hand) <= GUNAMMOSTATE_DEPLETED && bgun_set_state(handnum, HANDSTATE_AUTOSWITCH)) { @@ -2971,13 +2971,13 @@ s32 bgun_tick_inc_changegun(struct handweaponinfo *info, s32 handnum, struct han } if (hand->count60 >= delay - || !weapon_get_file_num2(info->weaponnum) - || !weapon_has_flag(info->weaponnum, WEAPONFLAG_00000040) - || weapon_has_flag(info->weaponnum, WEAPONFLAG_00000080)) { + || !gset_get_filenum2(info->weaponnum) + || !gset_has_weapon_flag(info->weaponnum, WEAPONFLAG_00000040) + || gset_has_weapon_flag(info->weaponnum, WEAPONFLAG_00000080)) { hand->mode = HANDMODE_NONE; hand->stateminor++; // to HANDSTATEMINOR_CHANGEGUN_EQUIP - if (weapon_has_flag(hand->gset.weaponnum, WEAPONFLAG_00004000) == 0) { + if (gset_has_weapon_flag(hand->gset.weaponnum, WEAPONFLAG_00004000) == 0) { hand->unk0cc8_02 = false; } @@ -2990,7 +2990,7 @@ s32 bgun_tick_inc_changegun(struct handweaponinfo *info, s32 handnum, struct han // Wait for equip animation to finish then go to idle state if (hand->stateminor == HANDSTATEMINOR_CHANGEGUN_EQUIP) { - if (info->definition->equip_animation && !weapon_has_flag(hand->gset.weaponnum, WEAPONFLAG_00004000)) { + if (info->definition->equip_animation && !gset_has_weapon_flag(hand->gset.weaponnum, WEAPONFLAG_00004000)) { if (hand->animmode == HANDANIMMODE_IDLE) { if (bgun_set_state(handnum, HANDSTATE_IDLE)) { return lvupdate; @@ -3078,7 +3078,7 @@ bool bgun_set_state(s32 handnum, s32 state) struct hand *hand = &g_Vars.currentplayer->hands[handnum]; // Sanity check - don't allow changing function if there is no other - if (state == HANDSTATE_CHANGEFUNC && weapon_get_function(&hand->gset, 1 - hand->gset.weaponfunc) == NULL) { + if (state == HANDSTATE_CHANGEFUNC && gset_get_funcdef_by_gset_funcnum(&hand->gset, 1 - hand->gset.weaponfunc) == NULL) { valid = false; } @@ -3175,8 +3175,8 @@ void bgun_decrease_noise_radius(void) struct noisesettings noisesettingsright; f32 subamount; - gset_populate_from_current_player(HAND_LEFT, &gsetleft); - gset_populate_from_current_player(HAND_RIGHT, &gsetright); + gset_populate(HAND_LEFT, &gsetleft); + gset_populate(HAND_RIGHT, &gsetright); gset_get_noise_settings(&gsetleft, &noisesettingsleft); gset_get_noise_settings(&gsetright, &noisesettingsright); @@ -3230,7 +3230,7 @@ void bgun_calculate_blend(s32 handnum) { s32 sp60[2]; s32 sp58[2]; - struct weapon *weapon = weapon_find_by_id(bgun_get_weapon_num(handnum)); + struct weapon *weapon = gset_get_weapondef(bgun_get_weapon_num(handnum)); f32 sway = weapon->sway; struct player *player = g_Vars.currentplayer; @@ -3290,7 +3290,7 @@ void bgun_update_blend(struct hand *hand, s32 handnum) sp5c.x += hand->adjustdamp.x; sp5c.y += hand->adjustdamp.y; - sp5c.x += hand_get_xshift(handnum); + sp5c.x += gset_get_xshift(handnum); for (i = 0; i < g_Vars.lvupdate240; i++) { hand->damppossum.x = (PAL ? 0.9847f : 0.9872f) * hand->damppossum.x + sp5c.f[0]; @@ -3853,13 +3853,13 @@ void bgun_tick_master_load(void) handfilenum = FILE_GCOMBATHANDSLOD; } - filenum = weapon_get_file_num(newweaponnum); + filenum = gset_get_filenum(newweaponnum); if (player->gunctrl.masterloadstate != MASTERLOADSTATE_LOADED || newweaponnum != player->gunctrl.gunmemtype) { if (filenum) { hashands = false; - if (weapon_has_flag(newweaponnum, WEAPONFLAG_HASHANDS)) { + if (gset_has_weapon_flag(newweaponnum, WEAPONFLAG_HASHANDS)) { hashands = true; } @@ -3951,9 +3951,9 @@ void bgun_tick_master_load(void) if (player->gunctrl.gunloadstate == GUNLOADSTATE_FLUX && player->gunctrl.cartmodeldef == NULL && PLAYERCOUNT() == 1) { for (i = 0; i < 2; i++) { hand = player->hands + i; - func = gset_get_weapon_function2(&hand->gset); + func = gset_get_funcdef_by_gset2(&hand->gset); shootfunc = NULL; - weapondef = weapon_find_by_id(player->gunctrl.weaponnum); + weapondef = gset_get_weapondef(player->gunctrl.weaponnum); casingindex = -1; if (func != NULL) { @@ -4200,7 +4200,7 @@ struct defaultobj *bgun_create_thrown_projectile2(struct chrdata *chr, struct gs struct defaultobj *obj = NULL; struct weaponfunc *basefunc; struct weaponfunc_throw *func; - struct weapon *weapon = weapon_find_by_id(gset->weaponnum); + struct weapon *weapon = gset_get_weapondef(gset->weaponnum); struct weaponobj *weaponobj; struct autogunobj *autogun; Mtxf mtx; @@ -4594,7 +4594,7 @@ void bgun_create_fired_projectile(s32 handnum) prevpos = &g_Vars.currentplayer->bondprevpos; extrapos = &g_Vars.currentplayer->bondextrapos; - weapondef = weapon_find_by_id(hand->gset.weaponnum); + weapondef = gset_get_weapondef(hand->gset.weaponnum); if (weapondef) { tmp = weapondef->functions[hand->gset.weaponfunc]; @@ -5032,7 +5032,7 @@ void bgun_swivel(f32 screenx, f32 screeny, f32 crossdamp, f32 aimdamp) */ void bgun_swivel_with_damp(f32 screenx, f32 screeny, f32 crossdamp) { - struct weapon *weapon = weapon_find_by_id(bgun_get_weapon_num(HAND_RIGHT)); + struct weapon *weapon = gset_get_weapondef(bgun_get_weapon_num(HAND_RIGHT)); f32 aimdamp = PAL ? weapon->aimsettings->aimdamppal : weapon->aimsettings->aimdamp; if (aimdamp < crossdamp) { @@ -5050,7 +5050,7 @@ void bgun_swivel_with_damp(f32 screenx, f32 screeny, f32 crossdamp) */ void bgun_swivel_without_damp(f32 screenx, f32 screeny) { - struct weapon *weapon = weapon_find_by_id(bgun_get_weapon_num(HAND_RIGHT)); + struct weapon *weapon = gset_get_weapondef(bgun_get_weapon_num(HAND_RIGHT)); f32 aimdamp = PAL ? weapon->aimsettings->aimdamppal : weapon->aimsettings->aimdamp; bgun_swivel(screenx, screeny, PAL ? 0.935f : 0.945f, aimdamp); @@ -5088,7 +5088,7 @@ void bgun_calculate_player_shot_spread(struct coord *gunpos2d, struct coord *gun f32 spread = 0; f32 scaledspread; f32 randfactor; - struct weaponfunc *func = current_player_get_weapon_function(handnum); + struct weaponfunc *func = gset_get_current_funcdef(handnum); struct player *player = g_Vars.currentplayer; if (func != NULL && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) { @@ -5096,7 +5096,7 @@ void bgun_calculate_player_shot_spread(struct coord *gunpos2d, struct coord *gun spread = shootfunc->spread; } - if (weapon_has_aim_flag(bgun_get_weapon_num2(handnum), INVAIMFLAG_ACCURATESINGLESHOT) + if (gset_has_aim_flag(bgun_get_weapon_num2(handnum), INVAIMFLAG_ACCURATESINGLESHOT) && player->hands[handnum].burstbullets == 1) { spread *= 0.25f; } @@ -5142,7 +5142,7 @@ void bgun_calculate_bot_shot_spread(struct coord *arg0, s32 weaponnum, s32 funcn { f32 spread = 0.0f; f32 radius; - struct weapon *weapondef = weapon_find_by_id(weaponnum); + struct weapon *weapondef = gset_get_weapondef(weaponnum); f32 x; f32 y; Mtxf mtx; @@ -5158,7 +5158,7 @@ void bgun_calculate_bot_shot_spread(struct coord *arg0, s32 weaponnum, s32 funcn } } - if (arg3 && weapon_has_aim_flag(weaponnum, INVAIMFLAG_ACCURATESINGLESHOT)) { + if (arg3 && gset_has_aim_flag(weaponnum, INVAIMFLAG_ACCURATESINGLESHOT)) { spread *= 0.25f; } @@ -5274,7 +5274,7 @@ void bgun_tick_switch2(void) struct hand *lefthand; struct hand *righthand; - if (current_player_get_device_state(ctrl->switchtoweaponnum) != DEVICESTATE_UNEQUIPPED) { + if (gset_get_device_state(ctrl->switchtoweaponnum) != DEVICESTATE_UNEQUIPPED) { ctrl->switchtoweaponnum = WEAPON_UNARMED; } @@ -5442,7 +5442,7 @@ s32 bgun_get_weapon_num2(s32 handnum) bool bgun0f0a1a10(s32 weaponnum) { - if (weapon_has_flag(weaponnum, WEAPONFLAG_00000400) + if (gset_has_weapon_flag(weaponnum, WEAPONFLAG_00000400) && (bgun_get_ammo_type_for_weapon(weaponnum, FUNC_PRIMARY) == 0 || bgun_get_ammo_qty_for_weapon(weaponnum, FUNC_PRIMARY) > 0)) { return true; } @@ -5558,7 +5558,7 @@ bool bgun_has_ammo_for_weapon(s32 weaponnum) { bool ammodefexists = false; bool hasammo = false; - struct weapon *weapon = weapon_find_by_id(weaponnum); + struct weapon *weapon = gset_get_weapondef(weaponnum); s32 i; if (weapon == NULL) { @@ -5566,7 +5566,7 @@ bool bgun_has_ammo_for_weapon(s32 weaponnum) } for (i = 0; i < 2; i++) { - struct weaponfunc *func = weapon_get_function_by_id(weaponnum, i); + struct weaponfunc *func = gset_get_funcdef_by_weaponnum_funcnum(weaponnum, i); if (func && func->ammoindex >= 0) { struct inventory_ammo *ammo = weapon->ammos[func->ammoindex]; @@ -5693,8 +5693,8 @@ void bgun_auto_switch_weapon(void) if (inv_has_single_weapon_inc_all_guns(g_AutoSwitchWeaponsPrimary[i])) { weaponnum = g_AutoSwitchWeaponsPrimary[i]; - weapon = weapon_find_by_id(weaponnum); - func = weapon_get_function_by_id(weaponnum, FUNC_PRIMARY); + weapon = gset_get_weapondef(weaponnum); + func = gset_get_funcdef_by_weaponnum_funcnum(weaponnum, FUNC_PRIMARY); if (!bgun0f0990b0(func, weapon) && (func->flags & FUNCFLAG_AUTOSWITCHUNSELECTABLE) == 0) { usable = true; @@ -5703,7 +5703,7 @@ void bgun_auto_switch_weapon(void) if (weaponnum == WEAPON_SUPERDRAGON && !foundsuperdragon) { foundsuperdragon++; } else { - func = weapon_get_function_by_id(weaponnum, FUNC_SECONDARY); + func = gset_get_funcdef_by_weaponnum_funcnum(weaponnum, FUNC_SECONDARY); if (!bgun0f0990b0(func, weapon) && (func->flags & FUNCFLAG_AUTOSWITCHUNSELECTABLE) == 0) { usable = true; @@ -5878,7 +5878,7 @@ void bgun_start_slide(s32 handnum) void bgun_update_slide(s32 handnum) { f32 slidemax = 0.0f; - struct weaponfunc *funcdef = current_player_get_weapon_function(handnum); + struct weaponfunc *funcdef = gset_get_current_funcdef(handnum); struct player *player = g_Vars.currentplayer; if (funcdef && ((funcdef->type & 0xff) == INVENTORYFUNCTYPE_SHOOT)) { @@ -6006,7 +6006,7 @@ bool bgun_allows_fullscreen_autoaim(void) hand = &g_Vars.currentplayer->hands[HAND_RIGHT]; if (1) { - func = gset_get_weapon_function2(&hand->gset); + func = gset_get_funcdef_by_gset2(&hand->gset); if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_MELEE @@ -6022,7 +6022,7 @@ bool bgun_allows_fullscreen_autoaim(void) hand = &g_Vars.currentplayer->hands[HAND_LEFT]; if (hand->inuse) { - func = gset_get_weapon_function2(&hand->gset); + func = gset_get_funcdef_by_gset2(&hand->gset); if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_MELEE @@ -6048,7 +6048,7 @@ bool bgun_allows_fullscreen_autoaim2(void) struct weaponfunc *func; hand = &g_Vars.currentplayer->hands[HAND_RIGHT]; - func = gset_get_weapon_function2(&hand->gset); + func = gset_get_funcdef_by_gset2(&hand->gset); if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_MELEE @@ -6061,7 +6061,7 @@ bool bgun_allows_fullscreen_autoaim2(void) hand = &g_Vars.currentplayer->hands[HAND_LEFT]; if (hand->inuse) { - func = gset_get_weapon_function2(&hand->gset); + func = gset_get_funcdef_by_gset2(&hand->gset); if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_MELEE @@ -6128,7 +6128,7 @@ void bgun_disarm(struct prop *attackerprop) s32 i; bool drop; - if (!weapon_has_flag(weaponnum, WEAPONFLAG_UNDROPPABLE) && weaponnum <= WEAPON_RCP45) { + if (!gset_has_weapon_flag(weaponnum, WEAPONFLAG_UNDROPPABLE) && weaponnum <= WEAPON_RCP45) { #if VERSION >= VERSION_NTSC_1_0 // Coop must not allow player to drop a mission critical weapon // because AI lists can fail the mission if the player has zero @@ -6160,7 +6160,7 @@ void bgun_disarm(struct prop *attackerprop) // Or drop it at player's feet with the pin pulled maybe... if (weaponnum == WEAPON_GRENADE || weaponnum == WEAPON_NBOMB) { for (i = 0; i < 2; i++) { - struct weaponfunc *func = gset_get_weapon_function(&player->hands[i].gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(&player->hands[i].gset); if ((func->type & 0xff) == INVENTORYFUNCTYPE_THROW && player->hands[i].state == HANDSTATE_ATTACK @@ -6842,7 +6842,7 @@ void bgun_update_sniper_rifle(struct modeldef *modeldef, u8 *allocation) s32 mtxindex; struct coord sp70; - f26 = 1.0f - (current_player_get_gun_zoom_fov() - 2.0f) / 58.0f; + f26 = 1.0f - (gset_get_gun_zoom_fov() - 2.0f) / 58.0f; nodes[0] = model_get_part(modeldef, MODELPART_SNIPERRIFLE_SCOPE1); nodes[1] = model_get_part(modeldef, MODELPART_SNIPERRIFLE_SCOPE2); @@ -7360,13 +7360,13 @@ void bgun0f0a5550(s32 handnum) struct coord sp118; s32 j; - weapondef = weapon_find_by_id(weaponnum); + weapondef = gset_get_weapondef(weaponnum); if (handnum == HAND_LEFT && weaponnum == WEAPON_REMOTEMINE) { isdetonator = true; } - funcdef = gset_get_weapon_function2(&hand->gset); + funcdef = gset_get_funcdef_by_gset2(&hand->gset); if (funcdef && (funcdef->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) { shootfunc = (struct weaponfunc_shoot *)funcdef; @@ -7375,7 +7375,7 @@ void bgun0f0a5550(s32 handnum) bgun_update_blend(hand, handnum); if (handnum == HAND_RIGHT) { - if (weapon_has_flag(bgun_get_weapon_num2(HAND_LEFT), WEAPONFLAG_00000040)) { + if (gset_has_weapon_flag(bgun_get_weapon_num2(HAND_LEFT), WEAPONFLAG_00000040)) { hand->xshift += 2.0f * g_Vars.lvupdate60freal / 240.0f; if (hand->xshift > 2.0f) { @@ -7389,7 +7389,7 @@ void bgun0f0a5550(s32 handnum) } } } else { - if (weapon_has_flag(bgun_get_weapon_num2(HAND_RIGHT), WEAPONFLAG_00000040)) { + if (gset_has_weapon_flag(bgun_get_weapon_num2(HAND_RIGHT), WEAPONFLAG_00000040)) { hand->xshift -= 2.0f * g_Vars.lvupdate60freal / 240.0f; if (hand->xshift < -2.0f) { @@ -7405,7 +7405,7 @@ void bgun0f0a5550(s32 handnum) } if (handnum == HAND_RIGHT) { - sp274.x = hand_get_xpos(handnum) + hand->damppos.f[0] + hand->adjustpos.f[0]; + sp274.x = gset_get_xpos(handnum) + hand->damppos.f[0] + hand->adjustpos.f[0]; sp274.y = weapondef->posy + hand->damppos.f[1] + hand->adjustpos.f[1]; sp274.z = weapondef->posz + hand->damppos.f[2] + hand->adjustpos.f[2]; } else if (isdetonator) { @@ -7413,7 +7413,7 @@ void bgun0f0a5550(s32 handnum) sp274.y = -16.5f + hand->damppos.f[1] + hand->adjustpos.f[1]; sp274.z = -16.0f + hand->damppos.f[2] + hand->adjustpos.f[2]; } else { - sp274.x = hand_get_xpos(handnum) + hand->damppos.f[0] - hand->adjustpos.f[0]; + sp274.x = gset_get_xpos(handnum) + hand->damppos.f[0] - hand->adjustpos.f[0]; sp274.y = weapondef->posy + hand->damppos.f[1] + hand->adjustpos.f[1]; sp274.z = weapondef->posz + hand->damppos.f[2] + hand->adjustpos.f[2]; } @@ -7443,8 +7443,8 @@ void bgun0f0a5550(s32 handnum) hand->visible = true; - if (!weapon_has_flag(weaponnum, WEAPONFLAG_00000040) - || weapon_has_flag(weaponnum, WEAPONFLAG_00000080) + if (!gset_has_weapon_flag(weaponnum, WEAPONFLAG_00000040) + || gset_has_weapon_flag(weaponnum, WEAPONFLAG_00000080) || hand->mode == HANDMODE_6 || hand->mode == HANDMODE_7 || !bgun_is_loaded() @@ -7457,7 +7457,7 @@ void bgun0f0a5550(s32 handnum) modeldef = player->gunctrl.gunmodeldef; mtxallocation = gfx_allocate(modeldef->nummatrices * sizeof(Mtxf)); - if (weapon_has_flag(weaponnum, WEAPONFLAG_RESETMATRICES)) { + if (gset_has_weapon_flag(weaponnum, WEAPONFLAG_RESETMATRICES)) { for (i = 0; i < modeldef->nummatrices; i++) { mtx = (Mtxf *)(mtxallocation + i * sizeof(Mtxf)); mtx4_load_identity(mtx); @@ -7472,14 +7472,14 @@ void bgun0f0a5550(s32 handnum) bgun_update_ammo_visibility(hand, modeldef); - if (weapon_has_flag(weaponnum, WEAPONFLAG_HASGUNSCRIPT)) { + if (gset_has_weapon_flag(weaponnum, WEAPONFLAG_HASGUNSCRIPT)) { bgun_tick_anim(hand, modeldef); } } mtx4_load_identity(&sp234); - if (PLAYERCOUNT() == 1 && IS8MB() && weapon_has_flag(weaponnum, WEAPONFLAG_GANGSTA)) { + if (PLAYERCOUNT() == 1 && IS8MB() && gset_has_weapon_flag(weaponnum, WEAPONFLAG_GANGSTA)) { bgun_update_gangsta(hand, handnum, &sp274, funcdef, &sp284, &sp234); } @@ -7547,7 +7547,7 @@ void bgun0f0a5550(s32 handnum) hand->gunmodel.matrices = (Mtxf *)mtxallocation; hand->handmodel.matrices = (Mtxf *)mtxallocation; - if (weapon_has_flag(weaponnum, WEAPONFLAG_DUALFLIP) && handnum == HAND_LEFT) { + if (gset_has_weapon_flag(weaponnum, WEAPONFLAG_DUALFLIP) && handnum == HAND_LEFT) { mtx00015e24(-1, &sp2c4); } @@ -8234,7 +8234,7 @@ void bgun_render(Gfx **gdlptr) if (hand->visible) { gdl = beam_render(gdl, &hand->beam, 0, 0); - if (weapon_has_flag(hand->gset.weaponnum, WEAPONFLAG_BRIGHTER)) { + if (gset_has_weapon_flag(hand->gset.weaponnum, WEAPONFLAG_BRIGHTER)) { gSPSetLights1(gdl++, var80070090); gSPLookAt(gdl++, cam_get_look_at()); } @@ -8345,7 +8345,7 @@ void bgun_render(Gfx **gdlptr) #endif } - if (weapon_has_flag(weaponnum, WEAPONFLAG_DUALFLIP)) { + if (gset_has_weapon_flag(weaponnum, WEAPONFLAG_DUALFLIP)) { gSPClearGeometryMode(renderdata.gdl++, G_CULL_BOTH); if (handnum == HAND_RIGHT) { @@ -8400,7 +8400,7 @@ void bgun_render(Gfx **gdlptr) // Clean up gdl = renderdata.gdl; - if (weapon_has_flag(weaponnum, WEAPONFLAG_DUALFLIP)) { + if (gset_has_weapon_flag(weaponnum, WEAPONFLAG_DUALFLIP)) { gSPClearGeometryMode(gdl++, G_CULL_BOTH); } @@ -9113,7 +9113,7 @@ void bgun_tick_gameplay(bool triggeron) case WEAPON_COMMSRIDER: case WEAPON_TRACERBUG: case WEAPON_TARGETAMPLIFIER: - weapon = weapon_find_by_id(weaponnum); + weapon = gset_get_weapondef(weaponnum); if (weapon && weapon->ammos[0] && bgun_get_ammo_count(weapon->ammos[0]->type) == 0) { @@ -9196,7 +9196,7 @@ void bgun_tick_gameplay(bool triggeron) struct hand *lhand = &g_Vars.currentplayer->hands[HAND_LEFT]; struct hand *rhand = &g_Vars.currentplayer->hands[HAND_RIGHT]; - weapon = weapon_find_by_id(rhand->gset.weaponnum); + weapon = gset_get_weapondef(rhand->gset.weaponnum); for (i = 0; i != 2; i++) { if (weapon && weapon->ammos[i] && @@ -9244,11 +9244,11 @@ void bgun_set_aim_pos(struct coord *coord) { struct player *player = g_Vars.currentplayer; - player->hands[HAND_RIGHT].aimpos.x = hand_get_xshift(HAND_RIGHT) + coord->x; + player->hands[HAND_RIGHT].aimpos.x = gset_get_xshift(HAND_RIGHT) + coord->x; player->hands[HAND_RIGHT].aimpos.y = coord->y; player->hands[HAND_RIGHT].aimpos.z = coord->z; - player->hands[HAND_LEFT].aimpos.x = hand_get_xshift(HAND_LEFT) + coord->x; + player->hands[HAND_LEFT].aimpos.x = gset_get_xshift(HAND_LEFT) + coord->x; player->hands[HAND_LEFT].aimpos.y = coord->y; player->hands[HAND_LEFT].aimpos.z = coord->z; } @@ -9362,7 +9362,7 @@ void bgun_set_ammo_quantity(s32 ammotype, s32 quantity) funcnum = FUNC_SECONDARY; } - if (funcnum != -1 && weapon_has_ammo_flag(weaponnum, funcnum, AMMOFLAG_NORESERVE)) { + if (funcnum != -1 && gset_has_ammo_flag(weaponnum, funcnum, AMMOFLAG_NORESERVE)) { // For cloak and combat boost, ammo cannot be held outside of the weapon. // So just add it to the loaded clip. player->hands[0].loadedammo[funcnum] += quantity; @@ -9378,7 +9378,7 @@ void bgun_set_ammo_quantity(s32 ammotype, s32 quantity) magamount = 0; // For throwable items, the capacity applies to reserve + loaded - if (funcnum != -1 && weapon_has_ammo_flag(weaponnum, funcnum, AMMOFLAG_EQUIPPEDISRESERVE)) { + if (funcnum != -1 && gset_has_ammo_flag(weaponnum, funcnum, AMMOFLAG_EQUIPPEDISRESERVE)) { magamount = player->hands[0].loadedammo[funcnum] + player->hands[1].loadedammo[funcnum]; } @@ -9399,7 +9399,7 @@ s32 bgun_get_reserved_ammo_count(s32 ammotype) for (i = 0; i < 2; i++) { if (player->hands[i].inuse) { for (j = 0; j < 2; j++) { - if (player->gunctrl.ammotypes[j] == ammotype && weapon_has_ammo_flag(player->hands[i].gset.weaponnum, j, AMMOFLAG_NORESERVE)) { + if (player->gunctrl.ammotypes[j] == ammotype && gset_has_ammo_flag(player->hands[i].gset.weaponnum, j, AMMOFLAG_NORESERVE)) { total = total + player->hands[i].loadedammo[j]; } } @@ -9483,7 +9483,7 @@ void bgun_give_max_ammo(bool force) u32 bgun_get_ammo_type_for_weapon(u32 weaponnum, u32 func) { - struct weapon *weapon = weapon_find_by_id(weaponnum); + struct weapon *weapon = gset_get_weapondef(weaponnum); if (!weapon) { return 0; @@ -9498,7 +9498,7 @@ u32 bgun_get_ammo_type_for_weapon(u32 weaponnum, u32 func) s32 bgun_get_ammo_qty_for_weapon(u32 weaponnum, u32 func) { - struct weapon *weapon = weapon_find_by_id(weaponnum); + struct weapon *weapon = gset_get_weapondef(weaponnum); if (weapon) { struct inventory_ammo *ammo = weapon->ammos[func]; @@ -9513,7 +9513,7 @@ s32 bgun_get_ammo_qty_for_weapon(u32 weaponnum, u32 func) void bgun_set_ammo_qty_for_weapon(u32 weaponnum, u32 func, u32 quantity) { - struct weapon *weapon = weapon_find_by_id(weaponnum); + struct weapon *weapon = gset_get_weapondef(weaponnum); if (weapon) { struct inventory_ammo *ammo = weapon->ammos[func]; @@ -9526,7 +9526,7 @@ void bgun_set_ammo_qty_for_weapon(u32 weaponnum, u32 func, u32 quantity) s32 bgun_get_ammo_capacity_for_weapon(s32 weaponnum, s32 func) { - struct weapon *weapon = weapon_find_by_id(weaponnum); + struct weapon *weapon = gset_get_weapondef(weaponnum); struct inventory_ammo *ammo = weapon->ammos[func]; if (ammo) { @@ -9938,7 +9938,7 @@ Gfx *bgun_draw_hud(Gfx *gdl) s32 reserveheight = 36; s32 clipheight = 57; s32 xpos; - struct weapon *weapon = weapon_find_by_id(player->gunctrl.weaponnum); + struct weapon *weapon = gset_get_weapondef(player->gunctrl.weaponnum); u32 alpha; u32 fncolour; s32 funcnum; @@ -10057,9 +10057,9 @@ Gfx *bgun_draw_hud(Gfx *gdl) // Draw weapon name and function name if (options_get_show_gun_function(g_Vars.currentplayerstats->mpindex)) { #if VERSION >= VERSION_NTSC_1_0 - func = weapon_get_function_by_id(hand->gset.weaponnum, funcnum); + func = gset_get_funcdef_by_weaponnum_funcnum(hand->gset.weaponnum, funcnum); #else - func = weapon_get_function_by_id(hand->gset.weaponnum, hand->gset.weaponfunc); + func = gset_get_funcdef_by_weaponnum_funcnum(hand->gset.weaponnum, hand->gset.weaponfunc); #endif nameid = inv_get_name_id_by_index(inv_get_current_index()); str = lang_get(nameid); @@ -10406,9 +10406,9 @@ Gfx *bgun_draw_sight(Gfx *gdl) { if (g_Vars.currentplayer->gunsightoff == 0 && !g_Vars.currentplayer->mpmenuon) { // Player is aiming with R - gdl = sight_draw(gdl, true, current_player_get_sight()); + gdl = sight_draw(gdl, true, gset_get_sight()); } else { - gdl = sight_draw(gdl, false, current_player_get_sight()); + gdl = sight_draw(gdl, false, gset_get_sight()); } return gdl; @@ -10419,7 +10419,7 @@ void bgun0f0abd30(s32 handnum) struct player *player = g_Vars.currentplayer; struct hand *hand = &player->hands[handnum]; struct gunctrl *gunctrl = &player->gunctrl; - struct weapon *weapon = weapon_find_by_id(hand->gset.weaponnum); + struct weapon *weapon = gset_get_weapondef(hand->gset.weaponnum); s32 i; for (i = 0; i < 2; i++) { diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 4c7e13722..cea3c2a2b 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -74,7 +74,7 @@ bool bmove_is_autoaim_y_enabled(void) bool bmove_is_autoaim_y_enabled_for_current_weapon(void) { - struct weaponfunc *func = current_player_get_weapon_function(0); + struct weaponfunc *func = gset_get_current_funcdef(0); if (func) { if (func->flags & FUNCFLAG_NOAUTOAIM) { @@ -132,7 +132,7 @@ bool bmove_is_autoaim_x_enabled(void) bool bmove_is_autoaim_x_enabled_for_current_weapon(void) { - struct weaponfunc *func = current_player_get_weapon_function(0); + struct weaponfunc *func = gset_get_current_funcdef(0); if (func) { if (func->flags & FUNCFLAG_NOAUTOAIM) { @@ -640,7 +640,7 @@ void bmove_process_input(bool allowc1x, bool allowc1y, bool allowc1buttons, bool controlmode = options_get_control_mode(g_Vars.currentplayerstats->mpindex); weaponnum = bgun_get_weapon_num(HAND_RIGHT); - canmanualzoom = weapon_has_aim_flag(weaponnum, INVAIMFLAG_MANUALZOOM); + canmanualzoom = gset_has_aim_flag(weaponnum, INVAIMFLAG_MANUALZOOM); contpad1 = options_get_contpad_num1(g_Vars.currentplayerstats->mpindex); c1stickx = allowc1x ? joy_get_stick_x(contpad1) : 0; @@ -1070,7 +1070,7 @@ void bmove_process_input(bool allowc1x, bool allowc1y, bool allowc1buttons, bool g_Vars.currentplayer->waitforzrelease = false; } - if (weapon_has_flag(bgun_get_weapon_num(HAND_RIGHT), WEAPONFLAG_FIRETOACTIVATE)) { + if (gset_has_weapon_flag(bgun_get_weapon_num(HAND_RIGHT), WEAPONFLAG_FIRETOACTIVATE)) { if (allowc1buttons && joy_get_buttons_pressed_this_frame(shootpad, shootallowedbuttons & Z_TRIG) && g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED) { @@ -1422,7 +1422,7 @@ void bmove_process_input(bool allowc1x, bool allowc1y, bool allowc1buttons, bool g_Vars.currentplayer->waitforzrelease = false; } - if (weapon_has_flag(bgun_get_weapon_num(HAND_RIGHT), WEAPONFLAG_FIRETOACTIVATE)) { + if (gset_has_weapon_flag(bgun_get_weapon_num(HAND_RIGHT), WEAPONFLAG_FIRETOACTIVATE)) { if ((c1buttonsthisframe & shootbuttons) && g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED) { movedata.btapcount++; @@ -1478,11 +1478,11 @@ void bmove_process_input(bool allowc1x, bool allowc1y, bool allowc1buttons, bool bgun_set_sight_visible(GUNSIGHTREASON_NOTAIMING, movedata.aiming); if (movedata.zoomoutfovpersec > 0) { - current_player_zoom_out(movedata.zoomoutfovpersec); + gset_zoom_out(movedata.zoomoutfovpersec); } if (movedata.zoominfovpersec > 0) { - current_player_zoom_in(movedata.zoominfovpersec); + gset_zoom_in(movedata.zoominfovpersec); } if (g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED && !g_MainIsEndscreen) { @@ -1523,12 +1523,12 @@ void bmove_process_input(bool allowc1x, bool allowc1y, bool allowc1buttons, bool } if (movedata.zooming) { - zoomfov = current_player_get_gun_zoom_fov(); + zoomfov = gset_get_gun_zoom_fov(); } if (bgun_get_weapon_num(HAND_RIGHT) == WEAPON_AR34 && g_Vars.currentplayer->hands[HAND_RIGHT].gset.weaponfunc == FUNC_SECONDARY) { - zoomfov = current_player_get_gun_zoom_fov(); + zoomfov = gset_get_gun_zoom_fov(); } if (zoomfov <= 0) { @@ -1757,7 +1757,7 @@ void bmove_process_input(bool allowc1x, bool allowc1y, bool allowc1buttons, bool && (bmove_is_autoaim_x_enabled_for_current_weapon() || bmove_is_autoaim_y_enabled_for_current_weapon()) && g_Vars.currentplayer->autoxaimprop && g_Vars.currentplayer->autoyaimprop - && weapon_has_aim_flag(weaponnum, INVAIMFLAG_AUTOAIM) + && gset_has_aim_flag(weaponnum, INVAIMFLAG_AUTOAIM) ) || (bgun_get_weapon_num(HAND_RIGHT) == WEAPON_CMP150 && g_Vars.currentplayer->hands[HAND_RIGHT].gset.weaponfunc == FUNC_SECONDARY)) { // Auto aim - move crosshair towards target diff --git a/src/game/bot.c b/src/game/bot.c index 0f02e8543..9cbc46830 100644 --- a/src/game/bot.c +++ b/src/game/bot.c @@ -422,7 +422,7 @@ u32 bot_pickup_prop(struct prop *prop, struct chrdata *chr) } if (itemtype) { - struct weapon *weapondef = weapon_find_by_id(weapon->weaponnum); + struct weapon *weapondef = gset_get_weapondef(weapon->weaponnum); s32 originalpad = botinv_get_weapon_pad(chr, weapon->weaponnum); s32 currentpad = obj->pad; @@ -552,7 +552,7 @@ bool bot_test_prop_for_pickup(struct prop *prop, struct chrdata *chr) if (obj->type == OBJTYPE_WEAPON) { weaponobj = prop->weapon; itemtype = botinv_get_item_type(chr, weaponobj->weaponnum); - weapon = weapon_find_by_id(weaponobj->weaponnum); + weapon = gset_get_weapondef(weaponobj->weaponnum); singleonly = weapon && (weapon->flags & WEAPONFLAG_DUALWIELD) == 0; if (weaponobj->weaponnum != WEAPON_BRIEFCASE2) { @@ -3536,7 +3536,7 @@ void bot_tick_unpaused(struct chrdata *chr) botact_try_remove_ammo_from_reserve(aibot, aibot->weaponnum, aibot->gunfunc, 1); botact_throw(chr); - func = weapon_get_function_by_id(aibot->weaponnum, aibot->gunfunc); + func = gset_get_funcdef_by_weaponnum_funcnum(aibot->weaponnum, aibot->gunfunc); if (func && (func->flags & FUNCFLAG_DISCARDWEAPON)) { botinv_remove_item(chr, aibot->weaponnum); @@ -3626,7 +3626,7 @@ void bot_tick_unpaused(struct chrdata *chr) } #endif - func = weapon_get_function_by_id(aibot->weaponnum, aibot->gunfunc); + func = gset_get_funcdef_by_weaponnum_funcnum(aibot->weaponnum, aibot->gunfunc); if (func && (func->flags & (FUNCFLAG_BURST3 | FUNCFLAG_BURST2)) diff --git a/src/game/botact.c b/src/game/botact.c index f483d0ded..945552c37 100644 --- a/src/game/botact.c +++ b/src/game/botact.c @@ -22,7 +22,7 @@ s32 botact_get_ammo_type_by_function(s32 weaponnum, s32 funcnum) { if (weaponnum >= WEAPON_FALCON2 && weaponnum <= WEAPON_SUICIDEPILL) { - struct inventory_ammo *ammo = weapon_get_ammo_by_function(weaponnum, funcnum); + struct inventory_ammo *ammo = gset_get_ammodef(weaponnum, funcnum); if (ammo) { return ammo->type; @@ -35,7 +35,7 @@ s32 botact_get_ammo_type_by_function(s32 weaponnum, s32 funcnum) s32 botact_get_clip_capacity_by_function(s32 weaponnum, u32 funcnum) { if (weaponnum >= WEAPON_FALCON2 && weaponnum <= WEAPON_SUICIDEPILL) { - struct inventory_ammo *ammo = weapon_get_ammo_by_function(weaponnum, funcnum); + struct inventory_ammo *ammo = gset_get_ammodef(weaponnum, funcnum); if (ammo) { return ammo->clipsize; @@ -407,7 +407,7 @@ s32 botact_get_shoot_interval60(s32 weaponnum, s32 funcnum) { s32 stack[2]; s32 result = 1; - struct weapon *weapon = weapon_find_by_id(weaponnum); + struct weapon *weapon = gset_get_weapondef(weaponnum); if (weapon) { struct weaponfunc *func = weapon->functions[funcnum]; diff --git a/src/game/botinv.c b/src/game/botinv.c index 1e6a7b9ac..4c085da10 100644 --- a/src/game/botinv.c +++ b/src/game/botinv.c @@ -1100,7 +1100,7 @@ bool botinv_switch_to_weapon(struct chrdata *chr, s32 weaponnum, s32 funcnum) } } - func = weapon_get_function_by_id(weaponnum, funcnum); + func = gset_get_funcdef_by_weaponnum_funcnum(weaponnum, funcnum); aibot->ismeleeweapon = func && func->type == INVENTORYFUNCTYPE_MELEE; @@ -1136,7 +1136,7 @@ void botinv_drop(struct chrdata *chr, s32 weaponnum, u8 dropall) if ((item->type == INVITEMTYPE_WEAP || item->type == INVITEMTYPE_DUAL) && (dropall || weaponnum == item->type_weap.weapon1)) { - if (!weapon_has_flag(item->type_weap.weapon1, WEAPONFLAG_UNDROPPABLE) + if (!gset_has_weapon_flag(item->type_weap.weapon1, WEAPONFLAG_UNDROPPABLE) || (g_Vars.normmplayerisrunning && g_MpSetup.scenario == MPSCENARIO_HACKERCENTRAL && item->type_weap.weapon1 == WEAPON_DATAUPLINK)) { diff --git a/src/game/chr.c b/src/game/chr.c index 6b4a5d1de..de69b8d40 100644 --- a/src/game/chr.c +++ b/src/game/chr.c @@ -4606,7 +4606,7 @@ void chr_hit(struct shotdata *shotdata, struct hit *hit) struct coord sp98; s16 hitpos_s16[3]; u8 ismelee = false; - struct weaponfunc *func = gset_get_weapon_function(&shotdata->gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(&shotdata->gset); f32 shield; if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_MELEE) { @@ -4924,7 +4924,7 @@ struct prop *chr_get_held_usable_prop(struct chrdata *chr, s32 hand) if (prop) { struct weaponobj *weapon = prop->weapon; - if (!weapon_has_flag(weapon->weaponnum, WEAPONFLAG_AICANUSE)) { + if (!gset_has_weapon_flag(weapon->weaponnum, WEAPONFLAG_AICANUSE)) { prop = NULL; } } diff --git a/src/game/chraction.c b/src/game/chraction.c index b017188af..04cbc96ad 100644 --- a/src/game/chraction.c +++ b/src/game/chraction.c @@ -1472,7 +1472,7 @@ bool weapon_is_one_handed(struct prop *prop) { if (prop) { struct weaponobj *weapon = prop->weapon; - return weapon_has_flag(weapon->weaponnum, WEAPONFLAG_ONEHANDED); + return gset_has_weapon_flag(weapon->weaponnum, WEAPONFLAG_ONEHANDED); } return false; @@ -4347,7 +4347,7 @@ void chr_damage(struct chrdata *chr, f32 damage, struct coord *vector, struct gs gset = &gset2; } - func = gset_get_weapon_function(gset); + func = gset_get_funcdef_by_gset(gset); ismelee = func && (func->type & 0xff) == INVENTORYFUNCTYPE_MELEE; makedizzy = race != RACE_DRCAROLL && gset_has_function_flags(gset, FUNCFLAG_MAKEDIZZY); @@ -6988,7 +6988,7 @@ bool chr_try_attack_amount(struct chrdata *chr, u32 arg1, u32 arg2, u8 lower, u8 percentage = 0; } - ammo = weapon_get_ammo_by_function(weapon->weaponnum, 0); + ammo = gset_get_ammodef(weapon->weaponnum, 0); if (ammo) { quantity = ammo->clipsize * percentage; @@ -10094,7 +10094,7 @@ void chr_tick_shoot(struct chrdata *chr, s32 handnum) struct coord sp15c; Mtxf projectilemtx; Mtxf yrotmtx; - struct weapon *weapondef = weapon_find_by_id(gset.weaponnum); + struct weapon *weapondef = gset_get_weapondef(gset.weaponnum); struct weaponfunc_shootprojectile *func = weapondef->functions[gset.weaponfunc]; // Handle creating the projectile diff --git a/src/game/chraicommands.c b/src/game/chraicommands.c index 894341c80..9a5cba1c1 100644 --- a/src/game/chraicommands.c +++ b/src/game/chraicommands.c @@ -9213,7 +9213,7 @@ bool ai_if_player_using_device(void) u32 prevplayernum = g_Vars.currentplayernum; set_current_player_num(playernum); - if (current_player_get_device_state(cmd[3]) == DEVICESTATE_ACTIVE) { + if (gset_get_device_state(cmd[3]) == DEVICESTATE_ACTIVE) { active = true; } diff --git a/src/game/gset.c b/src/game/gset.c index 78884d353..041646427 100644 --- a/src/game/gset.c +++ b/src/game/gset.c @@ -16,7 +16,7 @@ #include "data.h" #include "types.h" -struct weapon *weapon_find_by_id(s32 itemid) +struct weapon *gset_get_weapondef(s32 itemid) { if (itemid < 0) { return NULL; @@ -29,9 +29,9 @@ struct weapon *weapon_find_by_id(s32 itemid) return g_Weapons[itemid]; } -struct weaponfunc *weapon_get_function_by_id(u32 weaponnum, u32 which) +struct weaponfunc *gset_get_funcdef_by_weaponnum_funcnum(u32 weaponnum, u32 which) { - struct weapon *weapon = weapon_find_by_id(weaponnum); + struct weapon *weapon = gset_get_weapondef(weaponnum); if (weapon) { return weapon->functions[which]; @@ -40,9 +40,9 @@ struct weaponfunc *weapon_get_function_by_id(u32 weaponnum, u32 which) return NULL; } -struct weaponfunc *gset_get_weapon_function2(struct gset *gset) +struct weaponfunc *gset_get_funcdef_by_gset2(struct gset *gset) { - struct weapon *weapon = weapon_find_by_id(gset->weaponnum); + struct weapon *weapon = gset_get_weapondef(gset->weaponnum); if (weapon) { return weapon->functions[gset->weaponfunc]; @@ -51,7 +51,7 @@ struct weaponfunc *gset_get_weapon_function2(struct gset *gset) return NULL; } -struct weaponfunc *gset_get_weapon_function(struct gset *gset) +struct weaponfunc *gset_get_funcdef_by_gset(struct gset *gset) { struct weapon *weapon = g_Weapons[gset->weaponnum]; @@ -62,7 +62,7 @@ struct weaponfunc *gset_get_weapon_function(struct gset *gset) return NULL; } -struct weaponfunc *weapon_get_function(struct gset *gset, s32 which) +struct weaponfunc *gset_get_funcdef_by_gset_funcnum(struct gset *gset, s32 which) { struct weapon *weapon = g_Weapons[gset->weaponnum]; @@ -73,9 +73,9 @@ struct weaponfunc *weapon_get_function(struct gset *gset, s32 which) return NULL; } -struct weaponfunc *current_player_get_weapon_function(u32 hand) +struct weaponfunc *gset_get_current_funcdef(u32 hand) { - struct weapon *weapon = weapon_find_by_id(g_Vars.currentplayer->hands[hand].gset.weaponnum); + struct weapon *weapon = gset_get_weapondef(g_Vars.currentplayer->hands[hand].gset.weaponnum); if (weapon) { return weapon->functions[g_Vars.currentplayer->hands[hand].gset.weaponfunc]; @@ -84,9 +84,9 @@ struct weaponfunc *current_player_get_weapon_function(u32 hand) return NULL; } -u32 weapon_get_num_functions(u32 weaponnum) +u32 gset_get_num_functions(u32 weaponnum) { - struct weapon *weapon = weapon_find_by_id(weaponnum); + struct weapon *weapon = gset_get_weapondef(weaponnum); s32 i; if (!weapon) { @@ -104,7 +104,7 @@ u32 weapon_get_num_functions(u32 weaponnum) struct invaimsettings *gset_get_aim_settings(struct gset *gset) { - struct weapon *weapon = weapon_find_by_id(gset->weaponnum); + struct weapon *weapon = gset_get_weapondef(gset->weaponnum); if (weapon) { return weapon->aimsettings; @@ -113,10 +113,10 @@ struct invaimsettings *gset_get_aim_settings(struct gset *gset) return &invaimsettings_default; } -struct inventory_ammo *weapon_get_ammo_by_function(u32 weaponnum, u32 funcnum) +struct inventory_ammo *gset_get_ammodef(u32 weaponnum, u32 funcnum) { - struct weapon *weapon = weapon_find_by_id(weaponnum); - struct weaponfunc *func = weapon_get_function_by_id(weaponnum, funcnum); + struct weapon *weapon = gset_get_weapondef(weaponnum); + struct weaponfunc *func = gset_get_funcdef_by_weaponnum_funcnum(weaponnum, funcnum); if (func && weapon && func->ammoindex >= 0) { return weapon->ammos[func->ammoindex]; @@ -125,9 +125,9 @@ struct inventory_ammo *weapon_get_ammo_by_function(u32 weaponnum, u32 funcnum) return NULL; } -void current_player_get_weapon_pos(struct coord *pos) +void gset_get_weapon_pos(struct coord *pos) { - struct weapon *weapon = weapon_find_by_id(bgun_get_weapon_num(HAND_RIGHT)); + struct weapon *weapon = gset_get_weapondef(bgun_get_weapon_num(HAND_RIGHT)); if (weapon) { pos->x = weapon->posx; @@ -136,9 +136,9 @@ void current_player_get_weapon_pos(struct coord *pos) } } -void current_player_set_weapon_pos(struct coord *pos) +void gset_set_weapon_pos(struct coord *pos) { - struct weapon *weapon = weapon_find_by_id(bgun_get_weapon_num(HAND_RIGHT)); + struct weapon *weapon = gset_get_weapondef(bgun_get_weapon_num(HAND_RIGHT)); if (weapon) { weapon->posx = pos->x; @@ -147,18 +147,18 @@ void current_player_set_weapon_pos(struct coord *pos) } } -f32 hand_get_xshift(s32 handnum) +f32 gset_get_xshift(s32 handnum) { return g_Vars.currentplayer->hands[handnum].xshift; } -f32 hand_get_xpos(s32 hand) +f32 gset_get_xpos(s32 hand) { f32 x; struct weapon *weapon; if (hand == 0) { - weapon = weapon_find_by_id(bgun_get_weapon_num2(0)); + weapon = gset_get_weapondef(bgun_get_weapon_num2(0)); x = weapon->posx; if (PLAYERCOUNT() == 2 && options_get_screen_split() == SCREENSPLIT_VERTICAL) { @@ -169,7 +169,7 @@ f32 hand_get_xpos(s32 hand) } } } else { - weapon = weapon_find_by_id(bgun_get_weapon_num2(1)); + weapon = gset_get_weapondef(bgun_get_weapon_num2(1)); x = -weapon->posx; if (PLAYERCOUNT() == 2 && options_get_screen_split() == SCREENSPLIT_VERTICAL) { @@ -184,7 +184,7 @@ f32 hand_get_xpos(s32 hand) return x; } -f32 current_player_get_gun_zoom_fov(void) +f32 gset_get_gun_zoom_fov(void) { s32 index = -1; struct weapon *weapon; @@ -205,7 +205,7 @@ f32 current_player_get_gun_zoom_fov(void) return g_Vars.currentplayer->gunzoomfovs[index]; } - weapon = weapon_find_by_id(bgun_get_weapon_num2(0)); + weapon = gset_get_weapondef(bgun_get_weapon_num2(0)); if (weapon) { f32 fov = weapon->aimsettings->zoomfov; @@ -215,7 +215,7 @@ f32 current_player_get_gun_zoom_fov(void) return 0; } -void current_player_zoom_out(f32 fovpersec) +void gset_zoom_out(f32 fovpersec) { s32 index = -1; @@ -246,7 +246,7 @@ void current_player_zoom_out(f32 fovpersec) } } -void current_player_zoom_in(f32 fovpersec) +void gset_zoom_in(f32 fovpersec) { s32 index = -1; @@ -277,9 +277,9 @@ void current_player_zoom_in(f32 fovpersec) } } -bool weapon_has_flag(s32 itemid, u32 flag) +bool gset_has_weapon_flag(s32 itemid, u32 flag) { - struct weapon *weapon = weapon_find_by_id(itemid); + struct weapon *weapon = gset_get_weapondef(itemid); if (!weapon) { return false; @@ -288,9 +288,9 @@ bool weapon_has_flag(s32 itemid, u32 flag) return (weapon->flags & flag) != 0; } -bool weapon_has_aim_flag(s32 weaponnum, u32 flag) +bool gset_has_aim_flag(s32 weaponnum, u32 flag) { - struct weapon *weapon = weapon_find_by_id(weaponnum); + struct weapon *weapon = gset_get_weapondef(weaponnum); if (!weapon) { return false; @@ -299,9 +299,9 @@ bool weapon_has_aim_flag(s32 weaponnum, u32 flag) return (weapon->aimsettings->flags & flag) != 0; } -bool weapon_has_ammo_flag(s32 weaponnum, s32 funcnum, u32 flag) +bool gset_has_ammo_flag(s32 weaponnum, s32 funcnum, u32 flag) { - struct weapon *weapon = weapon_find_by_id(weaponnum); + struct weapon *weapon = gset_get_weapondef(weaponnum); struct inventory_ammo *ammo; if (weapon == NULL) { @@ -317,19 +317,19 @@ bool weapon_has_ammo_flag(s32 weaponnum, s32 funcnum, u32 flag) return false; } -void func0f0b18ac(s32 arg0) +void gset_stub1(s32 arg0) { // empty } -void func0f0b18b4(s32 arg0) +void gset_stub2(s32 arg0) { // empty } -s32 current_player_get_device_state(s32 weaponnum) +s32 gset_get_device_state(s32 weaponnum) { - struct weapon *weapon = weapon_find_by_id(weaponnum); + struct weapon *weapon = gset_get_weapondef(weaponnum); s32 i; if (!weapon) { @@ -353,9 +353,9 @@ s32 current_player_get_device_state(s32 weaponnum) return DEVICESTATE_UNEQUIPPED; } -void current_player_set_device_active(s32 weaponnum, bool active) +void gset_set_device_active(s32 weaponnum, bool active) { - struct weapon *weapon = weapon_find_by_id(weaponnum); + struct weapon *weapon = gset_get_weapondef(weaponnum); s32 i; if (!weapon) { @@ -373,17 +373,17 @@ void current_player_set_device_active(s32 weaponnum, bool active) } g_Vars.currentplayer->devicesactive |= devicefunc->device; - return; + } else { + g_Vars.currentplayer->devicesactive &= ~devicefunc->device; } - g_Vars.currentplayer->devicesactive &= ~devicefunc->device; return; } } } } -u16 weapon_get_file_num(s32 weaponnum) +u16 gset_get_filenum(s32 weaponnum) { struct weapon *weapon = NULL; @@ -402,12 +402,12 @@ u16 weapon_get_file_num(s32 weaponnum) return 0; } -u16 weapon_get_file_num2(s32 weaponnum) +u16 gset_get_filenum2(s32 weaponnum) { - return weapon_get_file_num(weaponnum); + return gset_get_filenum(weaponnum); } -void gset_populate_from_current_player(s32 handnum, struct gset *gset) +void gset_populate(s32 handnum, struct gset *gset) { gset->weaponnum = g_Vars.currentplayer->gunctrl.weaponnum; gset->weaponfunc = g_Vars.currentplayer->hands[handnum].gset.weaponfunc; @@ -423,10 +423,10 @@ void gset_populate_from_current_player(s32 handnum, struct gset *gset) } } -struct inventory_ammo *gset_get_ammo_definition(struct gset *gset) +struct inventory_ammo *gset_get_current_ammodef(struct gset *gset) { - struct weaponfunc *func = gset_get_weapon_function(gset); - struct weapon *weapon = weapon_find_by_id(gset->weaponnum); + struct weaponfunc *func = gset_get_funcdef_by_gset(gset); + struct weapon *weapon = gset_get_weapondef(gset->weaponnum); if (func && func->ammoindex >= 0) { return weapon->ammos[func->ammoindex]; @@ -437,7 +437,7 @@ struct inventory_ammo *gset_get_ammo_definition(struct gset *gset) u8 gset_get_single_penetration(struct gset *gset) { - struct weaponfunc *func = gset_get_weapon_function(gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(gset); if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) { struct weaponfunc_shoot *funcshoot = (struct weaponfunc_shoot *)func; @@ -447,10 +447,10 @@ u8 gset_get_single_penetration(struct gset *gset) return 0; } -s32 hand_get_casing_eject(struct gset *gset) +s32 gset_get_casing_type(struct gset *gset) { s32 result = 0; - struct inventory_ammo *ammo = gset_get_ammo_definition(gset); + struct inventory_ammo *ammo = gset_get_current_ammodef(gset); if (ammo) { result = ammo->casingeject; @@ -461,7 +461,7 @@ s32 hand_get_casing_eject(struct gset *gset) f32 gset_get_impact_force(struct gset *gset) { - struct weaponfunc *func = gset_get_weapon_function(gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(gset); f32 result = 0; if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) { @@ -474,7 +474,7 @@ f32 gset_get_impact_force(struct gset *gset) f32 gset_get_damage(struct gset *gset) { - struct weaponfunc *func = gset_get_weapon_function(gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(gset); f32 damage = 0; if (func) { @@ -512,7 +512,7 @@ f32 gset_get_damage(struct gset *gset) u8 gset_get_fireslot_duration(struct gset *gset) { #if VERSION >= VERSION_PAL_FINAL - struct weaponfunc *func = gset_get_weapon_function(gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(gset); u8 result = 0; if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) { @@ -526,7 +526,7 @@ u8 gset_get_fireslot_duration(struct gset *gset) return result; #else - struct weaponfunc *func = gset_get_weapon_function(gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(gset); if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) { struct weaponfunc_shoot *funcshoot = (struct weaponfunc_shoot *)func; @@ -539,7 +539,7 @@ u8 gset_get_fireslot_duration(struct gset *gset) u16 gset_get_single_shoot_sound(struct gset *gset) { - struct weaponfunc *func = gset_get_weapon_function(gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(gset); if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_SHOOT) { struct weaponfunc_shoot *funcshoot = (struct weaponfunc_shoot *)func; @@ -551,7 +551,7 @@ u16 gset_get_single_shoot_sound(struct gset *gset) bool gset_has_function_flags(struct gset *gset, u32 flags) { - struct weaponfunc *func = gset_get_weapon_function(gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(gset); if (func) { return (func->flags & flags) == flags; @@ -564,7 +564,7 @@ s8 weapon_get_num_ticks_per_shot(u32 weaponnum, u32 funcindex) { u32 stack[2]; s32 result = 0; - struct weapon *weapon = weapon_find_by_id(weaponnum); + struct weapon *weapon = gset_get_weapondef(weaponnum); struct weaponfunc *func = weapon->functions[funcindex]; if (func && func->type == INVENTORYFUNCTYPE_SHOOT_AUTOMATIC) { @@ -583,9 +583,9 @@ s8 weapon_get_num_ticks_per_shot(u32 weaponnum, u32 funcindex) return result; } -u32 current_player_get_sight(void) +u32 gset_get_sight(void) { - struct weaponfunc *func = weapon_get_function_by_id( + struct weaponfunc *func = gset_get_funcdef_by_weaponnum_funcnum( g_Vars.currentplayer->hands[HAND_RIGHT].gset.weaponnum, g_Vars.currentplayer->hands[HAND_RIGHT].gset.weaponfunc); @@ -657,7 +657,7 @@ u32 current_player_get_sight(void) void gset_get_noise_settings(struct gset *gset, struct noisesettings *dst) { struct noisesettings *settings = NULL; - struct weaponfunc *func = gset_get_weapon_function(gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(gset); if (func != NULL) { settings = func->noisesettings; @@ -674,7 +674,7 @@ void gset_get_noise_settings(struct gset *gset, struct noisesettings *dst) dst->decremspeed = settings->decremspeed; } -struct guncmd *hand_get_equip_anim(struct gset *gset) +struct guncmd *gset_get_equip_anim(struct gset *gset) { struct weapon *weapon = g_Weapons[gset->weaponnum]; @@ -685,7 +685,7 @@ struct guncmd *hand_get_equip_anim(struct gset *gset) return NULL; } -struct guncmd *hand_get_unequip_anim(struct gset *gset) +struct guncmd *gset_get_unequip_anim(struct gset *gset) { struct weapon *weapon = g_Weapons[gset->weaponnum]; @@ -696,7 +696,7 @@ struct guncmd *hand_get_unequip_anim(struct gset *gset) return NULL; } -struct guncmd *gset_get_pri_to_sec_anim(struct gset *gset) +struct guncmd *gset_get_pritosec_anim(struct gset *gset) { struct weapon *weapon = g_Weapons[gset->weaponnum]; @@ -707,7 +707,7 @@ struct guncmd *gset_get_pri_to_sec_anim(struct gset *gset) return NULL; } -struct guncmd *gset_get_sec_to_pri_anim(struct gset *gset) +struct guncmd *gset_get_sectopri_anim(struct gset *gset) { struct weapon *weapon = g_Weapons[gset->weaponnum]; diff --git a/src/game/gunfx.c b/src/game/gunfx.c index 079c9bccb..d99623f6d 100644 --- a/src/game/gunfx.c +++ b/src/game/gunfx.c @@ -670,8 +670,8 @@ void casing_create_for_hand(s32 handnum, f32 ground, Mtxf *mtx) f32 spc8[3][3]; s32 weaponnum = bgun_get_weapon_num(handnum); s32 casingtype = -1; - struct weaponfunc *func = gset_get_weapon_function2(&player->hands[handnum].gset); - struct weapon *weapondef = weapon_find_by_id(player->gunctrl.weaponnum); + struct weaponfunc *func = gset_get_funcdef_by_gset2(&player->hands[handnum].gset); + struct weapon *weapondef = gset_get_weapondef(player->gunctrl.weaponnum); struct weaponfunc_shoot *shootfunc = NULL; struct modeldef *modeldef; diff --git a/src/game/hudmsg.c b/src/game/hudmsg.c index 7323bb910..368307510 100644 --- a/src/game/hudmsg.c +++ b/src/game/hudmsg.c @@ -96,7 +96,7 @@ s32 hudmsg_is_zoom_range_visible(void) || g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) && var80075d60 == 2 - && current_player_get_sight() == SIGHT_ZOOM + && gset_get_sight() == SIGHT_ZOOM && g_Vars.currentplayer->cameramode != CAMERAMODE_EYESPY && g_Vars.currentplayer->cameramode != CAMERAMODE_THIRDPERSON; } @@ -250,7 +250,7 @@ Gfx *hudmsg_render_zoom_range(Gfx *gdl, u32 alpha) } // Left side - current zoom level - zoomfov = current_player_get_gun_zoom_fov(); + zoomfov = gset_get_gun_zoom_fov(); zoominfovy = g_Vars.currentplayer->zoominfovy; if (zoomfov == 0.0f || zoomfov == 60.0f) { diff --git a/src/game/inv.c b/src/game/inv.c index c093f7c53..0bbfce263 100644 --- a/src/game/inv.c +++ b/src/game/inv.c @@ -349,7 +349,7 @@ bool inv_has_double_weapon_inc_all_guns(s32 weapon1, s32 weapon2) if (g_Vars.currentplayer->equipallguns && weapon1 <= WEAPON_PSYCHOSISGUN && weapon1 == weapon2 && - weapon_has_flag(weapon1, WEAPONFLAG_DUALWIELD) && + gset_has_weapon_flag(weapon1, WEAPONFLAG_DUALWIELD) && inv_can_have_all_guns_weapon(weapon1)) { return true; } @@ -388,7 +388,7 @@ bool inv_give_single_weapon(s32 weaponnum) bool inv_give_double_weapon(s32 weapon1, s32 weapon2) { if (inv_has_double_weapon_exc_all_guns(weapon1, weapon2) == 0) { - if (weapon_has_flag(weapon1, WEAPONFLAG_DUALWIELD)) { + if (gset_has_weapon_flag(weapon1, WEAPONFLAG_DUALWIELD)) { struct invitem *item = inv_find_unused_slot(); if (item) { @@ -520,7 +520,7 @@ s32 inv_give_weapons_by_prop(struct prop *prop) } if (g_Vars.normmplayerisrunning - && weapon_has_flag(weaponnum, WEAPONFLAG_DUALWIELD) + && gset_has_weapon_flag(weaponnum, WEAPONFLAG_DUALWIELD) && !inv_has_double_weapon_exc_all_guns(weaponnum, weaponnum)) { struct invitem *invitem = inv_find_single_weapon(weaponnum); @@ -580,7 +580,7 @@ void inv_choose_cycle_forward_weapon(s32 *ptr1, s32 *ptr2, bool arg2) if (g_Vars.currentplayer->equipallguns) { s32 candidate = *ptr1; - if (weapon_has_flag(*ptr1, WEAPONFLAG_DUALWIELD) && *ptr2 != *ptr1) { + if (gset_has_weapon_flag(*ptr1, WEAPONFLAG_DUALWIELD) && *ptr2 != *ptr1) { // Switching to dual from single weapon1 = *ptr1; weapon2 = *ptr1; @@ -648,7 +648,7 @@ void inv_choose_cycle_back_weapon(s32 *ptr1, s32 *ptr2, bool arg2) if (g_Vars.currentplayer->equipallguns) { s32 candidate = *ptr1; - if (weapon_has_flag(weapon1, WEAPONFLAG_DUALWIELD) && weapon1 == weapon2) { + if (gset_has_weapon_flag(weapon1, WEAPONFLAG_DUALWIELD) && weapon1 == weapon2) { // Switching from dual to single weapon1 = candidate; weapon2 = WEAPON_NONE; @@ -662,7 +662,7 @@ void inv_choose_cycle_back_weapon(s32 *ptr1, s32 *ptr2, bool arg2) } } while ((arg2 && !bgun0f0a1a10(candidate)) || !inv_can_have_all_guns_weapon(candidate)); - if (weapon_has_flag(candidate, WEAPONFLAG_DUALWIELD)) { + if (gset_has_weapon_flag(candidate, WEAPONFLAG_DUALWIELD)) { weapon1 = candidate; weapon2 = candidate; } else { @@ -1106,14 +1106,14 @@ void inv_increment_held_time(s32 weapon1, s32 weapon2) s32 leastusedindex; s32 i; - if (!weapon_has_flag(weapon1, WEAPONFLAG_TRACKTIMEUSED)) { + if (!gset_has_weapon_flag(weapon1, WEAPONFLAG_TRACKTIMEUSED)) { return; } leastusedtime = 0x7fffffff; leastusedindex = 0; - if (!weapon_has_flag(weapon2, WEAPONFLAG_TRACKTIMEUSED)) { + if (!gset_has_weapon_flag(weapon2, WEAPONFLAG_TRACKTIMEUSED)) { weapon2 = 0; } diff --git a/src/game/lv.c b/src/game/lv.c index add3df4cf..c895407df 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -1202,7 +1202,7 @@ Gfx *lv_render(Gfx *gdl) if (PLAYERCOUNT() == 1 || g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0 - || (weapon_has_flag(bgun_get_weapon_num(HAND_RIGHT), WEAPONFLAG_AIMTRACK) && bmove_is_in_sight_aim_mode())) { + || (gset_has_weapon_flag(bgun_get_weapon_num(HAND_RIGHT), WEAPONFLAG_AIMTRACK) && bmove_is_in_sight_aim_mode())) { g_Vars.currentplayer->lookingatprop.prop = prop_find_aiming_at(HAND_RIGHT, false, FINDPROPCONTEXT_QUERY); if (g_Vars.currentplayer->lookingatprop.prop) { @@ -1236,7 +1236,7 @@ Gfx *lv_render(Gfx *gdl) if (gset_has_function_flags(&g_Vars.currentplayer->hands[0].gset, FUNCFLAG_THREATDETECTOR)) { lv_find_threats(); - } else if (weapon_has_flag(bgun_get_weapon_num(HAND_RIGHT), WEAPONFLAG_AIMTRACK)) { + } else if (gset_has_weapon_flag(bgun_get_weapon_num(HAND_RIGHT), WEAPONFLAG_AIMTRACK)) { s32 j; if (fr_is_in_training() diff --git a/src/game/mainmenu.c b/src/game/mainmenu.c index 86ee3f825..21b13087c 100644 --- a/src/game/mainmenu.c +++ b/src/game/mainmenu.c @@ -3654,8 +3654,8 @@ u8 var80072d88 = 255; char *inv_menu_text_primary_function(struct menuitem *item) { - struct weaponfunc *primaryfunc = weapon_get_function_by_id(g_InventoryWeapon, 0); - struct weaponfunc *secondaryfunc = weapon_get_function_by_id(g_InventoryWeapon, 1); + struct weaponfunc *primaryfunc = gset_get_funcdef_by_weaponnum_funcnum(g_InventoryWeapon, 0); + struct weaponfunc *secondaryfunc = gset_get_funcdef_by_weaponnum_funcnum(g_InventoryWeapon, 1); if (primaryfunc && secondaryfunc) { return lang_get(primaryfunc->name); @@ -3666,8 +3666,8 @@ char *inv_menu_text_primary_function(struct menuitem *item) char *inv_menu_text_secondary_function(struct menuitem *item) { - struct weaponfunc *primaryfunc = weapon_get_function_by_id(g_InventoryWeapon, 0); - struct weaponfunc *secondaryfunc = weapon_get_function_by_id(g_InventoryWeapon, 1); + struct weaponfunc *primaryfunc = gset_get_funcdef_by_weaponnum_funcnum(g_InventoryWeapon, 0); + struct weaponfunc *secondaryfunc = gset_get_funcdef_by_weaponnum_funcnum(g_InventoryWeapon, 1); if (secondaryfunc) { return lang_get(secondaryfunc->name); @@ -3778,12 +3778,12 @@ void func0f105948(s32 weaponnum) useindex = 0; } - if (weapon_has_flag(weaponnum, WEAPONFLAG_HIDEMENUMODEL) == false && (u32)wantindex >= 0 && useindex >= 0) { - weapon = weapon_find_by_id(weaponnum); + if (gset_has_weapon_flag(weaponnum, WEAPONFLAG_HIDEMENUMODEL) == false && (u32)wantindex >= 0 && useindex >= 0) { + weapon = gset_get_weapondef(weaponnum); g_Menus[g_MpPlayerNum].menumodel.loaddelay = 8; g_Menus[g_MpPlayerNum].menumodel.curparams = 0; - g_Menus[g_MpPlayerNum].menumodel.newparams = MENUMODELPARAMS_SET_FILENUM(weapon_get_file_num(weaponnum)); + g_Menus[g_MpPlayerNum].menumodel.newparams = MENUMODELPARAMS_SET_FILENUM(gset_get_filenum(weaponnum)); g_Menus[g_MpPlayerNum].menumodel.curposx = g_Menus[g_MpPlayerNum].menumodel.newposx = 0; g_Menus[g_MpPlayerNum].menumodel.curposy = g_Menus[g_MpPlayerNum].menumodel.newposy = 0; @@ -3862,7 +3862,7 @@ MenuDialogHandlerResult inventory_menu_dialog(s32 operation, struct menudialogde */ char *inv_menu_text_weapon_name(struct menuitem *item) { - struct weapon *weapon = weapon_find_by_id(g_InventoryWeapon); + struct weapon *weapon = gset_get_weapondef(g_InventoryWeapon); if (weapon) { if (weapon->manufacturer == L_GUN_000) { // "\n" @@ -3880,7 +3880,7 @@ char *inv_menu_text_weapon_name(struct menuitem *item) */ char *inv_menu_text_weapon_manufacturer(struct menuitem *item) { - struct weapon *weapon = weapon_find_by_id(g_InventoryWeapon); + struct weapon *weapon = gset_get_weapondef(g_InventoryWeapon); u32 textid = L_GUN_000; // "\n" if (weapon) { @@ -3891,7 +3891,7 @@ char *inv_menu_text_weapon_manufacturer(struct menuitem *item) return lang_get(textid); } - weapon = weapon_find_by_id(g_InventoryWeapon); + weapon = gset_get_weapondef(g_InventoryWeapon); if (weapon) { return lang_get(weapon->name); @@ -3902,7 +3902,7 @@ char *inv_menu_text_weapon_manufacturer(struct menuitem *item) char *inv_menu_text_weapon_description(struct menuitem *item) { - struct weapon *weapon = weapon_find_by_id(g_InventoryWeapon); + struct weapon *weapon = gset_get_weapondef(g_InventoryWeapon); if (weapon) { if (g_InventoryWeapon == WEAPON_EYESPY && g_Vars.currentplayer->eyespy) { @@ -4175,16 +4175,16 @@ MenuItemHandlerResult menuhandler_inventory_list(s32 operation, struct menuitem bool equippable = true; if (weaponnum != WEAPON_NONE) { - s32 state = current_player_get_device_state(weaponnum); + s32 state = gset_get_device_state(weaponnum); if (state != DEVICESTATE_UNEQUIPPED) { equippable = false; if (data->list.unk04 == 0) { if (state == DEVICESTATE_INACTIVE) { - current_player_set_device_active(weaponnum, true); + gset_set_device_active(weaponnum, true); } else { - current_player_set_device_active(weaponnum, false); + gset_set_device_active(weaponnum, false); } } } @@ -4213,7 +4213,7 @@ MenuItemHandlerResult menuhandler_inventory_list(s32 operation, struct menuitem s32 weaponnum = inv_get_weapon_num_by_index(data->list.value); if (weaponnum != WEAPON_NONE) { - s32 state = current_player_get_device_state(weaponnum); + s32 state = gset_get_device_state(weaponnum); if (state != DEVICESTATE_UNEQUIPPED) { data->list.unk04 = state; diff --git a/src/game/mplayer/ingame.c b/src/game/mplayer/ingame.c index b3c86d138..221100e54 100644 --- a/src/game/mplayer/ingame.c +++ b/src/game/mplayer/ingame.c @@ -354,7 +354,7 @@ struct menudialogdef g_MpPauseControlMenuDialog = { #if VERSION >= VERSION_JPN_FINAL char *mp_menu_text_weapon_description(struct menuitem *item) { - struct weapon *weapondef = weapon_find_by_id(g_Menus[g_MpPlayerNum].training.weaponnum); + struct weapon *weapondef = gset_get_weapondef(g_Menus[g_MpPlayerNum].training.weaponnum); if (weapondef != NULL) { if (g_Menus[g_MpPlayerNum].training.weaponnum == WEAPON_EYESPY) { @@ -425,7 +425,7 @@ char *mp_menu_text_weapon_description(struct menuitem *item) #else char *mp_menu_text_weapon_description(struct menuitem *item) { - struct weapon *weapon = weapon_find_by_id(g_Menus[g_MpPlayerNum].mppause.weaponnum); + struct weapon *weapon = gset_get_weapondef(g_Menus[g_MpPlayerNum].mppause.weaponnum); if (weapon) { return lang_get(weapon->description); diff --git a/src/game/mpstats.c b/src/game/mpstats.c index 86c4e540e..d3ae5a158 100644 --- a/src/game/mpstats.c +++ b/src/game/mpstats.c @@ -21,7 +21,7 @@ u32 var80070590 = 0x00000000; void mpstats_increment_player_shot_count(struct gset *gset, s32 region) { - if (!weapon_has_flag(gset->weaponnum, WEAPONFLAG_DONTCOUNTSHOTS)) { + if (!gset_has_weapon_flag(gset->weaponnum, WEAPONFLAG_DONTCOUNTSHOTS)) { g_Vars.currentplayerstats->shotcount[region]++; } } @@ -29,13 +29,13 @@ void mpstats_increment_player_shot_count(struct gset *gset, s32 region) void mpstats_increment_player_shot_count2(struct gset *gset, s32 region) { if (region == 0) { - if (!weapon_has_flag(gset->weaponnum, WEAPONFLAG_DONTCOUNTSHOTS)) { + if (!gset_has_weapon_flag(gset->weaponnum, WEAPONFLAG_DONTCOUNTSHOTS)) { var80070590 = 1; g_Vars.currentplayerstats->shotcount[region]++; } } else { if (var80070590) { - if (!weapon_has_flag(gset->weaponnum, WEAPONFLAG_DONTCOUNTSHOTS)) { + if (!gset_has_weapon_flag(gset->weaponnum, WEAPONFLAG_DONTCOUNTSHOTS)) { g_Vars.currentplayerstats->shotcount[region]++; } diff --git a/src/game/player.c b/src/game/player.c index ca7c3891c..cb5e56b47 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -5528,9 +5528,9 @@ void player_choose_third_person_animation(struct chrdata *chr, s32 crouchpos, f3 wieldmode = WIELDMODE_DUALGUNS; } else if (!leftprop && !rightprop) { wieldmode = WIELDMODE_UNARMED; - } else if (leftgun && weapon_has_flag(leftgun->weaponnum, WEAPONFLAG_ONEHANDED)) { + } else if (leftgun && gset_has_weapon_flag(leftgun->weaponnum, WEAPONFLAG_ONEHANDED)) { wieldmode = WIELDMODE_PISTOL; - } else if (rightgun && weapon_has_flag(rightgun->weaponnum, WEAPONFLAG_ONEHANDED)) { + } else if (rightgun && gset_has_weapon_flag(rightgun->weaponnum, WEAPONFLAG_ONEHANDED)) { wieldmode = WIELDMODE_PISTOL; } else { wieldmode = WIELDMODE_HEAVY; @@ -5554,13 +5554,13 @@ void player_choose_third_person_animation(struct chrdata *chr, s32 crouchpos, f3 wieldmode = WIELDMODE_DUALGUNS; } else if (!leftprop && !rightprop) { wieldmode = WIELDMODE_UNARMED; - } else if (leftgun && !weapon_has_flag(leftgun->weaponnum, WEAPONFLAG_AICANUSE)) { + } else if (leftgun && !gset_has_weapon_flag(leftgun->weaponnum, WEAPONFLAG_AICANUSE)) { wieldmode = WIELDMODE_UNARMED; - } else if (rightgun && !weapon_has_flag(rightgun->weaponnum, WEAPONFLAG_AICANUSE)) { + } else if (rightgun && !gset_has_weapon_flag(rightgun->weaponnum, WEAPONFLAG_AICANUSE)) { wieldmode = WIELDMODE_UNARMED; - } else if (leftgun && weapon_has_flag(leftgun->weaponnum, WEAPONFLAG_ONEHANDED)) { + } else if (leftgun && gset_has_weapon_flag(leftgun->weaponnum, WEAPONFLAG_ONEHANDED)) { wieldmode = WIELDMODE_PISTOL; - } else if (rightgun && weapon_has_flag(rightgun->weaponnum, WEAPONFLAG_ONEHANDED)) { + } else if (rightgun && gset_has_weapon_flag(rightgun->weaponnum, WEAPONFLAG_ONEHANDED)) { wieldmode = WIELDMODE_PISTOL; } else { wieldmode = WIELDMODE_HEAVY; diff --git a/src/game/prop.c b/src/game/prop.c index 72086e710..54317e981 100644 --- a/src/game/prop.c +++ b/src/game/prop.c @@ -631,8 +631,8 @@ struct prop *shot_calculate_hits(s32 handnum, bool isshooting, struct coord *gun shotdata.gundir2d.y = gundir2d->y; shotdata.gundir2d.z = gundir2d->z; - gset_populate_from_current_player(handnum, &shotdata.gset); - func = gset_get_weapon_function(&shotdata.gset); + gset_populate(handnum, &shotdata.gset); + func = gset_get_funcdef_by_gset(&shotdata.gset); if (func) { if (isshooting && (func->flags & FUNCFLAG_EXPLOSIVESHELLS)) { @@ -1192,7 +1192,7 @@ void hand_inflict_melee_damage(s32 handnum, struct gset *gset, bool arg2) f32 spfc[2]; f32 spf4[2]; struct model *model; - struct weaponfunc *func = gset_get_weapon_function(gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(gset); if ((func->type & 0xff) == INVENTORYFUNCTYPE_MELEE) { struct weaponfunc_melee *meleefunc = (struct weaponfunc_melee *)func; @@ -1307,7 +1307,7 @@ void hand_tick_attack(s32 handnum) g_Vars.currentplayer->hands[handnum].activatesecondary = false; - gset_populate_from_current_player(handnum, &gset); + gset_populate(handnum, &gset); fr_increment_num_shots(); switch (type) { @@ -2393,7 +2393,7 @@ f32 prop_calculate_autoaim_score(struct prop *prop, struct coord *screenpos, f32 f32 left; f32 right; f32 result = -2; - struct weaponfunc *func = current_player_get_weapon_function(HAND_RIGHT); + struct weaponfunc *func = gset_get_current_funcdef(HAND_RIGHT); bool usefullscreen = forcefullscreen; bool sp4c; f32 sp48; @@ -2575,9 +2575,9 @@ void autoaim_tick(void) struct prop *bestprop = NULL; f32 aimpos[2] = {0, 0}; bool ismelee = false; - bool cangangsta = weapon_has_flag(bgun_get_weapon_num(HAND_RIGHT), WEAPONFLAG_GANGSTA); + bool cangangsta = gset_has_weapon_flag(bgun_get_weapon_num(HAND_RIGHT), WEAPONFLAG_GANGSTA); bool iscmpsec = false; - struct weaponfunc *func = current_player_get_weapon_function(HAND_RIGHT); + struct weaponfunc *func = gset_get_current_funcdef(HAND_RIGHT); s32 i; if (func && (func->type & 0xff) == INVENTORYFUNCTYPE_MELEE) { diff --git a/src/game/propobj.c b/src/game/propobj.c index 73625ed25..493442a55 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -15685,7 +15685,7 @@ void obj_hit(struct shotdata *shotdata, struct hit *hit) s32 i; bool explosiveshells = false; bool slowsbullet = hit->slowsbullet; - struct weaponfunc *func = gset_get_weapon_function(&shotdata->gset); + struct weaponfunc *func = gset_get_funcdef_by_gset(&shotdata->gset); struct coord spec; f32 tmp; struct prop *spe4; @@ -17079,11 +17079,11 @@ void weapon_get_pickup_text(char *buffer, s32 weaponnum, bool dual) if (weaponnum == WEAPON_EYESPY && g_Vars.currentplayer->eyespy) { textid = L_PROPOBJ_050; // "your" - } else if (weapon_has_flag(weaponnum, WEAPONFLAG_DETERMINER_F_SOME)) { + } else if (gset_has_weapon_flag(weaponnum, WEAPONFLAG_DETERMINER_F_SOME)) { textid = L_PROPOBJ_002; // "some" - } else if (weapon_has_flag(weaponnum, WEAPONFLAG_DETERMINER_F_AN)) { + } else if (gset_has_weapon_flag(weaponnum, WEAPONFLAG_DETERMINER_F_AN)) { textid = L_PROPOBJ_006; // "an" - } else if (weapon_has_flag(weaponnum, WEAPONFLAG_DETERMINER_F_THE)) { + } else if (gset_has_weapon_flag(weaponnum, WEAPONFLAG_DETERMINER_F_THE)) { textid = L_PROPOBJ_008; // "the" } else { textid = L_PROPOBJ_004; // "a" @@ -17093,11 +17093,11 @@ void weapon_get_pickup_text(char *buffer, s32 weaponnum, bool dual) } else { if (weaponnum == WEAPON_EYESPY && g_Vars.currentplayer->eyespy) { textid = L_PROPOBJ_051; // "Your" - } else if (weapon_has_flag(weaponnum, WEAPONFLAG_DETERMINER_S_SOME)) { + } else if (gset_has_weapon_flag(weaponnum, WEAPONFLAG_DETERMINER_S_SOME)) { textid = L_PROPOBJ_003; // "Some" - } else if (weapon_has_flag(weaponnum, WEAPONFLAG_DETERMINER_S_AN)) { + } else if (gset_has_weapon_flag(weaponnum, WEAPONFLAG_DETERMINER_S_AN)) { textid = L_PROPOBJ_007; // "An" - } else if (weapon_has_flag(weaponnum, WEAPONFLAG_DETERMINER_S_THE)) { + } else if (gset_has_weapon_flag(weaponnum, WEAPONFLAG_DETERMINER_S_THE)) { textid = L_PROPOBJ_009; // "The" } else { textid = L_PROPOBJ_005; // "A" @@ -17110,10 +17110,10 @@ void weapon_get_pickup_text(char *buffer, s32 weaponnum, bool dual) if (full) { strcat(buffer, bgun_get_name(weaponnum)); - plural = weapon_has_flag(weaponnum, WEAPONFLAG_DETERMINER_F_SOME); + plural = gset_has_weapon_flag(weaponnum, WEAPONFLAG_DETERMINER_F_SOME); } else { strcat(buffer, bgun_get_short_name(weaponnum)); - plural = weapon_has_flag(weaponnum, WEAPONFLAG_DETERMINER_S_SOME); + plural = gset_has_weapon_flag(weaponnum, WEAPONFLAG_DETERMINER_S_SOME); } // Note that weapon names have a line break on the end which is undesirable @@ -17535,7 +17535,7 @@ s32 obj_test_for_pickup(struct prop *prop) } } else { if (g_Vars.normmplayerisrunning - && weapon_has_flag(weapon->weaponnum, WEAPONFLAG_DUALWIELD) + && gset_has_weapon_flag(weapon->weaponnum, WEAPONFLAG_DUALWIELD) && !inv_has_double_weapon_exc_all_guns(weapon->weaponnum, weapon->weaponnum)) { struct invitem *item = inv_find_single_weapon(weapon->weaponnum); @@ -21060,7 +21060,7 @@ void current_player_drop_all_items(void) for (i = WEAPON_UNARMED; i <= WEAPON_SUICIDEPILL; i++) { if (playermgr_get_model_of_weapon(i) >= 0 && inv_has_single_weapon_exc_all_guns(i)) { - if (!weapon_has_flag(i, WEAPONFLAG_UNDROPPABLE) + if (!gset_has_weapon_flag(i, WEAPONFLAG_UNDROPPABLE) || (g_Vars.normmplayerisrunning && g_MpSetup.scenario == MPSCENARIO_HACKERCENTRAL && i == WEAPON_DATAUPLINK)) { diff --git a/src/game/sight.c b/src/game/sight.c index 7faf66f45..a94279853 100644 --- a/src/game/sight.c +++ b/src/game/sight.c @@ -161,7 +161,7 @@ void sight_tick(bool sighton) s32 i; s32 index; struct invaimsettings *gunsettings = gset_get_aim_settings(&g_Vars.currentplayer->hands[0].gset); - struct weaponfunc *func = weapon_get_function_by_id(g_Vars.currentplayer->hands[0].gset.weaponnum, + struct weaponfunc *func = gset_get_funcdef_by_weaponnum_funcnum(g_Vars.currentplayer->hands[0].gset.weaponnum, g_Vars.currentplayer->hands[0].gset.weaponfunc); g_Vars.currentplayer->sighttimer240 += g_Vars.lvupdate240; @@ -1186,7 +1186,7 @@ Gfx *sight_draw_zoom(Gfx *gdl, bool sighton) showzoomrange = options_get_show_zoom_range(g_Vars.currentplayerstats->mpindex) && options_get_sight_on_screen(g_Vars.currentplayerstats->mpindex); - maxfovy = current_player_get_gun_zoom_fov(); + maxfovy = gset_get_gun_zoom_fov(); zoominfovy = g_Vars.currentplayer->zoominfovy; if (maxfovy == 0.0f || maxfovy == 60.0f) { diff --git a/src/game/training.c b/src/game/training.c index 74cc7e70d..8e494279e 100644 --- a/src/game/training.c +++ b/src/game/training.c @@ -1798,7 +1798,7 @@ void fr_tick(void) weaponnum = fr_get_weapon_by_slot(g_FrData.slot); ammotype = bgun_get_ammo_type_for_weapon(weaponnum, 0); capacity = bgun_get_capacity_by_ammotype(ammotype); - ammo = weapon_get_ammo_by_function(weaponnum, 0); + ammo = gset_get_ammodef(weaponnum, 0); capacity -= (ammo ? ammo->clipsize : 0); if (g_FrData.ammoextra > 0) { diff --git a/src/game/trainingmenus.c b/src/game/trainingmenus.c index 4d7ccd8dc..30e2b78c2 100644 --- a/src/game/trainingmenus.c +++ b/src/game/trainingmenus.c @@ -313,7 +313,7 @@ MenuItemHandlerResult fr_difficulty_menu_handler(s32 operation, struct menuitem char *fr_primary_function_menu_text(struct menuitem *item) { - struct weaponfunc *func = weapon_get_function_by_id(fr_get_weapon_by_slot(fr_get_slot()), FUNC_PRIMARY); + struct weaponfunc *func = gset_get_funcdef_by_weaponnum_funcnum(fr_get_weapon_by_slot(fr_get_slot()), FUNC_PRIMARY); if (func) { return lang_get(func->name); @@ -324,7 +324,7 @@ char *fr_primary_function_menu_text(struct menuitem *item) char *fr_secondary_function_menu_text(struct menuitem *item) { - struct weaponfunc *func = weapon_get_function_by_id(fr_get_weapon_by_slot(fr_get_slot()), FUNC_SECONDARY); + struct weaponfunc *func = gset_get_funcdef_by_weaponnum_funcnum(fr_get_weapon_by_slot(fr_get_slot()), FUNC_SECONDARY); if (func) { return lang_get(func->name); diff --git a/src/game/wallhit.c b/src/game/wallhit.c index 4c0a545c0..58bc21599 100644 --- a/src/game/wallhit.c +++ b/src/game/wallhit.c @@ -434,7 +434,7 @@ void wallhits_tick(void) static s32 var8007f834 = 0; sp12c = (g_Vars.lvupdate240 + 2.0f) * 0.25f; - fov = current_player_get_gun_zoom_fov(); + fov = gset_get_gun_zoom_fov(); main_override_variable("wallhit", &var8007f750); diff --git a/src/include/game/gset.h b/src/include/game/gset.h index edc32f104..162b05a41 100644 --- a/src/include/game/gset.h +++ b/src/include/game/gset.h @@ -4,27 +4,27 @@ #include "data.h" #include "types.h" -struct weapon *weapon_find_by_id(s32 itemid); -struct weaponfunc *weapon_get_function_by_id(u32 weaponnum, u32 which); -struct weaponfunc *gset_get_weapon_function2(struct gset *gset); -struct weaponfunc *gset_get_weapon_function(struct gset *gset); -struct weaponfunc *weapon_get_function(struct gset *gset, s32 which); -struct weaponfunc *current_player_get_weapon_function(u32 hand); +struct weapon *gset_get_weapondef(s32 itemid); +struct weaponfunc *gset_get_funcdef_by_weaponnum_funcnum(u32 weaponnum, u32 which); +struct weaponfunc *gset_get_funcdef_by_gset2(struct gset *gset); +struct weaponfunc *gset_get_funcdef_by_gset(struct gset *gset); +struct weaponfunc *gset_get_funcdef_by_gset_funcnum(struct gset *gset, s32 which); +struct weaponfunc *gset_get_current_funcdef(u32 hand); struct invaimsettings *gset_get_aim_settings(struct gset *gset); -struct inventory_ammo *weapon_get_ammo_by_function(u32 weaponnum, u32 funcnum); -f32 hand_get_xshift(s32 handnum); -f32 hand_get_xpos(s32 handnum); -f32 current_player_get_gun_zoom_fov(void); -void current_player_zoom_out(f32 fovpersec); -void current_player_zoom_in(f32 fovpersec); -bool weapon_has_flag(s32 itemid, u32 flag); -bool weapon_has_aim_flag(s32 weaponnum, u32 flag); -bool weapon_has_ammo_flag(s32 weaponnum, s32 funcnum, u32 flag); -s32 current_player_get_device_state(s32 weaponnum); -void current_player_set_device_active(s32 weaponum, bool active); -u16 weapon_get_file_num(s32 weaponnum); -u16 weapon_get_file_num2(s32 weaponnum); -void gset_populate_from_current_player(s32 handnum, struct gset *gset); +struct inventory_ammo *gset_get_ammodef(u32 weaponnum, u32 funcnum); +f32 gset_get_xshift(s32 handnum); +f32 gset_get_xpos(s32 handnum); +f32 gset_get_gun_zoom_fov(void); +void gset_zoom_out(f32 fovpersec); +void gset_zoom_in(f32 fovpersec); +bool gset_has_weapon_flag(s32 itemid, u32 flag); +bool gset_has_aim_flag(s32 weaponnum, u32 flag); +bool gset_has_ammo_flag(s32 weaponnum, s32 funcnum, u32 flag); +s32 gset_get_device_state(s32 weaponnum); +void gset_set_device_active(s32 weaponum, bool active); +u16 gset_get_filenum(s32 weaponnum); +u16 gset_get_filenum2(s32 weaponnum); +void gset_populate(s32 handnum, struct gset *gset); u8 gset_get_single_penetration(struct gset *gset); f32 gset_get_impact_force(struct gset *gset); f32 gset_get_damage(struct gset *gset); @@ -32,9 +32,9 @@ u8 gset_get_fireslot_duration(struct gset *gset); u16 gset_get_single_shoot_sound(struct gset *gset); bool gset_has_function_flags(struct gset *gset, u32 flags); s8 weapon_get_num_ticks_per_shot(u32 weaponnum, u32 funcindex); -u32 current_player_get_sight(void); +u32 gset_get_sight(void); void gset_get_noise_settings(struct gset *gset, struct noisesettings *settings); -struct guncmd *gset_get_pri_to_sec_anim(struct gset *gset); -struct guncmd *gset_get_sec_to_pri_anim(struct gset *gset); +struct guncmd *gset_get_pritosec_anim(struct gset *gset); +struct guncmd *gset_get_sectopri_anim(struct gset *gset); #endif