示例#1
0
/**
 * @brief Check if an sprite name exists
 * @param[in] name Name of the sprite
 * @return True if the sprite exists
 * @note not very fast; if we use it often we should improve the search
 */
static bool UI_SpriteExists (const char* name)
{
	for (int i = 0; i < ui_global.numSprites; i++) {
		if (strncmp(name, ui_global.sprites[i].name, MEMBER_SIZEOF(uiSprite_t, name)) != 0)
			continue;
		return true;
	}
	return false;
}
示例#2
0
/**
 * @brief Return an sprite by is name
 * @param[in] name Name of the sprite
 * @return The requested sprite, else NULL
 * @note not very fast; if we use it often we should improve the search
 */
uiSprite_t* UI_GetSpriteByName (const char* name)
{
	int i;
	for (i = 0; i < ui_global.numSprites; i++) {
		if (strncmp(name, ui_global.sprites[i].name, MEMBER_SIZEOF(uiSprite_t, name)) != 0)
			continue;
		return &ui_global.sprites[i];
	}
	return UI_AutoGenerateSprite(name);
}
示例#3
0
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/

#include "../ui_nodes.h"
#include "ui_node_abstractscrollbar.h"

#define EXTRADATA_TYPE abstractScrollbarExtraData_t

static const value_t properties[] = {
	/* Current position of the scroll. Image of the <code>viewpos</code> from <code>abstractscrollable</code> node. */
	{"current", V_INT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, pos),  MEMBER_SIZEOF(EXTRADATA_TYPE, pos)},
	/* Image of the <code>viewsize</code> from <code>abstractscrollable</code> node. */
	{"viewsize", V_INT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, viewsize),  MEMBER_SIZEOF(EXTRADATA_TYPE, viewsize)},
	/* Image of the <code>fullsize</code> from <code>abstractscrollable</code> node. */
	{"fullsize", V_INT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, fullsize),  MEMBER_SIZEOF(EXTRADATA_TYPE, fullsize)},

	/* If true, hide the scroll when the position is 0 and can't change (when <code>viewsize</code> >= <code>fullsize</code>). */
	{"hidewhenunused", V_BOOL, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, hideWhenUnused),  MEMBER_SIZEOF(EXTRADATA_TYPE, hideWhenUnused)},

	/* Callback value set when before calling onChange. It is used to know the change apply by the user
	 * @Deprecated
	 */
	{"lastdiff", V_INT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, lastdiff),  MEMBER_SIZEOF(EXTRADATA_TYPE, lastdiff)},

	{NULL, V_NULL, 0, 0}
};
示例#4
0
/** @brief valid properties for options (used by selectbox, tab, optonlist and optiontree) */
static const value_t properties[] = {
	/**
	 * Displayed text
	 */
	{"label", V_STRING, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, label), 0},

	/**
	 * Value of the option
	 */
	{"value", V_STRING, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, value), 0},

	/**
	 * If true, child are not displayed
	 */
	{"collapsed", V_BOOL, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, collapsed), MEMBER_SIZEOF(EXTRADATA_TYPE, collapsed)},

	/* Icon used to display the node
	 */
	{"icon", V_UI_SPRITEREF, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, icon), MEMBER_SIZEOF(EXTRADATA_TYPE, icon)},

	{NULL, V_NULL, 0, 0},
};

void UI_RegisterOptionNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "option";
	behaviour->properties = properties;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
	behaviour->doLayout = UI_OptionDoLayout;
	behaviour->propertyChanged = UI_OptionPropertyChanged;
示例#5
0
	uiNode_t* option = UI_GetOption(OPTION_TEAMDEFS);
	if (option != nullptr)
		return;

	for (int i = 0; i < csi.numTeamDefs; i++) {
		const teamDef_t* td = &csi.teamDef[i];
		if (td->team != TEAM_CIVILIAN)
			UI_AddOption(&option, td->id, va("_%s", td->name), td->id);
	}
	UI_RegisterOption(OPTION_TEAMDEFS, option);
}

/** @brief valid actorskin descriptors */
static const value_t actorskin_vals[] = {
	{"name", V_STRING, offsetof(actorSkin_t, name), 0},
	{"singleplayer", V_BOOL, offsetof(actorSkin_t, singleplayer), MEMBER_SIZEOF(actorSkin_t, singleplayer)},
	{"multiplayer", V_BOOL, offsetof(actorSkin_t, multiplayer), MEMBER_SIZEOF(actorSkin_t, multiplayer)},

	{nullptr, V_NULL, 0, 0}
};


static void CL_ParseActorSkin (const char* name, const char** text)
{
	/* NOTE: first skin is special cause we don't get the skin with suffix */
	if (CL_GetActorSkinCount() == 0) {
		if (!Q_streq(name, "default") != 0) {
			Com_Error(ERR_DROP, "CL_ParseActorSkin: First actorskin read from script must be \"default\" skin.");
		}
	}
示例#6
0
	/* the pointers are not freed, this is done with the
	 * pool clear in CP_ResetCampaignData */
	LIST_Delete(&eventMails);
}

