cp_mission_triggers.c File Reference

Campaign mission triggers. More...

#include "../cl_shared.h"
#include "../ui/ui_main.h"
#include "cp_campaign.h"
#include "cp_map.h"
#include "cp_missions.h"
#include "cp_mission_triggers.h"
Include dependency graph for cp_mission_triggers.c:

Go to the source code of this file.

Functions

static void CP_AddTechAsResearchable_f (void)
static void CP_AddItemAsCollected_f (void)
 For things like craft_ufo_scout that are no real items this function will increase the collected counter by one.
static void CP_ChangeNationHappiness_f (void)
 Changes nation happiness by given value.
static void CP_EndGame_f (void)
static void CP_MissionTriggerFunctions (qboolean add)
 Add/Remove temporary mission trigger functions.
void CP_ExecuteMissionTrigger (mission_t *m, qboolean won)
 Executes console commands after a mission.

Variables

static const cmdList_t cp_commands []
 mission trigger functions

Detailed Description

Campaign mission triggers.

Definition in file cp_mission_triggers.c.


Function Documentation

static void CP_AddItemAsCollected_f ( void   )  [static]

For things like craft_ufo_scout that are no real items this function will increase the collected counter by one.

Note:
Mission trigger function
See also:
CP_MissionTriggerFunctions
CP_ExecuteMissionTrigger

Definition at line 60 of file cp_mission_triggers.c.

References B_GetBaseByIDX(), Cmd_Argc(), Cmd_Argv(), Com_DPrintf(), Com_Printf(), csi, DEBUG_CLIENT, i, objDef_s::id, id, INVSH_GetItemByIDX(), equipDef_s::numItems, csi_s::numODs, RS_GetTechForItem(), RS_MarkCollected(), and base_s::storage.

static void CP_AddTechAsResearchable_f ( void   )  [static]
Note:
Mission trigger function
See also:
CP_MissionTriggerFunctions
CP_ExecuteMissionTrigger

Definition at line 38 of file cp_mission_triggers.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), RS_GetTechByID(), and RS_MarkOneResearchable().

static void CP_ChangeNationHappiness_f ( void   )  [static]

Changes nation happiness by given value.

Note:
There must be argument passed to this function being converted to float.

Definition at line 90 of file cp_mission_triggers.c.

References ccs, Cmd_Argc(), Cmd_Argv(), Com_Printf(), nationInfo_s::happiness, MAP_GetNation(), NAT_SetHappiness(), mission_s::pos, ccs_s::selectedMission, and nation_s::stats.

static void CP_EndGame_f ( void   )  [static]
Note:
Mission trigger function
See also:
CP_MissionTriggerFunctions
CP_ExecuteMissionTrigger

Definition at line 120 of file cp_mission_triggers.c.

References _, CP_EndCampaign(), qtrue, TEXT_STANDARD, and UI_RegisterText().

void CP_ExecuteMissionTrigger ( mission_t m,
qboolean  won 
)

Executes console commands after a mission.

Parameters:
m Pointer to mission_t
won Int value that is one when you've won the game, and zero when the game was lost Can execute console commands (triggers) on win and lose This can be used for story dependent missions

Definition at line 168 of file cp_mission_triggers.c.

References Cmd_ExecuteString(), Com_DPrintf(), Com_Printf(), CP_MissionTriggerFunctions(), DEBUG_CLIENT, mission_s::mapDef, mapDef_s::onlose, mission_s::onlose, mapDef_s::onwin, mission_s::onwin, qfalse, and qtrue.

Referenced by CL_GameAutoGo(), and GAME_CP_Results().

static void CP_MissionTriggerFunctions ( qboolean  add  )  [static]

Add/Remove temporary mission trigger functions.

Note:
These function can be defined via onwin/onlose parameters in missions.ufo
Parameters:
[in] add If true, add the trigger functions, otherwise delete them

Definition at line 149 of file cp_mission_triggers.c.

References Cmd_AddCommand(), Cmd_RemoveCommand(), cmdList_s::description, cmdList_s::function, and cmdList_s::name.

Referenced by CP_ExecuteMissionTrigger().


Variable Documentation

const cmdList_t cp_commands[] [static]
Initial value:
 {
    {"cp_add_researchable", CP_AddTechAsResearchable_f, "Add a tech as researchable"},
    {"cp_add_item", CP_AddItemAsCollected_f, "Add an item as collected"},
    {"cp_changehappiness", CP_ChangeNationHappiness_f, "Function to raise or lower nation happiness."},
    {"cp_endgame", CP_EndGame_f, "This command will end the current campaign"},

    {NULL, NULL, NULL}
}

mission trigger functions

Definition at line 135 of file cp_mission_triggers.c.


Generated by  doxygen 1.6.2