UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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"

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. More...
 
static void AIM_CheckAirequipSelectedSlot (const aircraft_t *aircraft)
 Check that airequipSelectedSlot is the indice of an existing slot in the aircraft. More...
 
aircraftSlot_tAII_SelectAircraftSlot (aircraft_t *aircraft, aircraftItemType_t type)
 Returns a pointer to the selected slot. More...
 
static void AIM_CheckAirequipSelectedZone (aircraftSlot_t *slot)
 Check that airequipSelectedZone is available. More...
 
static const char * AIM_AircraftItemtypeName (const int equiptype)
 Returns the userfriendly name for craftitem types (shown in aircraft equip menu) More...
 
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. More...
 
static void AIM_DrawAircraftSlots (const aircraft_t *aircraft)
 Draw only slots existing for this aircraft, and emphases selected one. More...
 
static void AIM_EmphazeAmmoSlotText (void)
 Write in red the text in zone ammo (zone 2) More...
 
static void AIM_NoEmphazeAmmoSlotText (void)
 Write in white the text in zone ammo (zone 2) More...
 
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. More...
 
static void AIM_AircraftEquipMenuUpdate_f (void)
 Fills the weapon and shield list of the aircraft equip menu. More...
 
static void AIM_AircraftEquipSlotSelect_f (void)
 Select the current slot you want to assign the item to. More...
 
static void AIM_AircraftEquipZoneSelect_f (void)
 Select the current zone you want to assign the item to. More...
 
static void AIM_AircraftEquipAddItem_f (void)
 Add selected item to current zone. More...
 
static void AIM_AircraftEquipRemoveItem_f (void)
 Delete an object from a zone. More...
 
static void AIM_AircraftEquipMenuClick_f (void)
 Set AIM_selectedTechnology to the technology of current selected aircraft item. More...
 
static void AIM_AircraftItemtypeByName_f (void)
 Update the GUI with a named itemtype. More...
 
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

#define AIM_LOADING_ALIENTECH   3
#define AIM_LOADING_NOSLOTSELECTED   1
#define AIM_LOADING_NOTECHNOLOGYSELECTED   2
#define AIM_LOADING_NOTUSABLEWITHWEAPON   8
#define AIM_LOADING_NOWEAPON   7
#define AIM_LOADING_OK   0
#define AIM_LOADING_TECHNOLOGYNOTRESEARCHED   4
#define AIM_LOADING_TOOHEAVY   5
#define AIM_LOADING_UNKNOWNPROBLEM   6

Function Documentation

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_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_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(), cgi, cgame_import_s::Cmd_Argv(), and RS_GetTechByIDX().

static void AIM_AircraftEquipMenuUpdate_f ( void  )
static
static void AIM_AircraftEquipSlotSelect_f ( void  )
static
static 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, cgame_import_s::Cmd_Argv(), i, name, and Q_streq.

static 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().

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

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.

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

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_s::item, ZONE_AMMO, and ZONE_MAIN.

Referenced by AIM_AircraftEquipMenuUpdate(), and AIM_AircraftEquipZoneSelect_f().

static bool AIM_CrafttypeFilter ( const base_t base,
aircraftItemType_t  filterType,
const technology_t tech 
)
static
static void AIM_DrawAircraftSlots ( const aircraft_t aircraft)
static
static 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().

void AIM_InitCallbacks ( void  )

Definition at line 941 of file cp_fightequip_callbacks.cpp.

References cgi.

Referenced by CP_AddCampaignCallbackCommands().

static 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().

void AIM_ShutdownCallbacks ( void  )

Definition at line 946 of file cp_fightequip_callbacks.cpp.

References cgi.

Referenced by CP_RemoveCampaignCallbackCommands().

static void AIM_UpdateAircraftItemList ( const aircraftSlot_t slot)
static

Variable Documentation

technology_t* aimSelectedTechnology = nullptr
static

Selected technology in equip menu

Definition at line 36 of file cp_fightequip_callbacks.cpp.

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_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.
static void AIM_AircraftEquipMenuClick_f(void)
Set AIM_selectedTechnology to the technology of current selected aircraft item.
static void AIM_AircraftEquipZoneSelect_f(void)
Select the current zone you want to assign the item to.
static void AIM_AircraftEquipRemoveItem_f(void)
Delete an object from a zone.
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.

Definition at line 931 of file cp_fightequip_callbacks.cpp.

int airequipSelectedSlot = ZONE_NONE
static
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().