/** @brief Valid event mail parameters */
static const value_t eventMail_vals[] = {
	{"subject", V_TRANSLATION_STRING, offsetof(eventMail_t, subject), 0},
	{"from", V_TRANSLATION_STRING, offsetof(eventMail_t, from), 0},
	{"to", V_TRANSLATION_STRING, offsetof(eventMail_t, to), 0},
	{"cc", V_TRANSLATION_STRING, offsetof(eventMail_t, cc), 0},
	{"date", V_TRANSLATION_STRING, offsetof(eventMail_t, date), 0},
	{"body", V_TRANSLATION_STRING, offsetof(eventMail_t, body), 0},
	{"icon", V_HUNK_STRING, offsetof(eventMail_t, icon), 0},
	{"model", V_HUNK_STRING, offsetof(eventMail_t, model), 0},
	{"skipmessage", V_BOOL, offsetof(eventMail_t, skipMessage), MEMBER_SIZEOF(eventMail_t, skipMessage)},

	{NULL, V_NULL, 0, 0}
};

/**
 * @sa CL_ParseScriptFirst
 * @note write into cp_campaignPool - free on every game restart and reparse
 */
void CL_ParseEventMails (const char *name, const char **text)
{
	eventMail_t *eventMail;

	if (ccs.numEventMails >= MAX_EVENTMAILS) {
		Com_Printf("CL_ParseEventMails: mail def \"%s\" with same name found, second ignored\n", name);
		return;
示例#7
0
文件: cp_rank.cpp 项目: cigo/ufoai
 * @return nullptr on invalid index
 * @return pointer to the rank definition otherwise
 */
rank_t* CL_GetRankByIdx (const int index)
{
	if (index < 0 || index >= ccs.numRanks)
		return nullptr;

	return &ccs.ranks[index];
}

static const value_t rankValues[] = {
	{"name", V_TRANSLATION_STRING, offsetof(rank_t, name), 0},
	{"shortname", V_TRANSLATION_STRING,	offsetof(rank_t, shortname), 0},
	{"image", V_HUNK_STRING, offsetof(rank_t, image), 0},
	{"mind", V_INT, offsetof(rank_t, mind), MEMBER_SIZEOF(rank_t, mind)},
	{"killed_enemies", V_INT, offsetof(rank_t, killedEnemies), MEMBER_SIZEOF(rank_t, killedEnemies)},
	{"killed_others", V_INT, offsetof(rank_t, killedOthers), MEMBER_SIZEOF(rank_t, killedOthers)},
	{"factor", V_FLOAT, offsetof(rank_t, factor), MEMBER_SIZEOF(rank_t, factor)},
	{"level", V_INT, offsetof(rank_t, level), MEMBER_SIZEOF(rank_t, level)},
	{nullptr, V_NULL, 0, 0}
};

/**
 * @brief Parse medals and ranks defined in the medals.ufo file.
 * @sa CL_ParseScriptFirst
 */
void CL_ParseRanks (const char* name, const char** text)
{
	rank_t* rank;
	const char* errhead = "CL_ParseRanks: unexpected end of file (medal/rank ";
	UI_AbstractScrollableNodeSetY(node, EXTRADATA(node).scrollY.fullSize, -1, -1);
}

/**
 * @brief Scroll the Y scroll with a relative position, and call event if need
 * @return True, if something have change
 */
qboolean UI_AbstractScrollableNodeScrollY (uiNode_t *node, int offset)
{
	assert(UI_NodeInstanceOf(node, "abstractscrollable"));
	return UI_AbstractScrollableNodeSetY(node, EXTRADATA(node).scrollY.viewPos + offset, -1, -1);
}

static const value_t properties[] = {
	/* position of the vertical view (into the full number of elements the node contain) */
	{"viewpos", V_INT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, scrollY.viewPos),  MEMBER_SIZEOF(EXTRADATA_TYPE, scrollY.viewPos)},
	/* size of the vertical view (proportional to the number of elements the node can display without moving) */
	{"viewsize", V_INT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, scrollY.viewSize),  MEMBER_SIZEOF(EXTRADATA_TYPE, scrollY.viewSize)},
	/* full vertical size (proportional to the number of elements the node contain) */
	{"fullsize", V_INT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, scrollY.fullSize),  MEMBER_SIZEOF(EXTRADATA_TYPE, scrollY.fullSize)},
	/* Called when one of the properties viewpos/viewsize/fullsize change */
	{"onviewchange", V_UI_ACTION, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, onViewChange), MEMBER_SIZEOF(EXTRADATA_TYPE, onViewChange)},

	/* Call it to vertically scroll the document up */
	{"pageup", V_UI_NODEMETHOD, ((size_t) UI_AbstractScrollableNodePageUp), 0},
	/* Call it to vertically scroll the document down */
	{"pagedown", V_UI_NODEMETHOD, ((size_t) UI_AbstractScrollableNodePageDown), 0},
	/* Call it to vertically scroll the document up */
	{"moveup", V_UI_NODEMETHOD, ((size_t) UI_AbstractScrollableNodeMoveUp), 0},
	/* Call it to vertically scroll the document down */
	{"movedown", V_UI_NODEMETHOD, ((size_t) UI_AbstractScrollableNodeMoveDown), 0},
示例#9
0
	}

	text = UI_GetReferenceString(node, node->text);
	if (text != NULL && *text != '\0') {
		R_Color(textColor);
		UI_DrawStringInBox(font, node->contentAlign,
			pos[0] + node->padding, pos[1] + node->padding,
			node->size[0] - node->padding - node->padding, node->size[1] - node->padding - node->padding,
			text, LONGLINES_PRETTYCHOP);
		R_Color(NULL);
	}
}

static const value_t properties[] = {
	/* Skin position. Define the top-left position of the skin we will used from the image. Y should not be bigger than 64. To compute the high corner we use the node size. */
	{"texl", V_POS, UI_EXTRADATA_OFFSETOF(customButtonExtraData_t, texl), MEMBER_SIZEOF(customButtonExtraData_t, texl)},
	/* Sprite used to display the background */
	{"background", V_UI_SPRITEREF, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, background), MEMBER_SIZEOF(EXTRADATA_TYPE, background)},

	{NULL, V_NULL, 0, 0}
};

