UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_fightequip_callbacks.cpp File Reference

Header file for menu callback functions used for base and aircraft equip menu. More...

#include "../../cl_shared.h"
#include "../../ui/ui_dataids.h"
#include "cp_campaign.h"
#include "cp_fightequip_callbacks.h"
#include "cp_mapfightequip.h"
#include "cp_ufo.h"
Include dependency graph for cp_fightequip_callbacks.cpp:

Go to the source code of this file.

Macros

#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_tAII_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 bool 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 (bool fromList, bool 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 aircraftItemType_t airequipID = MAX_ACITEMS
static int airequipSelectedZone = ZONE_NONE
static int airequipSelectedSlot = ZONE_NONE
static technology_taimSelectedTechnology = nullptr
static const cmdList_t airequipCmds []

Detailed Description

Header file for menu callback functions used for base and aircraft equip menu.

Definition in file cp_fightequip_callbacks.cpp.

Macro Definition Documentation

◆ AIM_LOADING_ALIENTECH

#define AIM_LOADING_ALIENTECH   3

◆ AIM_LOADING_NOSLOTSELECTED

#define AIM_LOADING_NOSLOTSELECTED   1

◆ AIM_LOADING_NOTECHNOLOGYSELECTED

#define AIM_LOADING_NOTECHNOLOGYSELECTED   2

◆ AIM_LOADING_NOTUSABLEWITHWEAPON

#define AIM_LOADING_NOTUSABLEWITHWEAPON   8

◆ AIM_LOADING_NOWEAPON

#define AIM_LOADING_NOWEAPON   7

◆ AIM_LOADING_OK

#define AIM_LOADING_OK   0

◆ AIM_LOADING_TECHNOLOGYNOTRESEARCHED

#define AIM_LOADING_TECHNOLOGYNOTRESEARCHED   4

◆ AIM_LOADING_TOOHEAVY

#define AIM_LOADING_TOOHEAVY   5

◆ AIM_LOADING_UNKNOWNPROBLEM

#define AIM_LOADING_UNKNOWNPROBLEM   6

Function Documentation

◆ AII_SelectAircraftSlot()

aircraftSlot_t * AII_SelectAircraftSlot ( aircraft_t * aircraft,
aircraftItemType_t type )

Returns a pointer to the selected slot.

Parameters
[in]aircraftPointer to the aircraft
[in]typeType of slot we want to select
Note
also used by BDEF_ functions
Returns
Pointer to the slot corresponding to airequipID

Definition at line 86 of file cp_fightequip_callbacks.cpp.

References AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_SHIELD, AC_ITEM_WEAPON, AIM_CheckAirequipSelectedSlot(), airequipSelectedSlot, cgi, aircraft_t::electronics, aircraft_t::shield, type, and aircraft_t::weapons.

Referenced by AIM_AircraftEquipAddItem_f(), AIM_AircraftEquipMenuUpdate(), AIM_AircraftEquipRemoveItem_f(), AIM_AircraftEquipZoneSelect_f(), and AIM_UpdateItemDescription().

◆ AIM_AircraftEquipAddItem_f()

◆ AIM_AircraftEquipMenuClick_f()

void AIM_AircraftEquipMenuClick_f ( void )
static

Set AIM_selectedTechnology to the technology of current selected aircraft item.

See also
AIM_AircraftEquipMenuUpdate_f

Definition at line 884 of file cp_fightequip_callbacks.cpp.

References AIM_UpdateItemDescription(), aimSelectedTechnology, cgi, and RS_GetTechByIDX().

◆ AIM_AircraftEquipMenuUpdate()

◆ AIM_AircraftEquipMenuUpdate_f()

void AIM_AircraftEquipMenuUpdate_f ( void )
static

Fills the weapon and shield list of the aircraft equip menu.

See also
AIM_AircraftEquipMenuClick_f

Definition at line 567 of file cp_fightequip_callbacks.cpp.

References AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_SHIELD, AC_ITEM_WEAPON, AIM_AircraftEquipMenuUpdate(), AIM_CheckAirequipID(), airequipID, cgi, MAX_ACITEMS, and type.

◆ AIM_AircraftEquipRemoveItem_f()

◆ AIM_AircraftEquipSlotSelect_f()

void AIM_AircraftEquipSlotSelect_f ( void )
static

◆ AIM_AircraftEquipZoneSelect_f()

◆ AIM_AircraftItemtypeByName_f()

void AIM_AircraftItemtypeByName_f ( void )
static

Update the GUI with a named itemtype.

Definition at line 902 of file cp_fightequip_callbacks.cpp.

References AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_SHIELD, AC_ITEM_WEAPON, airequipID, cgi, i, name, and Q_streq.

◆ AIM_AircraftItemtypeName()

const char * AIM_AircraftItemtypeName ( const int equiptype)
inlinestatic

Returns the userfriendly name for craftitem types (shown in aircraft equip menu).

Definition at line 132 of file cp_fightequip_callbacks.cpp.

References _, AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_SHIELD, and AC_ITEM_WEAPON.

Referenced by AIM_AircraftEquipMenuUpdate().

◆ AIM_CheckAirequipID()

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.cpp.

References AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_SHIELD, AC_ITEM_WEAPON, and airequipID.

Referenced by AIM_AircraftEquipMenuUpdate_f().

◆ AIM_CheckAirequipSelectedSlot()

void AIM_CheckAirequipSelectedSlot ( const aircraft_t * aircraft)
static

Check that airequipSelectedSlot is the indice of an existing slot in the aircraft.

Note
airequipSelectedSlot concerns only weapons and electronics
See also
aircraft Pointer to the aircraft

Definition at line 60 of file cp_fightequip_callbacks.cpp.

References AC_ITEM_AMMO, AC_ITEM_ELECTRONICS, AC_ITEM_WEAPON, airequipID, airequipSelectedSlot, aircraft_t::maxElectronics, and aircraft_t::maxWeapons.

Referenced by AII_SelectAircraftSlot(), and AIM_AircraftEquipMenuUpdate().

◆ AIM_CheckAirequipSelectedZone()

void AIM_CheckAirequipSelectedZone ( aircraftSlot_t * slot)
static

Check that airequipSelectedZone is available.

See also
slot Pointer to the slot

Definition at line 114 of file cp_fightequip_callbacks.cpp.

References AC_ITEM_AMMO, AC_ITEM_WEAPON, airequipID, airequipSelectedZone, aircraftSlot_t::item, ZONE_AMMO, and ZONE_MAIN.

Referenced by AIM_AircraftEquipMenuUpdate(), and AIM_AircraftEquipZoneSelect_f().

◆ AIM_CheckTechnologyIntoSlot()

◆ AIM_CrafttypeFilter()

bool AIM_CrafttypeFilter ( const base_t * base,
aircraftItemType_t filterType,
const technology_t * tech )
static

◆ AIM_DrawAircraftSlots()

void AIM_DrawAircraftSlots ( const aircraft_t * aircraft)
static

◆ AIM_EmphazeAmmoSlotText()

void AIM_EmphazeAmmoSlotText ( void )
inlinestatic

Write in red the text in zone ammo (zone 2).

See also
AIM_NoEmphazeAmmoSlotText
Note
This is intended to show the player that there is no ammo in his aircraft

Definition at line 285 of file cp_fightequip_callbacks.cpp.

References cgi.

Referenced by AIM_AircraftEquipMenuUpdate().

◆ AIM_InitCallbacks()

void AIM_InitCallbacks ( void )

Definition at line 941 of file cp_fightequip_callbacks.cpp.

References airequipCmds, and cgi.

Referenced by CP_AddCampaignCallbackCommands().

