Header file for menu callback functions used for base and aircraft equip menu. More...
#include "../cl_shared.h"
#include "../ui/ui_main.h"
#include "cp_campaign.h"
#include "cp_fightequip_callbacks.h"
#include "cp_mapfightequip.h"
#include "cp_ufo.h"
Go to the source code of this file.
Defines | |
#define | AIM_LOADING_OK 0 |
#define | AIM_LOADING_NOSLOTSELECTED 1 |
#define | AIM_LOADING_NOTECHNOLOGYSELECTED 2 |
#define | AIM_LOADING_ALIENTECH 3 |
#define | AIM_LOADING_TECHNOLOGYNOTRESEARCHED 4 |
#define | AIM_LOADING_TOOHEAVY 5 |
#define | AIM_LOADING_UNKNOWNPROBLEM 6 |
#define | AIM_LOADING_NOWEAPON 7 |
#define | AIM_LOADING_NOTUSABLEWITHWEAPON 8 |
Functions | |
static void | AIM_CheckAirequipID (void) |
Check airequipID value and set the correct values for aircraft items. | |
static void | AIM_CheckAirequipSelectedSlot (const aircraft_t *aircraft) |
Check that airequipSelectedSlot is the indice of an existing slot in the aircraft. | |
aircraftSlot_t * | AII_SelectAircraftSlot (aircraft_t *aircraft, aircraftItemType_t type) |
Returns a pointer to the selected slot. | |
static void | AIM_CheckAirequipSelectedZone (aircraftSlot_t *slot) |
Check that airequipSelectedZone is available. | |
static const char * | AIM_AircraftItemtypeName (const int equiptype) |
Returns the userfriendly name for craftitem types (shown in aircraft equip menu). | |
static qboolean | AIM_CrafttypeFilter (const base_t *base, aircraftItemType_t filterType, const technology_t *tech) |
static void | AIM_UpdateAircraftItemList (const aircraftSlot_t *slot) |
Update the list of item you can choose. | |
static void | AIM_DrawAircraftSlots (const aircraft_t *aircraft) |
Draw only slots existing for this aircraft, and emphases selected one. | |
static void | AIM_EmphazeAmmoSlotText (void) |
Write in red the text in zone ammo (zone 2). | |
static void | AIM_NoEmphazeAmmoSlotText (void) |
Write in white the text in zone ammo (zone 2). | |
static void | AIM_AircraftEquipMenuUpdate (void) |
static int | AIM_CheckTechnologyIntoSlot (const aircraftSlot_t *slot, const technology_t *tech) |
static void | AIM_UpdateItemDescription (qboolean fromList, qboolean fromSlot) |
Update the item description according to the tech and the slot selected. | |
static void | AIM_AircraftEquipMenuUpdate_f (void) |
Fills the weapon and shield list of the aircraft equip menu. | |
static void | AIM_AircraftEquipSlotSelect_f (void) |
Select the current slot you want to assign the item to. | |
static void | AIM_AircraftEquipZoneSelect_f (void) |
Select the current zone you want to assign the item to. | |
static void | AIM_AircraftEquipAddItem_f (void) |
Add selected item to current zone. | |
static void | AIM_AircraftEquipRemoveItem_f (void) |
Delete an object from a zone. | |
static void | AIM_AircraftEquipMenuClick_f (void) |
Set AIM_selectedTechnology to the technology of current selected aircraft item. | |
static void | AIM_AircraftItemtypeByName_f (void) |
Update the GUI with a named itemtype. | |
void | AIM_InitCallbacks (void) |
void | AIM_ShutdownCallbacks (void) |
Variables | |
static int | airequipID = -1 |
static int | airequipSelectedZone = ZONE_NONE |
static int | airequipSelectedSlot = ZONE_NONE |
static technology_t * | aimSelectedTechnology = NULL |
Header file for menu callback functions used for base and aircraft equip menu.
Definition in file cp_fightequip_callbacks.c.
#define AIM_LOADING_ALIENTECH 3 |
Definition at line 408 of file cp_fightequip_callbacks.c.
Referenced by AIM_CheckTechnologyIntoSlot(), and AIM_UpdateItemDescription().
#define AIM_LOADING_NOSLOTSELECTED 1 |
Definition at line 406 of file cp_fightequip_callbacks.c.
Referenced by AIM_CheckTechnologyIntoSlot(), and AIM_UpdateItemDescription().
#define AIM_LOADING_NOTECHNOLOGYSELECTED 2 |
Definition at line 407 of file cp_fightequip_callbacks.c.
Referenced by AIM_CheckTechnologyIntoSlot(), and AIM_UpdateItemDescription().
#define AIM_LOADING_NOTUSABLEWITHWEAPON 8 |
Definition at line 413 of file cp_fightequip_callbacks.c.
Referenced by AIM_CheckTechnologyIntoSlot(), and AIM_UpdateItemDescription().
#define AIM_LOADING_NOWEAPON 7 |
Definition at line 412 of file cp_fightequip_callbacks.c.
Referenced by AIM_CheckTechnologyIntoSlot(), and AIM_UpdateItemDescription().
#define AIM_LOADING_OK 0 |
Definition at line 405 of file cp_fightequip_callbacks.c.
Referenced by AIM_CheckTechnologyIntoSlot(), and AIM_UpdateItemDescription().
#define AIM_LOADING_TECHNOLOGYNOTRESEARCHED 4 |
Definition at line 409 of file cp_fightequip_callbacks.c.
Referenced by AIM_CheckTechnologyIntoSlot(), and AIM_UpdateItemDescription().
#define AIM_LOADING_TOOHEAVY 5 |
Definition at line 410 of file cp_fightequip_callbacks.c.
Referenced by AIM_CheckTechnologyIntoSlot(), and AIM_UpdateItemDescription().
#define AIM_LOADING_UNKNOWNPROBLEM 6 |
Definition at line 411 of file cp_fightequip_callbacks.c.
Referenced by AIM_CheckTechnologyIntoSlot(), and AIM_UpdateItemDescription().
aircraftSlot_t* AII_SelectAircraftSlot | ( | aircraft_t * | aircraft, | |
aircraftItemType_t | type | |||
) |
Returns a pointer to the selected slot.
[in] | aircraft | Pointer to the aircraft |
[in] | airequipID | value of aircraftItemType_t that defines what item we are installing |
Definition at line 85 of file cp_fightequip_callbacks.c.
References AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_SHIELD, AC_ITEM_WEAPON, AIM_CheckAirequipSelectedSlot(), airequipSelectedSlot, Com_Printf(), aircraft_s::electronics, aircraft_s::shield, and aircraft_s::weapons.
Referenced by AIM_AircraftEquipAddItem_f(), AIM_AircraftEquipMenuUpdate(), AIM_AircraftEquipRemoveItem_f(), AIM_AircraftEquipZoneSelect_f(), and AIM_UpdateItemDescription().
static void AIM_AircraftEquipAddItem_f | ( | void | ) | [static] |
Add selected item to current zone.
Definition at line 730 of file cp_fightequip_callbacks.c.
References AC_ITEM_AMMO, AII_AddAmmoToSlot(), AII_AddItemToSlot(), AII_AutoAddAmmo(), AII_RemoveItemFromSlot(), AII_RemoveNextItemFromSlot(), AII_SelectAircraftSlot(), AII_UpdateAircraftStats(), AIM_AircraftEquipMenuUpdate(), base_s::aircraftCurrent, airequipID, airequipSelectedZone, B_GetCurrentSelectedBase(), objDef_s::craftitem, aircraft_s::homebase, craftitem_s::installationTime, aircraftSlot_s::installationTime, INVSH_GetItemByID(), aircraftSlot_s::item, aircraftSlot_s::nextItem, technology_s::provides, qfalse, qtrue, ZONE_AMMO, ZONE_MAIN, and ZONE_MAX.
Referenced by AIM_InitCallbacks().
static void AIM_AircraftEquipMenuClick_f | ( | void | ) | [static] |
Set AIM_selectedTechnology to the technology of current selected aircraft item.
Definition at line 880 of file cp_fightequip_callbacks.c.
References AIM_UpdateItemDescription(), ccs, Cmd_Argc(), Cmd_Argv(), Com_Printf(), qfalse, qtrue, and ccs_s::technologies.
Referenced by AIM_InitCallbacks().
static void AIM_AircraftEquipMenuUpdate | ( | void | ) | [static] |
Definition at line 303 of file cp_fightequip_callbacks.c.
References _, AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_SHIELD, AC_ITEM_WEAPON, AII_SelectAircraftSlot(), AII_WeightToName(), AIM_AircraftItemtypeName(), AIM_CheckAirequipSelectedSlot(), AIM_CheckAirequipSelectedZone(), AIM_DrawAircraftSlots(), AIM_EmphazeAmmoSlotText(), AIM_NoEmphazeAmmoSlotText(), AIM_UpdateAircraftItemList(), base_s::aircraftCurrent, airequipID, aircraftSlot_s::ammo, B_GetCurrentSelectedBase(), Com_sprintf(), objDef_s::craftitem, Cvar_Set(), craftitem_s::installationTime, aircraftSlot_s::installationTime, objDef_s::isVirtual, aircraftSlot_s::item, technology_s::name, aircraftSlot_s::nextAmmo, aircraftSlot_s::nextItem, Q_strcat(), Q_strncpyz(), RS_GetTechForItem(), aircraftSlot_s::size, TEXT_AIREQUIP_1, TEXT_AIREQUIP_2, TEXT_ITEMDESCRIPTION, TEXT_LIST, UI_RegisterText(), UI_ResetData(), and va().
Referenced by AIM_AircraftEquipAddItem_f(), AIM_AircraftEquipMenuUpdate_f(), AIM_AircraftEquipRemoveItem_f(), AIM_AircraftEquipSlotSelect_f(), and AIM_AircraftEquipZoneSelect_f().
static void AIM_AircraftEquipMenuUpdate_f | ( | void | ) | [static] |
Fills the weapon and shield list of the aircraft equip menu.
Definition at line 567 of file cp_fightequip_callbacks.c.
References AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_SHIELD, AC_ITEM_WEAPON, AIM_AircraftEquipMenuUpdate(), AIM_CheckAirequipID(), airequipID, Cmd_Argc(), Cmd_Argv(), Com_Printf(), type, and UI_ExecuteConfunc().
Referenced by AIM_InitCallbacks().
static void AIM_AircraftEquipRemoveItem_f | ( | void | ) | [static] |
Delete an object from a zone.
Definition at line 814 of file cp_fightequip_callbacks.c.
References AC_ITEM_AMMO, AII_RemoveItemFromSlot(), AII_RemoveNextItemFromSlot(), AII_SelectAircraftSlot(), AII_UpdateAircraftStats(), AIM_AircraftEquipMenuUpdate(), base_s::aircraftCurrent, airequipID, B_GetCurrentSelectedBase(), objDef_s::craftitem, craftitem_s::installationTime, aircraftSlot_s::installationTime, aircraftSlot_s::item, aircraftSlot_s::nextAmmo, aircraftSlot_s::nextItem, qfalse, qtrue, ZONE_AMMO, and ZONE_MAIN.
Referenced by AIM_InitCallbacks().
static void AIM_AircraftEquipSlotSelect_f | ( | void | ) | [static] |
Select the current slot you want to assign the item to.
Definition at line 601 of file cp_fightequip_callbacks.c.
References AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_WEAPON, AIM_AircraftEquipMenuUpdate(), AIM_UpdateItemDescription(), base_s::aircraftCurrent, airequipID, airequipSelectedSlot, B_GetCurrentSelectedBase(), Cmd_Argc(), Cmd_Argv(), Com_Printf(), aircraft_s::electronics, i, aircraft_s::maxElectronics, aircraft_s::maxWeapons, aircraftSlot_s::pos, pos, qfalse, qtrue, aircraft_s::weapons, and ZONE_NONE.
Referenced by AIM_InitCallbacks().
static void AIM_AircraftEquipZoneSelect_f | ( | void | ) | [static] |
Select the current zone you want to assign the item to.
Definition at line 674 of file cp_fightequip_callbacks.c.
References AC_ITEM_AMMO, AC_ITEM_WEAPON, AII_SelectAircraftSlot(), AIM_AircraftEquipMenuUpdate(), AIM_CheckAirequipSelectedZone(), AIM_UpdateItemDescription(), base_s::aircraftCurrent, airequipID, airequipSelectedZone, B_GetCurrentSelectedBase(), Cmd_Argc(), Cmd_Argv(), Com_Printf(), aircraftSlot_s::item, qfalse, qtrue, and ZONE_AMMO.
Referenced by AIM_InitCallbacks().
static void AIM_AircraftItemtypeByName_f | ( | void | ) | [static] |
Update the GUI with a named itemtype.
Definition at line 899 of file cp_fightequip_callbacks.c.
References AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_SHIELD, AC_ITEM_WEAPON, airequipID, Cmd_Argc(), Cmd_Argv(), Cmd_ExecuteString(), Com_Printf(), i, name, and va().
Referenced by AIM_InitCallbacks().
static const char* AIM_AircraftItemtypeName | ( | const int | equiptype | ) | [inline, static] |
Returns the userfriendly name for craftitem types (shown in aircraft equip menu).
Definition at line 131 of file cp_fightequip_callbacks.c.
References _, AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_SHIELD, and AC_ITEM_WEAPON.
Referenced by AIM_AircraftEquipMenuUpdate().
static void AIM_CheckAirequipID | ( | void | ) | [static] |
Check airequipID value and set the correct values for aircraft items.
Definition at line 41 of file cp_fightequip_callbacks.c.
References AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_SHIELD, AC_ITEM_WEAPON, and airequipID.
Referenced by AIM_AircraftEquipMenuUpdate_f().
static void AIM_CheckAirequipSelectedSlot | ( | const aircraft_t * | aircraft | ) | [static] |
Check that airequipSelectedSlot is the indice of an existing slot in the aircraft.
Definition at line 59 of file cp_fightequip_callbacks.c.
References AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_WEAPON, airequipID, airequipSelectedSlot, aircraft_s::maxElectronics, and aircraft_s::maxWeapons.
Referenced by AII_SelectAircraftSlot(), and AIM_AircraftEquipMenuUpdate().
static void AIM_CheckAirequipSelectedZone | ( | aircraftSlot_t * | slot | ) | [static] |
Check that airequipSelectedZone is available.
Definition at line 113 of file cp_fightequip_callbacks.c.
References AC_ITEM_AMMO, AC_ITEM_WEAPON, airequipID, airequipSelectedZone, aircraftSlot_s::item, ZONE_AMMO, and ZONE_MAIN.
Referenced by AIM_AircraftEquipMenuUpdate(), and AIM_AircraftEquipZoneSelect_f().
static int AIM_CheckTechnologyIntoSlot | ( | const aircraftSlot_t * | slot, | |
const technology_t * | tech | |||
) | [static] |
[in] | slot | Pointer to an aircraft slot (can be base/installation too) |
[in] | tech | Pointer to the technology to test |
Definition at line 421 of file cp_fightequip_callbacks.c.
References AC_ITEM_AMMO, AII_GetItemWeightBySize(), AIM_LOADING_ALIENTECH, AIM_LOADING_NOSLOTSELECTED, AIM_LOADING_NOTECHNOLOGYSELECTED, AIM_LOADING_NOTUSABLEWITHWEAPON, AIM_LOADING_NOWEAPON, AIM_LOADING_OK, AIM_LOADING_TECHNOLOGYNOTRESEARCHED, AIM_LOADING_TOOHEAVY, AIM_LOADING_UNKNOWNPROBLEM, aircraftSlot_s::aircraft, objDef_s::ammos, B_BaseHasItem(), aircraftSlot_s::base, objDef_s::craftitem, aircraft_s::homebase, objDef_s::idx, craftitem_s::installationTime, INVSH_GetItemByID(), aircraftSlot_s::item, aircraftSlot_s::nextItem, objDef_s::numAmmos, technology_s::provides, RS_IsResearched_ptr(), aircraftSlot_s::size, aircraftSlot_s::type, craftitem_s::type, and objDef_s::weapons.
Referenced by AIM_UpdateItemDescription().
static qboolean AIM_CrafttypeFilter | ( | const base_t * | base, | |
aircraftItemType_t | filterType, | |||
const technology_t * | tech | |||
) | [static] |
true
if the technology is available and matches the filter Definition at line 151 of file cp_fightequip_callbacks.c.
References AC_ITEM_AMMO, B_BaseHasItem(), objDef_s::craftitem, craftitem_s::installationTime, INVSH_GetItemByID(), objDef_s::isVirtual, technology_s::provides, qfalse, qtrue, RS_IsResearched_ptr(), and craftitem_s::type.
Referenced by AIM_UpdateAircraftItemList().
static void AIM_DrawAircraftSlots | ( | const aircraft_t * | aircraft | ) | [static] |
Draw only slots existing for this aircraft, and emphases selected one.
Definition at line 235 of file cp_fightequip_callbacks.c.
References AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_WEAPON, AIR_POSITIONS_MAX, airequipID, airequipSelectedSlot, Cvar_Set(), aircraft_s::electronics, i, aircraftSlot_s::item, aircraft_s::maxElectronics, aircraft_s::maxWeapons, technology_s::mdl, aircraftSlot_s::pos, RS_GetTechForItem(), UI_ExecuteConfunc(), va(), and aircraft_s::weapons.
Referenced by AIM_AircraftEquipMenuUpdate().
static void AIM_EmphazeAmmoSlotText | ( | void | ) | [inline, static] |
Write in red the text in zone ammo (zone 2).
Definition at line 288 of file cp_fightequip_callbacks.c.
References UI_ExecuteConfunc().
Referenced by AIM_AircraftEquipMenuUpdate().
void AIM_InitCallbacks | ( | void | ) |
Definition at line 928 of file cp_fightequip_callbacks.c.
References AIM_AircraftEquipAddItem_f(), AIM_AircraftEquipMenuClick_f(), AIM_AircraftEquipMenuUpdate_f(), AIM_AircraftEquipRemoveItem_f(), AIM_AircraftEquipSlotSelect_f(), AIM_AircraftEquipZoneSelect_f(), AIM_AircraftItemtypeByName_f(), and Cmd_AddCommand().
Referenced by CP_AddCampaignCallbackCommands().
static void AIM_NoEmphazeAmmoSlotText | ( | void | ) | [inline, static] |
Write in white the text in zone ammo (zone 2).
Definition at line 298 of file cp_fightequip_callbacks.c.
References UI_ExecuteConfunc().
Referenced by AIM_AircraftEquipMenuUpdate().
void AIM_ShutdownCallbacks | ( | void | ) |
Definition at line 939 of file cp_fightequip_callbacks.c.
References Cmd_RemoveCommand().
Referenced by CP_RemoveCampaignCallbackCommands().
static void AIM_UpdateAircraftItemList | ( | const aircraftSlot_t * | slot | ) | [static] |
Update the list of item you can choose.
[in] | slot | Pointer to aircraftSlot where items can be equiped |
Definition at line 189 of file cp_fightequip_callbacks.c.
References _, AII_GetCraftitemTechsByType(), AIM_CrafttypeFilter(), AIM_SelectableCraftItem(), aircraftSlot_s::aircraft, airequipID, count, uiNode_s::disabled, aircraft_s::homebase, objDef_s::idx, INVSH_GetItemByID(), LIST_AddString(), uiNode_s::name, equipDef_s::numItems, qtrue, base_s::storage, TEXT_LIST, TEXT_LIST2, UI_AddOption(), UI_RegisterLinkedListText(), UI_RegisterOption(), and va().
Referenced by AIM_AircraftEquipMenuUpdate().
Update the item description according to the tech and the slot selected.
Definition at line 494 of file cp_fightequip_callbacks.c.
References _, AC_ITEM_AMMO, AII_SelectAircraftSlot(), AIM_CheckTechnologyIntoSlot(), AIM_LOADING_ALIENTECH, AIM_LOADING_NOSLOTSELECTED, AIM_LOADING_NOTECHNOLOGYSELECTED, AIM_LOADING_NOTUSABLEWITHWEAPON, AIM_LOADING_NOWEAPON, AIM_LOADING_OK, AIM_LOADING_TECHNOLOGYNOTRESEARCHED, AIM_LOADING_TOOHEAVY, AIM_LOADING_UNKNOWNPROBLEM, base_s::aircraftCurrent, airequipID, aircraftSlot_s::ammo, B_GetCurrentSelectedBase(), Cvar_GetString(), Cvar_Set(), INVSH_GetItemByIDSilent(), aircraftSlot_s::item, technology_s::provides, UI_ExecuteConfunc(), and UP_AircraftItemDescription().
Referenced by AIM_AircraftEquipMenuClick_f(), AIM_AircraftEquipSlotSelect_f(), and AIM_AircraftEquipZoneSelect_f().
technology_t* aimSelectedTechnology = NULL [static] |
Selected technology in equip menu
Definition at line 36 of file cp_fightequip_callbacks.c.
int airequipID = -1 [static] |
value of aircraftItemType_t that defines what item we are installing.
Definition at line 32 of file cp_fightequip_callbacks.c.
Referenced by AIM_AircraftEquipAddItem_f(), AIM_AircraftEquipMenuUpdate(), AIM_AircraftEquipMenuUpdate_f(), AIM_AircraftEquipRemoveItem_f(), AIM_AircraftEquipSlotSelect_f(), AIM_AircraftEquipZoneSelect_f(), AIM_AircraftItemtypeByName_f(), AIM_CheckAirequipID(), AIM_CheckAirequipSelectedSlot(), AIM_CheckAirequipSelectedZone(), AIM_DrawAircraftSlots(), AIM_UpdateAircraftItemList(), and AIM_UpdateItemDescription().
int airequipSelectedSlot = ZONE_NONE [static] |
Selected slot in equip menu
Definition at line 35 of file cp_fightequip_callbacks.c.
Referenced by AII_SelectAircraftSlot(), AIM_AircraftEquipSlotSelect_f(), AIM_CheckAirequipSelectedSlot(), and AIM_DrawAircraftSlots().
int airequipSelectedZone = ZONE_NONE [static] |
Selected zone in equip menu
Definition at line 34 of file cp_fightequip_callbacks.c.
Referenced by AIM_AircraftEquipAddItem_f(), AIM_AircraftEquipZoneSelect_f(), and AIM_CheckAirequipSelectedZone().