void UI_RegisterCustomButtonNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "custombutton";
	behaviour->extends = "button";
	behaviour->draw = UI_CustomButtonNodeDraw;
	behaviour->properties = properties;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
}
示例#10
0
}

/**
 * @brief Call before the script initialization of the node
 */
static void UI_KeyBindingNodeLoading (uiNode_t *node)
{
	node->padding = 8;
	node->contentAlign = ALIGN_CL;
	EXTRADATA(node).bindingWidth = 50;
	Vector4Set(node->color, 1, 1, 1, 1);
	Vector4Set(node->selectedColor, 1, 1, 1, 0.5);
}

static const value_t properties[] = {
	{"keyspace", V_INT, UI_EXTRADATA_OFFSETOF(keyBindingExtraData_t, keySpace), MEMBER_SIZEOF(keyBindingExtraData_t, keySpace)},
	{"bindingwidth", V_INT, UI_EXTRADATA_OFFSETOF(keyBindingExtraData_t, bindingWidth), MEMBER_SIZEOF(keyBindingExtraData_t, bindingWidth)},

	{NULL, V_NULL, 0, 0}
};

void UI_RegisterKeyBindingNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "keybinding";
	behaviour->leftClick = UI_KeyBindingNodeClick;
	behaviour->keyPressed = UI_KeyBindingNodeKeyPressed;
	behaviour->draw = UI_KeyBindingNodeDraw;
	behaviour->loading = UI_KeyBindingNodeLoading;
	behaviour->properties = properties;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
}
示例#11
0
	if (Vector2Empty(ms->pos)) {
		if (!CP_GetRandomPosOnGeoscapeWithParameters(ms->pos, mapDef->terrains, mapDef->cultures, mapDef->populations, NULL)) {
			Com_Printf("SCP_ParseMission: could not find a valid position for '%s'\n", ms->id);
			return;
		}
	}

	scd->numMissions++;
}

static const value_t stageset_vals[] = {
	{"needed", V_STRING, offsetof(stageSet_t, needed), 0},
	{"delay", V_DATE, offsetof(stageSet_t, delay), 0},
	{"frame", V_DATE, offsetof(stageSet_t, frame), 0},
	{"expire", V_DATE, offsetof(stageSet_t, expire), 0},
	{"number", V_INT, offsetof(stageSet_t, number), MEMBER_SIZEOF(stageSet_t, number)},
	{"quota", V_INT, offsetof(stageSet_t, quota), MEMBER_SIZEOF(stageSet_t, quota)},
	{"ufos", V_INT, offsetof(stageSet_t, ufos), MEMBER_SIZEOF(stageSet_t, ufos)},
	{"nextstage", V_STRING, offsetof(stageSet_t, nextstage), 0},
	{"endstage", V_STRING, offsetof(stageSet_t, endstage), 0},
	{"commands", V_STRING, offsetof(stageSet_t, cmds), 0},

	{NULL, 0, 0, 0}
};

static void SCP_ParseStageSet (const char *name, const char **text)
{
	const char *errhead = "SCP_ParseStageSet: unexpected end of file (stageset ";
	stageSet_t *sp;
	const value_t *vp;
	char missionstr[256];
示例#12
0
	lineStrip = ui_global.sharedData[dataId].data.lineStrip;
	for (; lineStrip; lineStrip = lineStrip->next) {
		/* Draw this line if it's valid. */
		if (lineStrip->pointList && lineStrip->numPoints > 0) {
			R_Color(lineStrip->color);
			R_DrawLineStrip(lineStrip->numPoints, lineStrip->pointList);
		}
	}
	R_Color(NULL);

	UI_Transform(NULL, NULL, NULL);
}

static const value_t properties[] = {
	/* Identity the shared data the node use. It must be a LINESTRIP data. */
	{"dataid", V_UI_DATAID, UI_EXTRADATA_OFFSETOF(lineChartExtraData_t, dataId), MEMBER_SIZEOF(lineChartExtraData_t, dataId)},
	/* If true, it display axes of the chart. */
	{"displayaxes", V_BOOL, UI_EXTRADATA_OFFSETOF(lineChartExtraData_t, displayAxes), MEMBER_SIZEOF(lineChartExtraData_t, displayAxes)},
	/* Axe color. */
	{"axescolor", V_COLOR, UI_EXTRADATA_OFFSETOF(lineChartExtraData_t, axesColor), MEMBER_SIZEOF(lineChartExtraData_t, axesColor)},
	{NULL, V_NULL, 0, 0}
};

void UI_RegisterLineChartNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "linechart";
	behaviour->draw = UI_LineChartNodeDraw;
	behaviour->properties = properties;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
}
示例#13
0
}

/**
 * @brief Handles radio button clicks
 */
static void UI_RadioButtonNodeClick (uiNode_t * node, int x, int y)
{
	if (node->onClick)
		UI_ExecuteEventActions(node, node->onClick);

	UI_RadioButtonNodeActivate(node);
}

