Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
dialog_multiplayer_create_mapinfo.qc File Reference
#include "dialog_multiplayer_create_mapinfo.qh"
#include "button.qh"
#include "image.qh"
#include "maplist.qh"
#include "textlabel.qh"
#include <common/mapinfo.qh>
Include dependency graph for dialog_multiplayer_create_mapinfo.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void XonoticMapInfoDialog_fill (entity me)
void XonoticMapInfoDialog_loadMapInfo (entity me, int i, entity mlb)

Function Documentation

◆ XonoticMapInfoDialog_fill()

void XonoticMapInfoDialog_fill ( entity me)

Definition at line 41 of file dialog_multiplayer_create_mapinfo.qc.

42{
43 entity e;
44 int i;
45 float w, wgt, n;
46 me.TR(me);
47 me.TDempty(me, 0.2);
48 me.TD(me, me.rows - 2, 3, e = makeXonoticImage(string_null, 4.0/3.0));
49 me.previewImage = e;
50 me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
51 w = me.columns - me.currentColumn;
52 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Title:")));
53 me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
54 e.colorL = SKINCOLOR_MAPLIST_TITLE;
55 e.allowCut = true;
56 me.titleLabel = e;
57 me.TR(me);
58 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Author:")));
59 me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
60 e.colorL = SKINCOLOR_MAPLIST_AUTHOR;
61 e.allowCut = true;
62 me.authorLabel = e;
63 me.TR(me);
64 me.TD(me, 1, w, e = makeXonoticTextLabel(0, _("Gametypes:")));
65
66 n = ceil(GameType_GetTotalCount() / (me.rows - 6));
67 wgt = (w - 0.2) / n;
68 for(i = 0; i < GameType_GetTotalCount(); ++i)
69 {
70 if(mod(i, n) == 0)
71 {
72 me.TR(me);
73 me.TDempty(me, 0.2);
74 }
75 me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, MapInfo_Type_ToText(GameType_GetID(i))));
76 me.(typeLabels[i]) = e;
77 }
78
79 me.gotoRC(me, me.rows - 2, 0);
80 me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, ""));
81 e.allowCut = true;
82 me.descriptionLabel = e;
83
84 me.gotoRC(me, me.rows - 1, 0);
85 me.TDempty(me, 0.5);
86
87 me.TD(me, 1, me.columns - 5.5, e = makeXonoticButton(_("Close"), '0 0 0'));
88 e.onClick = Dialog_Close;
89 e.onClickEntity = me;
90 me.TD(me, 1, me.columns - 5.5, me.startButton = e = makeXonoticButton(ZCTX(_("MAP^Play")), '0 0 0'));
91 me.startButton.onClick = MapList_LoadMap;
92 me.startButton.onClickEntity = NULL; // filled later
93 setDependent(e, "g_campaign", 0, 0);
94}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define ZCTX(s)
Definition i18n.qh:68
string MapInfo_Type_ToText(Gametype t)
Definition mapinfo.qc:661
void MapList_LoadMap(entity btn, entity me)
Definition maplist.qc:278
void Dialog_Close(entity button, entity me)
Definition dialog.qc:7
entity makeXonoticButton(string theText, vector theColor)
Definition button.qc:10
Gametype GameType_GetID(int cnt)
Definition util.qc:664
int GameType_GetTotalCount()
Definition util.qc:687
void setDependent(entity e, string theCvarName, float theCvarMin, float theCvarMax)
Definition util.qc:180
float mod(float val, float m)
float ceil(float f)
string string_null
Definition nil.qh:9
#define NULL
Definition post.qh:14
entity makeXonoticTextLabel(float theAlign, string theText)
Definition textlabel.qc:3
entity makeXonoticImage(string theImage, float theAspect)
Definition image.qc:3

References ceil(), Dialog_Close(), entity(), GameType_GetID(), GameType_GetTotalCount(), makeXonoticButton(), makeXonoticImage(), makeXonoticTextLabel(), MapInfo_Type_ToText(), MapList_LoadMap(), mod(), NULL, setDependent(), string_null, and ZCTX.

◆ XonoticMapInfoDialog_loadMapInfo()

void XonoticMapInfoDialog_loadMapInfo ( entity me,
int i,
entity mlb )

Definition at line 9 of file dialog_multiplayer_create_mapinfo.qc.

10{
11 me.currentMapIndex = i;
12 me.startButton.onClickEntity = mlb;
14
15 strcpy(me.currentMapBSPName, MapInfo_Map_bspname);
16 strcpy(me.currentMapTitle, strdecolorize(MapInfo_Map_title));
17 strcpy(me.currentMapAuthor, strdecolorize(MapInfo_Map_author));
18 strcpy(me.currentMapDescription, MapInfo_Map_description);
19 strcpy(me.currentMapPreviewImage, strcat("/maps/", MapInfo_Map_bspname));
20 if(!draw_PictureExists(me.currentMapPreviewImage)) // Quake 3 compatibility
21 strcpy(me.currentMapPreviewImage, strcat("/levelshots/", MapInfo_Map_bspname));
22
23 me.frame.setText(me.frame, me.currentMapBSPName);
24 me.titleLabel.setText(me.titleLabel, me.currentMapTitle);
25 me.authorLabel.setText(me.authorLabel, me.currentMapAuthor);
26 me.descriptionLabel.setText(me.descriptionLabel, me.currentMapDescription);
27 if(!draw_PictureExists(me.currentMapPreviewImage))
28 me.previewImage.src = "nopreview_map";
29 else
30 me.previewImage.src = me.currentMapPreviewImage;
31
32 for(i = 0; i < GameType_GetTotalCount(); ++i)
33 {
34 entity e;
35 e = me.(typeLabels[i]);
36 e.disabled = !(MapInfo_Map_supportedGametypes & GameType_GetID(i).gametype_flags);
37 }
38
40}
bool MapInfo_Get_ByID(int i)
Definition mapinfo.qc:275
void MapInfo_ClearTemps()
Definition mapinfo.qc:1639
vector MapInfo_Map_supportedGametypes
Definition mapinfo.qh:13
string MapInfo_Map_bspname
Definition mapinfo.qh:6
string MapInfo_Map_title
Definition mapinfo.qh:7
string MapInfo_Map_author
Definition mapinfo.qh:10
string MapInfo_Map_description
Definition mapinfo.qh:9
bool draw_PictureExists(string pic)
Definition draw.qc:86
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define strcpy(this, s)
Definition string.qh:52

References draw_PictureExists(), entity(), GameType_GetID(), GameType_GetTotalCount(), MapInfo_ClearTemps(), MapInfo_Get_ByID(), MapInfo_Map_author, MapInfo_Map_bspname, MapInfo_Map_description, MapInfo_Map_supportedGametypes, MapInfo_Map_title, strcat(), and strcpy.