|
UFO: Alien Invasion
|
UFOpaedia script interpreter. More...
#include "../../DateTime.h"#include "../../cl_shared.h"#include "../../cl_inventory.h"#include "../../ui/ui_dataids.h"#include "../../ui/node/ui_node_option.h"#include "../../../shared/parse.h"#include "cp_campaign.h"#include "cp_mapfightequip.h"#include "cp_time.h"
Go to the source code of this file.
Macros | |
| #define | MAX_UPTEXT 4096 |
Enumerations | |
| enum | { UFOPEDIA_CHAPTERS , UFOPEDIA_INDEX , UFOPEDIA_ARTICLE , UFOPEDIA_DISPLAYEND } |
Functions | |
| static bool | UP_TechGetsDisplayed (const technology_t *tech) |
| Checks If a technology/UFOpaedia-entry will be displayed in the UFOpaedia (-list). | |
| static void | UP_ChangeDisplay (int newDisplay) |
| Modify the global display var. | |
| static const char * | UP_AircraftStatToName (int stat) |
| Translate a aircraft statistic integer to a translated string. | |
| static void | UP_DisplayTechTree (const technology_t *t) |
| Displays the tech tree dependencies in the UFOpaedia. | |
| static void | UP_BuildingDescription (const technology_t *t) |
| Prints the UFOpaedia description for buildings. | |
| void | UP_AircraftItemDescription (const objDef_t *item) |
| Prints the (UFOpaedia and other) description for aircraft items. | |
| void | UP_AircraftDescription (const technology_t *tech) |
| Prints the UFOpaedia description for aircraft. | |
| void | UP_UGVDescription (const ugv_t *ugvType) |
| Prints the description for robots/ugvs. | |
| int | UP_GetUnreadMails (void) |
| Sets the amount of unread/new mails. | |
| static void | UP_SetMailHeader (technology_t *tech, techMailType_t type, eventMail_t *mail) |
| Binds the mail header (if needed) to the mn.menuText array. | |
| static void | UP_DrawAssociatedAmmo (const technology_t *tech) |
| Set the ammo model to display to selected ammo (only for a reloadable weapon). | |
| static void | UP_Article (technology_t *tech, eventMail_t *mail) |
| Display only the TEXT_UFOPEDIA part for a given technology. | |
| void | UP_OpenEventMail (const char *eventMailID) |
| static void | UP_OpenMailWith (const char *techID) |
| Opens the mail view from everywhere with the entry given through name. | |
| void | UP_OpenWith (const char *techID) |
| Opens the UFOpaedia from everywhere with the entry given through name. | |
| void | UP_OpenCopyWith (const char *techID) |
| Opens the UFOpaedia with the entry given through name, not deleting copies. | |
| static void | UP_FindEntry_f (void) |
| Search and open the UFOpaedia with given id. | |
| static uiNode_t * | UP_GenerateArticlesSummary (pediaChapter_t *parentChapter) |
| Generate a list of options for all allowed articles of a chapter. | |
| static void | UP_GenerateSummary (void) |
| Generate a tree of option for all allowed chapters and articles. | |
| static void | UP_Content_f (void) |
| Displays the chapters in the UFOpaedia. | |
| static void | UP_Click_f (void) |
| Callback when we click on the ufopedia summary. | |
| static void | UP_TechTreeClick_f (void) |
| static void | UP_Update_f (void) |
| Redraw the UFOpaedia article. | |
| static void | UP_MailClientClick_f (void) |
| Mailclient click function callback. | |
| static void | UP_ResearchedLinkClick_f (void) |
| Change UFOpaedia article when clicking on the name of associated ammo or weapon. | |
| static void | UP_OpenMail_f (void) |
| Start the mailclient. | |
| static void | UP_SetAllMailsRead_f (void) |
| Marks all mails read in mailclient. | |
| void | UP_InitStartup (void) |
| void | UP_Shutdown (void) |
| void | UP_ParseChapter (const char *name, const char **text) |
| Parse the UFOpaedia chapters from scripts. | |
Variables | |
| static cvar_t * | mn_uppretext |
| static cvar_t * | mn_uppreavailable |
| static pediaChapter_t * | upChaptersDisplayList [MAX_PEDIACHAPTERS] |
| static int | numChaptersDisplayList |
| static technology_t * | upCurrentTech |
| static pediaChapter_t * | currentChapter |
| static char | upBuffer [MAX_UPTEXT] |
| static int | upDisplay = UFOPEDIA_CHAPTERS |
| static const cmdList_t | ufopediaCmds [] |
UFOpaedia script interpreter.
Split the mail code into cl_mailclient.c/h
Remove direct access to nodes
Definition in file cp_ufopedia.cpp.
| #define MAX_UPTEXT 4096 |
Definition at line 47 of file cp_ufopedia.cpp.
| anonymous enum |
| Enumerator | |
|---|---|
| UFOPEDIA_CHAPTERS | |
| UFOPEDIA_INDEX | |
| UFOPEDIA_ARTICLE | |
| UFOPEDIA_DISPLAYEND | |
Definition at line 54 of file cp_ufopedia.cpp.
| void UP_AircraftDescription | ( | const technology_t * | tech | ) |
Prints the UFOpaedia description for aircraft.
Definition at line 323 of file cp_ufopedia.cpp.
References _, AIR_AircraftMenuStatsValues(), AIR_GetAircraft(), AIR_GetHangarCapacityType(), AIR_GetOperationRange(), AIR_IsUFO, AIR_STATS_ACCURACY, AIR_STATS_ANTIMATTER, AIR_STATS_DAMAGE, AIR_STATS_FUELSIZE, AIR_STATS_MAX, AIR_STATS_MAXSPEED, AIR_STATS_SPEED, B_GetBuildingTemplateByType(), B_GetBuildingTypeByCapacity(), cgi, Com_sprintf(), i, aircraft_t::maxElectronics, aircraft_t::maxTeamSize, aircraft_t::maxWeapons, building_t::name, technology_t::provides, Q_strcat(), RS_Collected_, RS_IsResearched_ptr(), aircraft_t::stats, TEXT_ITEMDESCRIPTION, UP_AircraftStatToName(), UP_DisplayTechTree(), and upBuffer.
Referenced by BS_MarketAircraftDescription(), and UP_Article().
Prints the (UFOpaedia and other) description for aircraft items.
| item | The object definition of the item |
Definition at line 228 of file cp_ufopedia.cpp.
References _, AC_ITEM_AMMO, AC_ITEM_BASE_LASER, AC_ITEM_BASE_MISSILE, AC_ITEM_WEAPON, AII_GetItemWeightBySize(), AII_WeightToName(), AIR_AircraftMenuStatsValues(), AIR_STATS_MAX, AIR_STATS_WRANGE, objDef_t::ammo, objDef_t::ammos, cgi, objDef_t::craftitem, EQUAL, i, objDef_t::id, technology_t::mdl, objDef_t::name, objDef_t::numAmmos, Q_strcat(), RS_GetTechForItem(), RS_IsResearched_ptr(), craftItem::stats, TEXT_ITEMDESCRIPTION, craftItem::type, UP_AircraftStatToName(), craftItem::weaponDamage, and craftItem::weaponDelay.
Referenced by AIM_UpdateItemDescription(), BDEF_SelectItem_f(), BS_ShowInfo_f(), and UP_Article().
|
static |
Translate a aircraft statistic integer to a translated string.
Definition at line 133 of file cp_ufopedia.cpp.
References _, AIR_STATS_ACCURACY, AIR_STATS_ANTIMATTER, AIR_STATS_DAMAGE, AIR_STATS_ECM, AIR_STATS_FUELSIZE, AIR_STATS_MAXSPEED, AIR_STATS_SHIELD, AIR_STATS_SPEED, and AIR_STATS_WRANGE.
Referenced by UP_AircraftDescription(), and UP_AircraftItemDescription().
|
static |
Display only the TEXT_UFOPEDIA part for a given technology.
| [in] | tech | The technology_t pointer to print the UFOpaedia article for |
| [in] | The mail parameters in case we produce a mail |
Definition at line 593 of file cp_ufopedia.cpp.
References _, eventMail_t::body, cgi, currentChapter, technology_t::description, ERR_DROP, i, objDef_t::id, technology_t::image, INVSH_GetItemByID(), INVSH_GetItemByIDX(), technology_t::mdl, mn_uppretext, technology_t::name, technologyDescriptions_t::numDescriptions, technology_t::preDescription, technology_t::provides, Q_streq, RS_ARMOUR, RS_BUILDING, RS_Collected_, RS_CRAFT, RS_CRAFTITEM, RS_GetDescription(), RS_IsResearched_ptr(), RS_TECH, RS_UGV, RS_WEAPON, technology_t::statusResearchable, TECHMAIL_PRE, TECHMAIL_RESEARCHED, TEXT_UFOPEDIA, TEXT_UFOPEDIA_REQUIREMENT, technology_t::type, UFOPEDIA_ARTICLE, UFOPEDIA_CHAPTERS, UFOPEDIA_INDEX, UP_AircraftDescription(), UP_AircraftItemDescription(), UP_BuildingDescription(), UP_ChangeDisplay(), UP_DisplayTechTree(), UP_DrawAssociatedAmmo(), UP_SetMailHeader(), UP_UGVDescription(), technology_t::upChapter, upCurrentTech, and upDisplay.
Referenced by UP_Click_f(), UP_FindEntry_f(), UP_OpenEventMail(), and UP_Update_f().
|
static |
Prints the UFOpaedia description for buildings.
Definition at line 202 of file cp_ufopedia.cpp.
References _, B_GetBuildingTemplate(), building_t::buildTime, cgi, Com_sprintf(), building_t::dependsBuilding, building_t::fixCosts, ngettext, technology_t::provides, Q_strcat(), TEXT_ITEMDESCRIPTION, UP_DisplayTechTree(), upBuffer, and building_t::varCosts.
Referenced by UP_Article().
Modify the global display var.
Definition at line 90 of file cp_ufopedia.cpp.
References _, cgi, currentChapter, TEXT_ITEMDESCRIPTION, TEXT_UFOPEDIA, TEXT_UFOPEDIA_MAIL, TEXT_UFOPEDIA_MAILHEADER, TEXT_UFOPEDIA_REQUIREMENT, UFOPEDIA_ARTICLE, UFOPEDIA_CHAPTERS, UFOPEDIA_INDEX, upCurrentTech, and upDisplay.
Referenced by UP_Article(), UP_Click_f(), and UP_Content_f().
Callback when we click on the ufopedia summary.
Definition at line 879 of file cp_ufopedia.cpp.
References ccs, cgi, UFOPEDIA_CHAPTERS, UP_Article(), and UP_ChangeDisplay().
Displays the chapters in the UFOpaedia.
Definition at line 868 of file cp_ufopedia.cpp.
References UFOPEDIA_CHAPTERS, UP_ChangeDisplay(), and UP_GenerateSummary().
|
static |
Displays the tech tree dependencies in the UFOpaedia.
Add support for "requireAND"
re-iterate trough logic blocks (i.e. append the tech-names it references recursively)
Only display tech if it is ok to do so.
Definition at line 165 of file cp_ufopedia.cpp.
References _, cgi, ERR_DROP, i, requirement_t::id, requirement_t::link, requirements_t::links, technology_t::name, requirements_t::numLinks, technology_t::requireAND, RS_LINK_TECH, requirement_t::typelink_t::tech, TEXT_UFOPEDIA_REQUIREMENT, requirement_t::type, and UP_TechGetsDisplayed().
Referenced by UP_AircraftDescription(), UP_Article(), and UP_BuildingDescription().
|
static |
Set the ammo model to display to selected ammo (only for a reloadable weapon).
| tech | technology_t pointer for the weapon's tech |
Definition at line 577 of file cp_ufopedia.cpp.
References objDef_t::ammos, cgi, INVSH_GetItemByID(), technology_t::mdl, objDef_t::numAmmos, technology_t::provides, and RS_GetTechForItem().
Referenced by UP_Article().
Search and open the UFOpaedia with given id.
Definition at line 762 of file cp_ufopedia.cpp.
References cgi, DEBUG_CLIENT, id, technology_t::redirect, RS_GetTechByID(), and UP_Article().
|
static |
Generate a list of options for all allowed articles of a chapter.
| [in] | parentChapter | requested chapter |
Definition at line 798 of file cp_ufopedia.cpp.
References cgi, pediaChapter_t::first, technology_t::idx, technology_t::name, UP_TechGetsDisplayed(), technology_t::upNext, and va().
Referenced by UP_GenerateSummary().
Generate a tree of option for all allowed chapters and articles.
Definition at line 820 of file cp_ufopedia.cpp.
References _, ccs, cgi, ERR_DROP, pediaChapter_t::first, uiNode_t::firstChild, i, pediaChapter_t::id, pediaChapter_t::name, numChaptersDisplayList, OPTION_UFOPEDIA, OPTIONEXTRADATA, UP_GenerateArticlesSummary(), UP_TechGetsDisplayed(), upChaptersDisplayList, upCurrentTech, and va().
Referenced by UP_Content_f().
Sets the amount of unread/new mails.
Definition at line 436 of file cp_ufopedia.cpp.
References ccs, cgi, m, MSG_EVENT, MSG_NEWS, MSG_RESEARCH_FINISHED, MSG_RESEARCH_PROPOSAL, RS_IsResearched_ptr(), TECHMAIL_PRE, and TECHMAIL_RESEARCHED.
Referenced by CP_CampaignRun(), and UP_MailClientClick_f().
Definition at line 1157 of file cp_ufopedia.cpp.
References cgi, mn_uppreavailable, mn_uppretext, and ufopediaCmds.
Referenced by CP_InitStartup().
Mailclient click function callback.
Definition at line 951 of file cp_ufopedia.cpp.
References ccs, cgi, m, MSG_EVENT, MSG_NEWS, MSG_RESEARCH_FINISHED, MSG_RESEARCH_PROPOSAL, TECHMAIL_PRE, TECHMAIL_RESEARCHED, UP_GetUnreadMails(), UP_OpenEventMail(), and UP_OpenMailWith().
| void UP_OpenCopyWith | ( | const char * | techID | ) |
Opens the UFOpaedia with the entry given through name, not deleting copies.
| techID | UFOpaedia entry id (technology script id) |
Definition at line 752 of file cp_ufopedia.cpp.
References cgi.
| void UP_OpenEventMail | ( | const char * | eventMailID | ) |
Definition at line 708 of file cp_ufopedia.cpp.
References cgi, CL_GetEventMail(), and UP_Article().
Referenced by CL_EventAddMail(), and UP_MailClientClick_f().
Start the mailclient.
Definition at line 1038 of file cp_ufopedia.cpp.
References _, cgi, Com_sprintf(), CP_DateConvertLong(), eventMail_t::date, Date_GetMonthName(), dateLong_t::day, eventMail_t::from, techMail_t::from, eventMail_t::icon, techMail_t::icon, m, dateLong_t::month, MSG_EVENT, MSG_NEWS, MSG_RESEARCH_FINISHED, MSG_RESEARCH_PROPOSAL, eventMail_t::read, techMail_t::read, eventMail_t::subject, techMail_t::subject, TECHMAIL_PRE, TECHMAIL_RESEARCHED, and dateLong_t::year.
Referenced by UP_SetAllMailsRead_f().
|
static |
Opens the mail view from everywhere with the entry given through name.
| techID | mail entry id (technology script id) |
Definition at line 724 of file cp_ufopedia.cpp.
References cgi.
Referenced by UP_MailClientClick_f().
| void UP_OpenWith | ( | const char * | techID | ) |
Opens the UFOpaedia from everywhere with the entry given through name.
| techID | UFOpaedia entry id (technology script id) |
Definition at line 738 of file cp_ufopedia.cpp.
References cgi.
Referenced by B_BuildingOpenAfterClick_f(), BS_MarketInfoClick_f(), PR_ProductionListRightClick_f(), RS_ResearchFinish(), UP_ResearchedLinkClick_f(), and UP_TechTreeClick_f().
| void UP_ParseChapter | ( | const char * | name, |
| const char ** | text ) |
Parse the UFOpaedia chapters from scripts.
| [in] | name | Chapter ID |
| [in] | text | Text for chapter ID |
Definition at line 1188 of file cp_ufopedia.cpp.
References ccs, cgi, Com_Parse(), cp_campaignPool, ERR_DROP, pediaChapter_t::id, pediaChapter_t::idx, MAX_PEDIACHAPTERS, name, pediaChapter_t::name, OBJZERO, and Q_streq.
Referenced by CP_ParseScriptFirst().
Change UFOpaedia article when clicking on the name of associated ammo or weapon.
Definition at line 1010 of file cp_ufopedia.cpp.
References objDef_t::ammos, technology_t::id, INVSH_GetItemByID(), objDef_t::isAmmo(), objDef_t::isReloadable(), RS_GetTechForItem(), UP_OpenWith(), UP_TechGetsDisplayed(), upCurrentTech, objDef_t::weapon, and objDef_t::weapons.
Marks all mails read in mailclient.
Definition at line 1108 of file cp_ufopedia.cpp.
References ccs, cgi, m, MSG_EVENT, MSG_NEWS, MSG_RESEARCH_FINISHED, MSG_RESEARCH_PROPOSAL, TECHMAIL_PRE, TECHMAIL_RESEARCHED, and UP_OpenMail_f().
|
static |
Binds the mail header (if needed) to the mn.menuText array.
| [in] | tech | The tech to generate a header for. |
| [in] | type | The type of mail (research proposal or finished research) |
| [in] | The mail descriptor structure |
Definition at line 490 of file cp_ufopedia.cpp.
References _, ccs, cgi, Com_sprintf(), CP_DateConvertLong(), eventMail_t::date, techMail_t::date, Date_GetMonthName(), dateLong_t::day, ERR_DROP, eventMail_t::from, techMail_t::from, technology_t::mail, MAX_VAR, eventMail_t::model, techMail_t::model, dateLong_t::month, technology_t::numTechMails, technology_t::preResearchedDate, Q_strncpyz(), eventMail_t::read, techMail_t::read, technology_t::researchedDate, eventMail_t::subject, techMail_t::subject, TECHMAIL_MAX, TECHMAIL_PRE, TECHMAIL_RESEARCHED, TEXT_UFOPEDIA_MAILHEADER, eventMail_t::to, techMail_t::to, type, and dateLong_t::year.
Referenced by UP_Article().
Definition at line 1171 of file cp_ufopedia.cpp.
References cgi, and ufopediaCmds.
Referenced by CP_RemoveCampaignCallbackCommands().
|
static |
Checks If a technology/UFOpaedia-entry will be displayed in the UFOpaedia (-list).
UP_Article Definition at line 70 of file cp_ufopedia.cpp.
References INVSH_GetItemByIDSilent(), objDef_t::isVirtual, technologyDescriptions_t::numDescriptions, technology_t::preDescription, technology_t::provides, technology_t::redirect, RS_Collected_, RS_IsResearched_ptr(), RS_LOGIC, technology_t::statusResearchable, and technology_t::type.
Referenced by UP_DisplayTechTree(), UP_GenerateArticlesSummary(), UP_GenerateSummary(), and UP_ResearchedLinkClick_f().
Definition at line 906 of file cp_ufopedia.cpp.
References cgi, ERR_DROP, i, requirement_t::id, technology_t::id, requirement_t::link, requirements_t::links, requirements_t::numLinks, RS_LINK_TECH, RS_LINK_TECH_NOT, requirement_t::typelink_t::tech, requirement_t::type, UP_OpenWith(), technology_t::upChapter, and upCurrentTech.
Prints the description for robots/ugvs.
| [in] | ugvType | What type of robot/ugv to print the description for. |
Definition at line 401 of file cp_ufopedia.cpp.
References _, cgi, Com_sprintf(), ugv_t::id, technology_t::name, technology_t::provides, RS_Collected_, RS_GetTechByProvided(), RS_IsResearched_ptr(), TEXT_ITEMDESCRIPTION, and ugv_t::weapon.
Referenced by UP_Article().
Redraw the UFOpaedia article.
Definition at line 941 of file cp_ufopedia.cpp.
References UP_Article(), and upCurrentTech.
|
static |
Definition at line 45 of file cp_ufopedia.cpp.
Referenced by UP_Article(), and UP_ChangeDisplay().
|
static |
Definition at line 39 of file cp_ufopedia.cpp.
Referenced by UP_InitStartup().
|
static |
Definition at line 38 of file cp_ufopedia.cpp.
Referenced by UP_Article(), and UP_InitStartup().
|
static |
Definition at line 42 of file cp_ufopedia.cpp.
Referenced by UP_GenerateSummary().
|
static |
Definition at line 1142 of file cp_ufopedia.cpp.
Referenced by UP_InitStartup(), and UP_Shutdown().
|
static |
Definition at line 48 of file cp_ufopedia.cpp.
Referenced by UP_AircraftDescription(), and UP_BuildingDescription().
|
static |
Definition at line 41 of file cp_ufopedia.cpp.
Referenced by UP_GenerateSummary().
|
static |
Definition at line 44 of file cp_ufopedia.cpp.
Referenced by UP_Article(), UP_ChangeDisplay(), UP_GenerateSummary(), UP_ResearchedLinkClick_f(), UP_TechTreeClick_f(), and UP_Update_f().
|
static |
Definition at line 61 of file cp_ufopedia.cpp.
Referenced by UP_Article(), and UP_ChangeDisplay().