static const value_t properties[] = {
	/* Numerical value defining the radiobutton. Cvar is updated with this value when the radio button is selected. */
	{"value", V_FLOAT, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, value), MEMBER_SIZEOF(EXTRADATA_TYPE, value)},
	/* String Value defining the radiobutton. Cvar is updated with this value when the radio button is selected. */
	{"stringValue", V_CVAR_OR_STRING, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, string), 0},

	/* Cvar name shared with the radio button group to identify when a radio button is selected. */
	{"cvar", V_UI_CVAR, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, cvar), 0},
	/* Icon used to display the node */
	{"icon", V_UI_SPRITEREF, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, icon), MEMBER_SIZEOF(EXTRADATA_TYPE, icon)},
	{"flipicon", V_BOOL, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, flipIcon), MEMBER_SIZEOF(EXTRADATA_TYPE, flipIcon)},
	/* Sprite used to display the background */
	{"background", V_UI_SPRITEREF, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, background), MEMBER_SIZEOF(EXTRADATA_TYPE, background)},

	{NULL, V_NULL, 0, 0}
};

void UI_RegisterRadioButtonNode (uiBehaviour_t *behaviour)
示例#14
0
		if (installation->installationStatus == INSTALLATION_UNDER_CONSTRUCTION
		 && installation->buildStart
		 && installation->buildStart + installation->installationTemplate->buildTime <= ccs.date.day) {

			INS_FinishInstallation(installation);

			Com_sprintf(cp_messageBuffer, lengthof(cp_messageBuffer), _("Construction of installation %s finished."), installation->name);
			MSO_CheckAddNewMessage(NT_INSTALLATION_BUILDFINISH, _("Installation finished"), cp_messageBuffer, qfalse, MSG_CONSTRUCTION, NULL);
		}
	}
}

static const value_t installation_vals[] = {
	{"name", V_TRANSLATION_STRING, offsetof(installationTemplate_t, name), 0},
	{"description", V_TRANSLATION_STRING, offsetof(installationTemplate_t, description), 0},
	{"radar_range", V_INT, offsetof(installationTemplate_t, radarRange), MEMBER_SIZEOF(installationTemplate_t, radarRange)},
	{"radar_tracking_range", V_INT, offsetof(installationTemplate_t, trackingRange), MEMBER_SIZEOF(installationTemplate_t, trackingRange)},
	{"max_batteries", V_INT, offsetof(installationTemplate_t, maxBatteries), MEMBER_SIZEOF(installationTemplate_t, maxBatteries)},
	{"max_ufo_stored", V_INT, offsetof(installationTemplate_t, maxUFOsStored), MEMBER_SIZEOF(installationTemplate_t, maxUFOsStored)},
	{"max_damage", V_INT, offsetof(installationTemplate_t, maxDamage), MEMBER_SIZEOF(installationTemplate_t, maxDamage)},
	{"model", V_HUNK_STRING, offsetof(installationTemplate_t, model), 0},
	{"image", V_HUNK_STRING, offsetof(installationTemplate_t, image), 0},

	{NULL, 0, 0, 0}
};

/**
 * @brief Copies an entry from the installation description file into the list of installation templates.
 * @note Parses one "installation" entry in the installation.ufo file and writes
 * it into the next free entry in installationTemplates.
 * @param[in] name Unique test-id of a installationTemplate_t.
示例#15
0
		UI_TimerRelease(capturedTimer);
		capturedTimer = NULL;
	}
}

/**
 * @brief Call before the script initialized the node
 */
static void UI_ZoneNodeLoading (uiNode_t *node)
{
	EXTRADATA(node).clickDelay = 1000;
}

static const value_t properties[] = {
	/* If true, the <code>onclick</code> call back is called more than one time if the user do not release the button. */
	{"repeat", V_BOOL, UI_EXTRADATA_OFFSETOF(zoneExtraData_t, repeat), MEMBER_SIZEOF(zoneExtraData_t, repeat)},
	/* Delay it is used between 2 calls of <code>onclick</code>. */
	{"clickdelay", V_INT, UI_EXTRADATA_OFFSETOF(zoneExtraData_t, clickDelay), MEMBER_SIZEOF(zoneExtraData_t, clickDelay)},
	{NULL, V_NULL, 0, 0}
};

void UI_RegisterZoneNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "zone";
	behaviour->loading = UI_ZoneNodeLoading;
	behaviour->mouseDown = UI_ZoneNodeDown;
	behaviour->mouseUp = UI_ZoneNodeUp;
	behaviour->capturedMouseLost = UI_ZoneNodeCapturedMouseLost;
	behaviour->properties = properties;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
}
示例#16
0
	0, 0, 0,

	0,
	PTL_ONLY_ONE_TYPE | V_STRING, PTL_ONLY_ONE_TYPE | V_STRING, PTL_ONLY_ONE_TYPE | V_STRING, PTL_ONLY_ONE_TYPE | V_STRING
};
CASSERT(lengthof(pc_types) == PC_NUM_PTLCMDS);

/**
 * @brief particle script values
 * @note image, model and program are special values - see @c CL_ParticleFunction
 */