◆ AIM_NoEmphazeAmmoSlotText()

void AIM_NoEmphazeAmmoSlotText ( void )
inlinestatic

Write in white the text in zone ammo (zone 2).

See also
AIM_EmphazeAmmoSlotText
Note
This is intended to revert effects of AIM_EmphazeAmmoSlotText

Definition at line 295 of file cp_fightequip_callbacks.cpp.

References cgi.

Referenced by AIM_AircraftEquipMenuUpdate().

◆ AIM_ShutdownCallbacks()

void AIM_ShutdownCallbacks ( void )

Definition at line 946 of file cp_fightequip_callbacks.cpp.

References airequipCmds, and cgi.

Referenced by CP_RemoveCampaignCallbackCommands().

◆ AIM_UpdateAircraftItemList()

void AIM_UpdateAircraftItemList ( const aircraftSlot_t * slot)
static

Update the list of item you can choose.

Parameters
[in]slotPointer to aircraftSlot where items can be equiped

Definition at line 190 of file cp_fightequip_callbacks.cpp.

References _, AII_GetCraftitemTechsByType(), AIM_CrafttypeFilter(), AIM_SelectableCraftItem(), aircraftSlot_t::aircraft, airequipID, B_ItemInBase(), cgi, count, uiNode_t::disabled, INVSH_GetItemByID(), uiNode_t::name, TEXT_LIST, TEXT_LIST2, and va().

Referenced by AIM_AircraftEquipMenuUpdate().

◆ AIM_UpdateItemDescription()

Variable Documentation

◆ aimSelectedTechnology

technology_t* aimSelectedTechnology = nullptr
static

Selected technology in equip menu

Definition at line 36 of file cp_fightequip_callbacks.cpp.

Referenced by AIM_AircraftEquipAddItem_f(), AIM_AircraftEquipMenuClick_f(), and AIM_UpdateItemDescription().

◆ airequipCmds

const cmdList_t airequipCmds[]
static
Initial value:
= {
{"airequip_updatemenu", AIM_AircraftEquipMenuUpdate_f, "Init function for the aircraft equip menu"},
{"airequip_selectcategory", AIM_AircraftItemtypeByName_f, "Select an item category and update the GUI"},
{"airequip_list_click", AIM_AircraftEquipMenuClick_f, nullptr},
{"airequip_slot_select", AIM_AircraftEquipSlotSelect_f, nullptr},
{"airequip_add_item", AIM_AircraftEquipAddItem_f, "Add item to slot"},
{"airequip_remove_item", AIM_AircraftEquipRemoveItem_f, "Remove item from slot"},
{"airequip_zone_select", AIM_AircraftEquipZoneSelect_f, nullptr},
{nullptr, nullptr, nullptr}
}
static void AIM_AircraftEquipRemoveItem_f(void)
Delete an object from a zone.
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_AircraftEquipMenuUpdate_f(void)
Fills the weapon and shield list of the aircraft equip menu.
static void AIM_AircraftEquipMenuClick_f(void)
Set AIM_selectedTechnology to the technology of current selected aircraft item.
static void AIM_AircraftEquipSlotSelect_f(void)
Select the current slot you want to assign the item to.
static void AIM_AircraftItemtypeByName_f(void)
Update the GUI with a named itemtype.

Definition at line 931 of file cp_fightequip_callbacks.cpp.

Referenced by AIM_InitCallbacks(), and AIM_ShutdownCallbacks().

◆ airequipID

◆ airequipSelectedSlot

int airequipSelectedSlot = ZONE_NONE
static

◆ airequipSelectedZone

int airequipSelectedZone = ZONE_NONE
static

Selected zone in equip menu

Definition at line 34 of file cp_fightequip_callbacks.cpp.

Referenced by AIM_AircraftEquipAddItem_f(), AIM_AircraftEquipZoneSelect_f(), and AIM_CheckAirequipSelectedZone().