static const value_t pps[] = {
	{"image", V_STRING, offsetof(ptl_t, pic), 0},
	{"model", V_STRING, offsetof(ptl_t, model), 0},
	{"program", V_STRING, offsetof(ptl_t, program), 0},
	{"skin", V_INT, offsetof(ptl_t, skin), MEMBER_SIZEOF(ptl_t, skin)},
	{"blend", V_BLEND, offsetof(ptl_t, blend), MEMBER_SIZEOF(ptl_t, blend)},
	{"style", V_STYLE, offsetof(ptl_t, style), MEMBER_SIZEOF(ptl_t, style)},
	{"thinkfade", V_FADE, offsetof(ptl_t, thinkFade), MEMBER_SIZEOF(ptl_t, thinkFade)},
	{"framefade", V_FADE, offsetof(ptl_t, frameFade), MEMBER_SIZEOF(ptl_t, frameFade)},
	{"size", V_POS, offsetof(ptl_t, size), MEMBER_SIZEOF(ptl_t, size)},
	{"scale", V_VECTOR, offsetof(ptl_t, scale), MEMBER_SIZEOF(ptl_t, scale)},
	{"color", V_COLOR, offsetof(ptl_t, color), MEMBER_SIZEOF(ptl_t, color)},
	{"a", V_VECTOR, offsetof(ptl_t, a), MEMBER_SIZEOF(ptl_t, a)},
	{"v", V_VECTOR, offsetof(ptl_t, v), MEMBER_SIZEOF(ptl_t, v)},
	{"s", V_VECTOR, offsetof(ptl_t, s), MEMBER_SIZEOF(ptl_t, s)},
	{"offset", V_VECTOR, offsetof(ptl_t, offset), MEMBER_SIZEOF(ptl_t, offset)},
	{"scroll_s", V_FLOAT, offsetof(ptl_t, scrollS), MEMBER_SIZEOF(ptl_t, scrollS)},
	{"scroll_t", V_FLOAT, offsetof(ptl_t, scrollT), MEMBER_SIZEOF(ptl_t, scrollT)},

	/* t and dt are not specified in particle definitions */
示例#17
0
		B_DrawBuilding(entry);
	}
}

/**
 * @brief Called before loading. Used to set default attribute values
 */
static void UI_BaseLayoutNodeLoading (uiNode_t *node)
{
	node->padding = 3;
	Vector4Set(node->color, 1, 1, 1, 1);
}

static const value_t properties[] = {
	/* Identify the base, from a base ID, the node use. */
	{"baseid", V_INT, UI_EXTRADATA_OFFSETOF(baseExtraData_t, baseid), MEMBER_SIZEOF(baseExtraData_t, baseid)},
	{NULL, V_NULL, 0, 0}
};

void UI_RegisterAbstractBaseNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "abstractbase";
	behaviour->isAbstract = qtrue;
	behaviour->properties = properties;
	behaviour->loaded = UI_AbstractBaseNodeLoaded;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
}

void UI_RegisterBaseMapNode (uiBehaviour_t *behaviour)
{
	behaviour->name = "basemap";
示例#18
0
static void UI_VideoNodeInit (uiNode_t *node, linkedList_t *params)
{
	CIN_InitCinematic(&(EXTRADATA(node).cin));
}

static void UI_VideoNodeClose (uiNode_t *node)
{
	/* If playing a cinematic, stop it */
	CIN_CloseCinematic(&(EXTRADATA(node).cin));
}

static const value_t properties[] = {
	/** Source of the video. File name without prefix ./base/videos and without extension */
	{"src", V_CVAR_OR_STRING, offsetof(uiNode_t, image), 0},
	/** Use or not the music from the video. */
	{"nosound", V_BOOL, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, nosound), MEMBER_SIZEOF(EXTRADATA_TYPE, nosound)},
	/** Invoked when video end. */
	{"onEnd", V_UI_ACTION, UI_EXTRADATA_OFFSETOF(videoExtraData_t, onEnd), MEMBER_SIZEOF(videoExtraData_t, onEnd)},
	{NULL, V_NULL, 0, 0}
};

void UI_RegisterVideoNode (uiBehaviour_t* behaviour)
{
	behaviour->name = "video";
	behaviour->draw = UI_VideoNodeDraw;
	behaviour->properties = properties;
	behaviour->windowOpened = UI_VideoNodeInit;
	behaviour->windowClosed = UI_VideoNodeClose;
	behaviour->drawOverWindow = UI_VideoNodeDrawOverWindow;
	behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
}
示例#19
0
				}
				Com_DPrintf(DEBUG_CLIENT, "...tech %s\n", tech->id);
				break;
			}
		}

		if (i == ccs.numTechnologies)
			Com_Printf("CP_ParseResearchableCampaignStates: unknown token \"%s\" ignored (tech %s)\n", token, name);

	} while (*text);
}

/* =========================================================== */

static const value_t salary_vals[] = {
	{"soldier_base", V_INT, offsetof(salary_t, base[EMPL_SOLDIER]), MEMBER_SIZEOF(salary_t, base[EMPL_SOLDIER])},
	{"soldier_rankbonus", V_INT, offsetof(salary_t, rankBonus[EMPL_SOLDIER]), MEMBER_SIZEOF(salary_t, rankBonus[EMPL_SOLDIER])},
	{"worker_base", V_INT, offsetof(salary_t, base[EMPL_WORKER]), MEMBER_SIZEOF(salary_t, base[EMPL_WORKER])},
	{"worker_rankbonus", V_INT, offsetof(salary_t, rankBonus[EMPL_WORKER]), MEMBER_SIZEOF(salary_t, rankBonus[EMPL_WORKER])},
	{"scientist_base", V_INT, offsetof(salary_t, base[EMPL_SCIENTIST]), MEMBER_SIZEOF(salary_t, base[EMPL_SCIENTIST])},
	{"scientist_rankbonus", V_INT, offsetof(salary_t, rankBonus[EMPL_SCIENTIST]), MEMBER_SIZEOF(salary_t, rankBonus[EMPL_SCIENTIST])},
	{"pilot_base", V_INT, offsetof(salary_t, base[EMPL_PILOT]), MEMBER_SIZEOF(salary_t, base[EMPL_PILOT])},
	{"pilot_rankbonus", V_INT, offsetof(salary_t, rankBonus[EMPL_PILOT]), MEMBER_SIZEOF(salary_t, rankBonus[EMPL_PILOT])},
	{"aircraft_factor", V_INT, offsetof(salary_t, aircraftFactor), MEMBER_SIZEOF(salary_t, aircraftFactor)},
	{"aircraft_divisor", V_INT, offsetof(salary_t, aircraftDivisor), MEMBER_SIZEOF(salary_t, aircraftDivisor)},
	{"base_upkeep", V_INT, offsetof(salary_t, baseUpkeep), MEMBER_SIZEOF(salary_t, baseUpkeep)},
	{"admin_initial", V_INT, offsetof(salary_t, adminInitial), MEMBER_SIZEOF(salary_t, adminInitial)},
	{"admin_soldier", V_INT, offsetof(salary_t, admin[EMPL_SOLDIER]), MEMBER_SIZEOF(salary_t, admin[EMPL_SOLDIER])},
	{"admin_worker", V_INT, offsetof(salary_t, admin[EMPL_WORKER]), MEMBER_SIZEOF(salary_t, admin[EMPL_WORKER])},
	{"admin_scientist", V_INT, offsetof(salary_t, admin[EMPL_SCIENTIST]), MEMBER_SIZEOF(salary_t, admin[EMPL_SCIENTIST])},
	{"admin_pilot", V_INT, offsetof(salary_t, admin[EMPL_PILOT]), MEMBER_SIZEOF(salary_t, admin[EMPL_PILOT])},
示例#20
0
     * Normal button start at 0x0, mouse over start at 64x0, mouse click
     * start at 0x64 (but not yet implemented), and disabled start at 64x64.
     * See the image to have a usable template for this node.
     * @image html http://ufoai.ninex.info/wiki/images/Button_blue.png
     */
    /* @override onclick
     * Call back event called when we click on the node. If the click select the node,
     * it called before we start the cvar edition.
     */
    /* @override onchange
     * Call back event (like click...) fired when the text is changed, after
     * validation. An abort of the edition dont fire this event.
     */

    /* Custom the draw behaviour by hiding each character of the text with a star (''*''). */
    {"ispassword", V_BOOL, UI_EXTRADATA_OFFSETOF(textEntryExtraData_t, isPassword), MEMBER_SIZEOF(textEntryExtraData_t, isPassword)},
    /* ustom the mouse event behaviour. When we are editing the text, if we click out of the node, the edition is aborted. Changes on
     * the text are canceled, and no change event are fired.
     */
    {"clickoutabort", V_BOOL, UI_EXTRADATA_OFFSETOF(textEntryExtraData_t, clickOutAbort), MEMBER_SIZEOF(textEntryExtraData_t, clickOutAbort)},
    /* Call it when we abort the edition */
    {"onabort", V_UI_ACTION, UI_EXTRADATA_OFFSETOF(textEntryExtraData_t, onAbort), MEMBER_SIZEOF(textEntryExtraData_t, onAbort)},
    /* Call it to force node edition */
    {"edit", V_UI_NODEMETHOD, ((size_t) UI_TextEntryNodeFocus), 0},

    {NULL, V_NULL, 0, 0}
};

void UI_RegisterTextEntryNode (uiBehaviour_t *behaviour)
{
    behaviour->name = "textentry";
示例#21
0
*/

#include "../client.h"
#include "../cgame/cl_game.h"
#include "cl_particle.h"
#include "cl_spawn.h"
#include "../../shared/parse.h"

static r_light_t sun;

/* position in the spawnflags */
#define MISC_MODEL_GLOW 9
#define SPAWNFLAG_NO_DAY 8

static const value_t localEntityValues[] = {
	{"skin", V_INT, offsetof(localEntityParse_t, skin), MEMBER_SIZEOF(localEntityParse_t, skin)},
	{"maxteams", V_INT, offsetof(localEntityParse_t, maxteams), MEMBER_SIZEOF(localEntityParse_t, maxteams)},
	{"spawnflags", V_INT, offsetof(localEntityParse_t, spawnflags), MEMBER_SIZEOF(localEntityParse_t, spawnflags)},
	{"maxlevel", V_INT, offsetof(localEntityParse_t, maxLevel), MEMBER_SIZEOF(localEntityParse_t, maxLevel)},
	{"attenuation", V_FLOAT, offsetof(localEntityParse_t, attenuation), MEMBER_SIZEOF(localEntityParse_t, attenuation)},
	{"volume", V_FLOAT, offsetof(localEntityParse_t, volume), MEMBER_SIZEOF(localEntityParse_t, volume)},
	{"frame", V_INT, offsetof(localEntityParse_t, frame), MEMBER_SIZEOF(localEntityParse_t, frame)},
	{"angle", V_FLOAT, offsetof(localEntityParse_t, angle), MEMBER_SIZEOF(localEntityParse_t, angle)},
	{"wait", V_POS, offsetof(localEntityParse_t, wait), MEMBER_SIZEOF(localEntityParse_t, wait)},
	{"angles", V_VECTOR, offsetof(localEntityParse_t, angles), MEMBER_SIZEOF(localEntityParse_t, angles)},
	{"origin", V_VECTOR, offsetof(localEntityParse_t, origin), MEMBER_SIZEOF(localEntityParse_t, origin)},
	{"color", V_VECTOR, offsetof(localEntityParse_t, color), MEMBER_SIZEOF(localEntityParse_t, color)},
	{"modelscale_vec", V_VECTOR, offsetof(localEntityParse_t, scale), MEMBER_SIZEOF(localEntityParse_t, scale)},
	{"wait", V_POS, offsetof(localEntityParse_t, wait), MEMBER_SIZEOF(localEntityParse_t, wait)},
	{"classname", V_STRING, offsetof(localEntityParse_t, classname), 0},
	{"model", V_STRING, offsetof(localEntityParse_t, model), 0},
示例#22
0
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/

#include "ui_main.h"
#include "ui_internal.h"
#include "ui_parse.h"
#include "ui_sprite.h"
#include "ui_render.h"

const value_t ui_spriteProperties[] = {
	{"size", V_POS, offsetof(uiSprite_t, size), MEMBER_SIZEOF(uiSprite_t, size)},
	{"single", V_BOOL, offsetof(uiSprite_t, single), 0},
	{"blend", V_BOOL, offsetof(uiSprite_t, blend), 0},
	{"pack64", V_BOOL, offsetof(uiSprite_t, pack64), 0},
	{"tiled_17_1_3", V_BOOL, offsetof(uiSprite_t, tiled_17_1_3), 0},
	{"tiled_25_1_3", V_BOOL, offsetof(uiSprite_t, tiled_25_1_3), 0},
	{"tiled_popup", V_BOOL, offsetof(uiSprite_t, tiled_popup), 0},
	{"border", V_INT, offsetof(uiSprite_t, border), MEMBER_SIZEOF(uiSprite_t, border)},

	{"texl", V_POS, offsetof(uiSprite_t, pos[SPRITE_STATUS_NORMAL]), MEMBER_SIZEOF(uiSprite_t, pos[SPRITE_STATUS_NORMAL])},
	{"hoveredtexl", V_POS, offsetof(uiSprite_t, pos[SPRITE_STATUS_HOVER]), MEMBER_SIZEOF(uiSprite_t, pos[SPRITE_STATUS_HOVER])},
	{"disabledtexl", V_POS, offsetof(uiSprite_t, pos[SPRITE_STATUS_DISABLED]), MEMBER_SIZEOF(uiSprite_t, pos[SPRITE_STATUS_DISABLED])},
	{"clickedtexl", V_POS, offsetof(uiSprite_t, pos[SPRITE_STATUS_CLICKED]), MEMBER_SIZEOF(uiSprite_t, pos[SPRITE_STATUS_CLICKED])},

	{"image", (valueTypes_t)V_REF_OF_STRING, offsetof(uiSprite_t, image[SPRITE_STATUS_NORMAL]), 0},
	{"hoveredimage", (valueTypes_t)V_REF_OF_STRING, offsetof(uiSprite_t, image[SPRITE_STATUS_HOVER]), 0},
示例#23
0
	/** Position of the camera */
	seqCamera_t camera;

	/** Store sequence entities */
	seqEnt_t ents[MAX_SEQENTS];
	int numEnts;

	/** Store sequence 2Dobj */
	seq2D_t obj2Ds[MAX_SEQ2DS];
	int numObj2Ds;

} sequenceContext_t;

/** @brief valid id names for camera */
static const value_t seqCamera_vals[] = {
	{"origin", V_VECTOR, offsetof(seqCamera_t, origin), MEMBER_SIZEOF(seqCamera_t, origin)},
	{"speed", V_VECTOR, offsetof(seqCamera_t, speed), MEMBER_SIZEOF(seqCamera_t, speed)},
	{"angles", V_VECTOR, offsetof(seqCamera_t, angles), MEMBER_SIZEOF(seqCamera_t, angles)},
	{"omega", V_VECTOR, offsetof(seqCamera_t, omega), MEMBER_SIZEOF(seqCamera_t, omega)},
	{"dist", V_FLOAT, offsetof(seqCamera_t, dist), MEMBER_SIZEOF(seqCamera_t, dist)},
	{"ddist", V_FLOAT, offsetof(seqCamera_t, ddist), MEMBER_SIZEOF(seqCamera_t, ddist)},
	{"zoom", V_FLOAT, offsetof(seqCamera_t, zoom), MEMBER_SIZEOF(seqCamera_t, zoom)},
	{"dzoom", V_FLOAT, offsetof(seqCamera_t, dzoom), MEMBER_SIZEOF(seqCamera_t, dzoom)},
	{NULL, V_NULL, 0, 0}
};

/** @brief valid entity names for a sequence */
static const value_t seqEnt_vals[] = {
	{"name", V_STRING, offsetof(seqEnt_t, name), 0},
	{"skin", V_INT, offsetof(seqEnt_t, skin), MEMBER_SIZEOF(seqEnt_t, skin)},
	{"alpha", V_FLOAT, offsetof(seqEnt_t, alpha), MEMBER_SIZEOF(seqEnt_t, alpha)},
示例#24
0
#include "ui_main.h"
#include "ui_internal.h"
#include "ui_font.h"
#include "ui_parse.h"

#include "../cl_shared.h"
#include "../../shared/parse.h"
#include "../renderer/r_font.h"

#define MAX_FONTS 16
static int numFonts = 0;
static uiFont_t fonts[MAX_FONTS];

static const value_t fontValues[] = {
	{"font", V_TRANSLATION_STRING, offsetof(uiFont_t, path), 0},
	{"size", V_INT, offsetof(uiFont_t, size), MEMBER_SIZEOF(uiFont_t, size)},
	{"style", V_HUNK_STRING, offsetof(uiFont_t, style), 0},

	{nullptr, V_NULL, 0, 0}
};

/**
 * @brief Registers a new TTF font
 * @note The TTF font path is translated via gettext to be able to use different
 * fonts for every translation
 * @param[in] font Font to register
 */
static void UI_RegisterFont (const uiFont_t* font)
{
	const char* path = _(font->path);
示例#25
0
		return B_DEFENCE_LASER;
	} else if (Q_streq(buildingID, "radar")) {
		return B_RADAR;
	}
	return MAX_BUILDING_TYPE;
}

/**
 * @brief Holds the names of valid entries in the basemanagement.ufo file.
 *
 * The valid definition names for BUILDINGS (building_t) in the basemanagement.ufo file.
 * to the appropriate values in the corresponding struct
 */
static const value_t valid_building_vars[] = {
	{"map_name", V_HUNK_STRING, offsetof(building_t, mapPart), 0},	/**< Name of the map file for generating basemap. */
	{"max_count", V_INT, offsetof(building_t, maxCount), MEMBER_SIZEOF(building_t, maxCount)},	/**< How many building of the same type allowed? */
	{"level", V_FLOAT, offsetof(building_t, level), MEMBER_SIZEOF(building_t, level)},	/**< building level */
	{"name", V_TRANSLATION_STRING, offsetof(building_t, name), 0},	/**< The displayed building name. */
	{"tech", V_HUNK_STRING, offsetof(building_t, pedia), 0},	/**< The pedia-id string for the associated pedia entry. */
	{"status", V_INT, offsetof(building_t, buildingStatus), MEMBER_SIZEOF(building_t, buildingStatus)},	/**< The current status of the building. */
	{"image", V_HUNK_STRING, offsetof(building_t, image), 0},	/**< Identifies the image for the building. */
	{"size", V_POS, offsetof(building_t, size), MEMBER_SIZEOF(building_t, size)},	/**< Building size. */
	{"fixcosts", V_INT, offsetof(building_t, fixCosts), MEMBER_SIZEOF(building_t, fixCosts)},	/**< Cost to build. */
	{"varcosts", V_INT, offsetof(building_t, varCosts), MEMBER_SIZEOF(building_t, varCosts)},	/**< Costs that will come up by using the building. */
	{"build_time", V_INT, offsetof(building_t, buildTime), MEMBER_SIZEOF(building_t, buildTime)},	/**< How many days it takes to construct the building. */
	{"starting_employees", V_INT, offsetof(building_t, maxEmployees), MEMBER_SIZEOF(building_t, maxEmployees)},	/**< How many employees to hire on construction in the first base. */
	{"capacity", V_INT, offsetof(building_t, capacity), MEMBER_SIZEOF(building_t, capacity)},	/**< A size value that is used by many buildings in a different way. */

	/*event handler functions */
	{"onconstruct", V_HUNK_STRING, offsetof(building_t, onConstruct), 0}, /**< Event handler. */
	{"ondestroy", V_HUNK_STRING, offsetof(building_t, onDestroy), 0}, /**< Event handler. */
示例#26
0
	if (EXTRADATA(node).oldRefValue == NULL)
		EXTRADATA(node).oldRefValue = UI_AllocStaticString("", MAX_OLDREFVALUE);

	/* no tag but no size */
	if (EXTRADATA(node).tag == NULL && (node->size[0] == 0 || node->size[1] == 0)) {
		Com_Printf("UI_ModelNodeLoaded: Please set a pos and size to the node '%s'. Note: 'origin' is a relative value to the center of the node\n", UI_GetPath(node));
	}
}

/** @brief valid properties for model */
static const value_t properties[] = {
	/* Both. Name of the animation for the model */
	{"anim", V_CVAR_OR_STRING, UI_EXTRADATA_OFFSETOF(modelExtraData_t, animation), 0},
	/* Main model only. Point of view. */
	{"angles", V_VECTOR, UI_EXTRADATA_OFFSETOF(modelExtraData_t, angles), MEMBER_SIZEOF(modelExtraData_t, angles)},
	/* Main model only. Position of the model relative to the center of the node. */
	{"origin", V_VECTOR, UI_EXTRADATA_OFFSETOF(modelExtraData_t, origin), MEMBER_SIZEOF(modelExtraData_t, origin)},
	/* Main model only. Rotation vector of the model. */
	{"omega", V_VECTOR, UI_EXTRADATA_OFFSETOF(modelExtraData_t, omega), MEMBER_SIZEOF(modelExtraData_t, omega)},
	/* Both. Scale the model */
	{"scale", V_VECTOR, UI_EXTRADATA_OFFSETOF(modelExtraData_t, scale), MEMBER_SIZEOF(modelExtraData_t, scale)},
	/* Submodel only. A tag name to link the model to the parent model. */
	{"tag", V_CVAR_OR_STRING, UI_EXTRADATA_OFFSETOF(modelExtraData_t, tag), 0},
	/* Main model only. Auto compute the "better" scale for the model. The function dont work
	 * very well at the moment because it dont check the angle and no more submodel bounding box.
	 */
	{"autoscale", V_BOOL, UI_EXTRADATA_OFFSETOF(modelExtraData_t, autoscale), MEMBER_SIZEOF(modelExtraData_t, autoscale)},
	/* Main model only. Allow to change the POV of the model with the mouse (only for main model) */
	{"rotatewithmouse", V_BOOL, UI_EXTRADATA_OFFSETOF(modelExtraData_t, rotateWithMouse), MEMBER_SIZEOF(modelExtraData_t, rotateWithMouse)},
	/* Main model only. Clip the model with the node rect */